NXC: BT NXT to NXT - ReceiveRemoteString slave synch?
Posted: 26 Feb 2012, 10:42
hi,
using on the BT master
what are the corresponding cmds on the slave to clear the mailbox and the mailbox queue so that he may put his current (random) string into his mailbox for reading just in that moment of request (to avoid mailbox block or mailbox queue overflow or having old string values)?
each slave:
using on the BT master
Code: Select all
ReceiveRemoteString(INBOX, bDELETE, MSG_STRING);
Code: Select all
// master
task ReceiveSlaveData() // master
{
string _msg;
while(true) {
until(ReceiveRemoteString(2, true, _msg) == NO_ERR); // for COMM 1
// do something with the _msg of slave 1);
Wait(10);
until(ReceiveRemoteString(5, true, _msg) == NO_ERR); // for COMM 2
// do something with the _msg of slave 2);
Wait(10);
until(ReceiveRemoteString(8, true, _msg) == NO_ERR); // for COMM 3
// do something with the _msg of slave 3);
Wait(10);
}
Wait(10);
}
}
Code: Select all
// slave
task SlavePuttingDataIntoMailbox() {
string out;
char OUTBOX; //slave 1:OUTBOX=2 , slave 2:OUTBOX=5, slave 3:OUTBOX=8
while (true) {
out= ... // random/changing anything over/during time
// what to do...if now or before requested by master...
// to clear all old and/or unread messages in mailbox or queue
// before putting in just the newest / latest string value?
SendResponseString(OUTBOX, out);
Wait(20);
}
}