help with xbee and propeller
tdahbura
Posts: 6
I am trying to get some code that is written in C to run using xbee communications. I am using the ICC c compiler. is there any c code available similar to the propeller xbee object that supports using xbee communcations.
I asked on the prop forum about merging C code with spin code but in experimenting and based on suggestion that does not seem possible-although I tried a great utility to cross convert c code to spin (which did not due to the complexity of this existing c code).
Was hoping someone might have some libraries to support XBee communications in C?
I need to send blocks of numbers (like long values) and pass data back and forth between two propeller xbee units.
Thanks,
Tony
I asked on the prop forum about merging C code with spin code but in experimenting and based on suggestion that does not seem possible-although I tried a great utility to cross convert c code to spin (which did not due to the complexity of this existing c code).
Was hoping someone might have some libraries to support XBee communications in C?
I need to send blocks of numbers (like long values) and pass data back and forth between two propeller xbee units.
Thanks,
Tony
Comments
The default configuration is almost all you need: just then set each XBee's destination address to be the source address of the other, and it should work.
I've used the first method myself. The problem with an end of transmission character is you need to make sure none of the data includes such a character.
In order to make sure the data doesn't include the end of transmission character you need to convert numeric data to ASCII characters. Recently I've decide to encode my data as ASCII hexadecimal character. This method requires two characters be transmitted for every byte of data.
Here's some of the methods I use to convert the data.
This first method lists the variables to add to the tx buffer.
Below is a method just to add longs which are always eight characters long.
The above methods called this next method which does the actual conversion.
The above adds the appropriate characters to the tx buffer.
Here's code to retreive the information from the ASCII characters.
The maximum value for digits in the above method is eight since there are eight ASCII characters per long and the above method returns a long.
I'm not using XBees in this particular project but the information applies to any Prop to Prop transmission.
Hopefully some of this will be useful.
Duane