Serial data with XBee
port513
Posts: 50
in Propeller 1
I would like to have the Prop to receive data from my PC with XBee transmission.
Ihave set it up and verified that I can send a character from PC and return it from my Prop.
But if I want to send more, like a string to my Prop, how should I do that?
How do my Prop know when there is data ready on the UART?
Ihave set it up and verified that I can send a character from PC and return it from my Prop.
But if I want to send more, like a string to my Prop, how should I do that?
How do my Prop know when there is data ready on the UART?
Comments
What should I look for as an end character?
I use .rxtime() in the event that I just catch the first character; at 57600 baud 1ms is plenty of time for the XBee to RX and stuff the characters into the serial buffer. My method returns the number of characters in my buffer; if it's zero, then there is nothing to do.
If you're program is sending simple strings, you can use this then treat the working buffer as a string -- but to do this, you need to clear it to zeroes before you call this method. Let's say you have an array of 40 bytes that you want to use as your working buffer after it's been pulled from the XBee. Clear it with bytefill like this:
In Spin -- a with may languages -- strings are simply an array of characters terminated with a NUL (0). Using bytefill ensures that you'll be good no matter how long the string is.
BTW... I don't use a specialty XBee object, I have a code block that handles the details I need. In the example above, xbee is an instantiation of my variation of FullDuplexSerial.
dscan should read a string right?
I'm using C/C++ BTW