Xbee AT commands
dermot
Posts: 26
Hi,
I'm using Xbee Series1 devices controlled by the Prop. I want to change the ATDL quickly in spin. How can I do this as fast as possible?? Currently I use "XB.AT_ConfigVAL(string("ATDL"),$11)" for example. I find this too slow.
What I am trying to do is accept a value to a base and send a value to a remote device as a response but the information is coming in to the base too quickly. I cannot keep configuring the Xbee DL value fast enough.
Any help will be great
Thanks
I'm using Xbee Series1 devices controlled by the Prop. I want to change the ATDL quickly in spin. How can I do this as fast as possible?? Currently I use "XB.AT_ConfigVAL(string("ATDL"),$11)" for example. I find this too slow.
What I am trying to do is accept a value to a base and send a value to a remote device as a response but the information is coming in to the base too quickly. I cannot keep configuring the Xbee DL value fast enough.
Any help will be great
Thanks
Comments
It looks like you are using "XBee Object Library" by Martin Hebel.
That is an excellent program and has helped me very much.
Did you follow the instructions to use XB.AT_Init at start to allow fast configuration?
You ask What kind of speed are you looking for?
Roger.
I wish to execute this entire routine in under 100mS, preferable around 50mS. Is this possible?? Can I reliably change the destination address that quickly????
E.g.
XB.API_Str(2,string("Hello number 2")) ' Send data to destination address 2
The following is the code for the controller. This is ment to activate an Led on the end device but it does nothing!!
I send a decimal value of number 2 to destination address 0. The end device has the following code
Can anyone see why this will not work??
I received your PM. Sorry but my XBees are the ZigBee version (Series 2). I doubt they would work the same as your Series 1 XBees.
One thing I often do when debugging wireless connections to send lots of data to a serial terminal from both devices. And instead of use the normal tx, char or out method, I use a method that checks to see if the character is a printable character before sending it to the terminal. If it's not printable, I have it display the hexadecimal value in the terminal window.
You'll notice I have calls to a "TV" object that are presently commented out. The above methods make it easy to switch between a TV and terminal window as a debug screen.
I used the name Tbug because I originally used it with a TV screen as a debug window.
I've not used the decimal parsing within the XBee object. With a single byte command such as you have, it should be possible to use the single byte commands, rather than going to the trouble of string conversion on one end and parsing on the other. KISS:
transmit:
XB.API_tx(0, 2) ' send one byte, ascii code 2, to DL=0.
receive:
if byte[XB.RxData][0] == 2 ' receive one byte, test if it is ascii code 2.
It is extremely useful to be able to visualize the data received on a serial terminal, at least during development. If you have a XBee/USB adapter, then use X-CTU terminal mode to see HEX API packets being received, to get sense of how they are structured and to see if your transmitted packet is what you expect. On the Prop, open another serial port for debugging to the terminal screen. In API mode, Martin's object also parses out items such as the packet length, the RSSI and the sender's origin address. From a troubleshoooting standpoint, you asked the question of whether a "2" command is making it through, but step back and ask if anything at all is coming through.
Another approach if you want to fall back to transparent mode, would be to cut the delay in AT_ConfigVal down from 100ms to say 10ms or 20ms. You should be able to do that, because the AT_Init command had set the guard time to a squeaky thin 3 milliseconds. That should allow you to meet your 50ms criterion. You had this working in transparent mode, right, but it was just too slow?
The main controller will transmit in API and the remote devices will receive in API. This all takes place in the main cog.
I am running another cog in the remote devices to transmit back to the controller in API. However this does not work at all!!!! The cog is definitely been activated but no communication! Does anyone know why this might be??
2 Cogs confusing the XBee does make since. I'll try using the flag method. What exactly do you mean by "Use a buffer both cogs know the location to store the outgoing message. ".
I tried to find a simple example of using flags as a signal between cogs. All the code I found was really complicated so I wrote a small example program to show what I mean.
In this case I used a pointer as a flag. When the pointer "txPointer" equals zero the first cog (cog 0) knows there's nothing to transmit. If "txPointer" doesn't equal zero, it uses the value stored in "txPointer" to locate the string to send.
Sending output from two cog mainly causes trouble when they both send the output at the same time. The two transmissions end getting merged into one garbled message. There are other ways around this problem. Locks can be used to tell the other cogs some resource is presently being use.