xbee running only at 9600??
RN
Posts: 28
I am trying wireless communication using stingray. I have written this code
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
OBJ
XB : "XBee_Object"
var
byte Value
Pub Start
XB.start(9,8,0,9600) ' XBee Comms - RX,TX, Mode, Baud
XB.AT_Init ' Initialize for fast AT command use - 5 second delay to perform
XB.AT_ConfigVal(string("ATMY"),$5) ' Set MY address to 5
repeat
XB.str(string("demo"))
waitcnt(clkfreq + cnt)
XB.Dec(10)
waitcnt(clkfreq + cnt)
On the computer i am using bray's terminal. Surprisingly it is running only at 9600bps. At any baud it is giving garbage data. i am changing the baud in the bray's terminal also. what can be the possible reasons
thanks
RN
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
OBJ
XB : "XBee_Object"
var
byte Value
Pub Start
XB.start(9,8,0,9600) ' XBee Comms - RX,TX, Mode, Baud
XB.AT_Init ' Initialize for fast AT command use - 5 second delay to perform
XB.AT_ConfigVal(string("ATMY"),$5) ' Set MY address to 5
repeat
XB.str(string("demo"))
waitcnt(clkfreq + cnt)
XB.Dec(10)
waitcnt(clkfreq + cnt)
On the computer i am using bray's terminal. Surprisingly it is running only at 9600bps. At any baud it is giving garbage data. i am changing the baud in the bray's terminal also. what can be the possible reasons
thanks
RN
Comments
Now, I imagine what you're saying is that it works at 9600, but not when you try a higher speed. But you also say that you're getting garbage at any speed, so that part sounds like you're saying it never works. I'm confused about the issue.
When you use an XBee, the XBee itself must be set to a particular serial interface rate. The default value is 9600 baud. If you want a different rate, you have to make the change and save it, which you can do either through XCTU (the Digi software for XBees) or using a terminal program and AT commands:
+++ ' Enter command mode
ATBD 5 ' Set interface rate to 38,400: 6 would be 57,600, other rates in the docs.
ATWR ' Write the changes to the XBee's memory
You _also_ have to set the interface rate in your software, which is what your line XB.start(9,8,0,9600) does. If you try to set a different rate in software but haven't changed the XBee's rate, you won't be able to communicate with it.
It is important to understand that this is only about the exchange of data between your computer or processor and the XBee. The rate of RF data between one XBee and another is determined by other things (nominally 250,000 bps, but probably dramatically affected by conditions, retries, etc.).
it's best to post your code between code tags. They look like this
[ code ]
[/ code ]
but you need to remove all the spaces inside the brackets for it to work properly.
Also, there is a Wireless Forum on here. Just click on Public Forums in the upper left corner and you will see it listed. You might try posting there for anything related to the Xbee since non-Propeller forum members use the Xbee, too. Just a thought.
cheers,
Mark
i am changing the baud in the code. where i have written 9600 in the spin code i am writing 38400 or 115200 etc. then i am changing the baud in the bray's terminal to which the wireless is connected through usb interface but at any other baud than 9600 it is not working. isnt is all it needs to do wireless communication other than 9600 bps
Thanks its working now. You know i am working on xbee for quite a time but never knew that to change the baud rate is not just a button click. It took time to write the new settings.
I used the XCTU software to do it. well thanks again
RN
Remember that when you change the XBee's serial communications rate, you won't be able to communicate with it - even through XCTU - except at the new rate. Be sure you know what rate you've set it to.
It's worth skimming through the XBee manual to see how all of this stuff works. There's a lot of things in there about what you can do.