Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp won't show the RSSI level of Xbee — Parallax Forums

Basic Stamp won't show the RSSI level of Xbee

theruss007theruss007 Posts: 7
edited 2012-10-15 22:10 in Accessories
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

Comments

  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-10-07 09:53
    It won't show a non-zero RSSI value until it receives a packet. You didn't mention a transmitter or how it is set up. Are you seeing flashing lights?

    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.
  • theruss007theruss007 Posts: 7
    edited 2012-10-07 10:37
    I have another Xbee connected to my laptop. I am seeing both the receiver and the transmitting flash rapidly on the Xbee that is connected to the Basic Stamp. Only the transmitter light blinks on the other Xbee and it isn't as fast. I will try the 1000 ms pause as soon as I get a chance.
  • Wheelie016Wheelie016 Posts: 11
    edited 2012-10-08 05:35
    This is my another account I forgot I had created a while back. Anyways....

    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....
  • Wheelie016Wheelie016 Posts: 11
    edited 2012-10-08 16:57
    After some trial and error, I was able to receive and display the RSSI signal, but only after I send a character beforehand and then have an IF THEN statement decide of it is the correct character ( I chose an exclamation mark). Then the program is exactly like I wrote originally. So why must it keep refreshing?
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-10-08 20:33
    You said, "I followed along with some of the pdf tutorial and the examples worked." I think that confirms that you have had communication working between your PC and the XBee. Right? That would dispose of a lot of possible configuration and hardware issues.

    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.
  • Wheelie016Wheelie016 Posts: 11
    edited 2012-10-09 15:34
    I removed the HEX command from the SERIN command, just to see what it would display, if anything. It displayed the number 79 most of the time, but there were quite a few times it displayed 75 and 13. I do not know what the regular ASCII would translate hex values into, but if I could find out that would tell us what the incoming data was correct?

    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 HebelMartin Hebel Posts: 1,239
    edited 2012-10-13 07:15
    In your configuration, you are setting D6 to 1, this enables RTS flow control, but I don't see flow control being used in the SERIN. This also causes the xbee to buffer data, so when you do get data, it may be old. FYI, it's been a couple years since I did programming with these, so I may be rusty.

    Martin
  • Wheelie016Wheelie016 Posts: 11
    edited 2012-10-14 09:17
    Thanks for the info. I'll try taking that out.
  • Wheelie016Wheelie016 Posts: 11
    edited 2012-10-15 17:28
    Tried that, and it didn't return anything. ha
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-10-15 22:10
    In the opening post you said, "I followed along with some of the pdf tutorial and the examples worked. " What worked? For example, can you type characters on the PC and send them to the BS2 XBee and display them on the LCD screen? That uses only the "transparent" mode and does not require that the XBee go into command mode. Easier. It should be your first success.
Sign In or Register to comment.