My goal is to use a microcontroller with a UART to control an XBee module to transmit information.
I do have a few questions:
Can simple UART communication be used to control Xbee?
Does anyone have some good resources for commands/examples?
What would help me a lot is a simple example of using a serial port (on windows/linux using C/C++/whatever) to set up/control communication with an Xbee. The example would have to not use the API but instead just send commands over serial port as raw characters.
Thank you all for your help!
P.S. I apologize if my questions are a little dumb and easy to answer on my own.
Well, the answer to the first question is “yes”, with a few caveats:
- The XBee needs to see serial logic levels of 0 and 3.3V, so you’ll need level converters if you want to connect it to a standard serial port on a PC. If you have a development board, this is taken care of for you.
- The XBee expects just a carriage return character to end a command, and will similarly terminate strings it sends with a carriage return.
- For short messages like AT commands and responses, you probably won’t need to worry about flow control. But with larger transmissions, you will.
As for sample code, I’m afraid I can’t help unless you want to use Tcl.
Have you read the product manual yet? It isn’t a quick read but it’s pretty comprehensive so it answers most questions. It describes all the commands and operation modes. When I started with the XBee, I found that was the most helpful single resource. Well, alongside the forum of course.
Another point is to check the firmware version supplied with your XBee (the product manual tells you how to do this). If it’s older than 10CD, then use X-CTU to upgrade it before you start experimenting. That will save you from a few potential problems. And the product manual you’ll want is the one known as the 1xCx version.
Hope that helps.
example code in Bascom:
Config Com1 = 9600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0 'XBEE
Config Serialin = Buffered , Size = 254
Config Serialout = Buffered , Size = 254
'I’m not sure if it was necessary to put the following in
Open “com1:” For Binary As #1
Print #1 , “Test”
“Config Serialin = Buffered , Size = 254
Config Serialout = Buffered , Size = 254”
Not sure if this is relevant to your code or not, but the buffer size of a Digi 802.15.4 module is 100 bytes.
thanks for the tip, the software works fine right now, but I’m still testing it. So it could be that the buffer has never extended 100 bytes - I will check this next week.
HOW TO READ A UART DATA FROM MASTER END VIA API FRAME.
I WANT A FRAME TO READ A SLAVE UART DATA(SENSOR).
I HAVE XBEEPRO-24DM MODULE DIGI MESH