Javelin Stamp with Xbee/Zigbee in Broadcast Mode
Hello,
Has anyone been able to get the Javelin to work with the XBee/Zigbee's in Multicast mode? Unicast mode works great, but there's a problem when trying to operate in unicast mode. To utilize Multicast Mode, the Destination Address High (DH) has to be set to 0xFFFF which is 65535 in Decimal.
The Javelin only supports short and int, both 16bit signed integers ranging from (32767: -32768)
Given this problem, has anyone been able to circumvent this to get Broadcast mode working?
Next, I figured I'd do this manually, and send a request R to each of my units individually:
base.send("R",1);
if (base.byteAvailable()) System.out.println("message: " + base.getStringData() + "\n");
base.send("R",2);
if (base.byteAvailable()) System.out.println("message: " + base.getStringData() + "\n");
base.send("R",3);
if (base.byteAvailable()) System.out.println("message: " + base.getStringData() + "\n");
And the results were that only the data from Node 3 (the last one ) was processed. Does anyone know how the buffer responds when multiple nodes respond to the base node simultaneously? Are the contents of the buffer overwritten as nodes 2 and 3 reply??
I was able to get around this problem by simply doing the following:
base.send("R",1);
CPU.delay(450);
if (base.byteAvailable()) System.out.println("message: " + base.getStringData() + "\n");
base.send("R",2);
CPU.delay(450);
if (base.byteAvailable()) System.out.println("message: " + base.getStringData() + "\n");
base.send("R",3);
CPU.delay(450);
if (base.byteAvailable()) System.out.println("message: " + base.getStringData() + "\n");
But i'm curious as to why the modem is not giving an error message if the buffer is full. And why if the buffer isnt full are the other two messages disappearing without the delay.
Thanks
RF
Has anyone been able to get the Javelin to work with the XBee/Zigbee's in Multicast mode? Unicast mode works great, but there's a problem when trying to operate in unicast mode. To utilize Multicast Mode, the Destination Address High (DH) has to be set to 0xFFFF which is 65535 in Decimal.
The Javelin only supports short and int, both 16bit signed integers ranging from (32767: -32768)
Given this problem, has anyone been able to circumvent this to get Broadcast mode working?
Next, I figured I'd do this manually, and send a request R to each of my units individually:
base.send("R",1);
if (base.byteAvailable()) System.out.println("message: " + base.getStringData() + "\n");
base.send("R",2);
if (base.byteAvailable()) System.out.println("message: " + base.getStringData() + "\n");
base.send("R",3);
if (base.byteAvailable()) System.out.println("message: " + base.getStringData() + "\n");
And the results were that only the data from Node 3 (the last one ) was processed. Does anyone know how the buffer responds when multiple nodes respond to the base node simultaneously? Are the contents of the buffer overwritten as nodes 2 and 3 reply??
I was able to get around this problem by simply doing the following:
base.send("R",1);
CPU.delay(450);
if (base.byteAvailable()) System.out.println("message: " + base.getStringData() + "\n");
base.send("R",2);
CPU.delay(450);
if (base.byteAvailable()) System.out.println("message: " + base.getStringData() + "\n");
base.send("R",3);
CPU.delay(450);
if (base.byteAvailable()) System.out.println("message: " + base.getStringData() + "\n");
But i'm curious as to why the modem is not giving an error message if the buffer is full. And why if the buffer isnt full are the other two messages disappearing without the delay.
Thanks
RF
Comments
First, don't use
System.out.println("message: " + base.getStringData() + "\n");
This leads to OutOfMemory errors.
Instead use
System.out.print("message: ");
System.out.println(base.getStringData()); //println already appends a \n so the "\n" is not required
Secondly, you can use short for unsigned 16bit values,
eg. int val = (short)0xFFFF;
regards peter