Basic Stamp won't show the RSSI level of Xbee
theruss007
Posts: 7
I have recently purchased an the Xbee wireless kit, and have been experimenting with it. I was display the RSSI signal strength on the parallax LCD, but whenever I do, it just shows the number zero. I followed along with some of the pdf tutorial and the examples worked. So I am wondering what I am doing wrong. This is my code:
Rx PIN 15
Tx PIN 14
RTS PIN 11
Lcd PIN 12
DataIn VAR Word
'LCD SETUP
SEROUT Lcd, 84, [22,12]
PAUSE 5
SEROUT Lcd, 84, ["Configuring Xbee..."]
PAUSE 5
'XBEE Setup
SEROUT Tx, 84, ["+++"]
PAUSE 2000
SEROUT Tx, 84, ["ATD6 1,GT3,CN", CR]
PAUSE 500
Main:
SEROUT Tx, 84, ["+++"]
PAUSE 5
SEROUT Tx, 84, ["ATDB,CN",CR]
SERIN Rx\RTS, 84,50,TimeOut, [HEX DataIn]
SEROUT Lcd, 84, [DEC DataIn]
TimeOut:
GOTO Main
Rx PIN 15
Tx PIN 14
RTS PIN 11
Lcd PIN 12
DataIn VAR Word
'LCD SETUP
SEROUT Lcd, 84, [22,12]
PAUSE 5
SEROUT Lcd, 84, ["Configuring Xbee..."]
PAUSE 5
'XBEE Setup
SEROUT Tx, 84, ["+++"]
PAUSE 2000
SEROUT Tx, 84, ["ATD6 1,GT3,CN", CR]
PAUSE 500
Main:
SEROUT Tx, 84, ["+++"]
PAUSE 5
SEROUT Tx, 84, ["ATDB,CN",CR]
SERIN Rx\RTS, 84,50,TimeOut, [HEX DataIn]
SEROUT Lcd, 84, [DEC DataIn]
TimeOut:
GOTO Main
Comments
Also, the main loop spends most of its time in command mode. I know the XBee won't transmit over the air while it is in command mode, and, I'm not sure of this, but it may be that it won't receive either. Try it with a PAUSE 1000 at the top of the main loop.
I tried placing a Pasue of 1 second at the beginning of the main loop, but that did not work. I tried varying the lengths(down to 5 ms) and placement of it but nothing worked....
In this command...
SERIN Rx\RTS, 84,50,TimeOut, [HEX DataIn]
is your program actually receiving a value for DataIn, or is it falling through the TimeOut? You can sort that out with a special code to your LCD.
It might be good to have it actually receive data from the PC and print that on the LCD, then the RSSI. That way you can be sure it is receiving something.
I also added a SEROUT command right before the LCD that way I could view the data in the terminal window, and it was sending multiple "0"'s (this was before I tried removing the HEX command). So it IS sending data repeatedly.
It still just baffles me how it works fine if you add an IF THEN statement(other than having to actually tell it ti send the RSSI value), and not when you t ry to loop it...
Martin