XBee XSC Simple TX and RX - incorrect data passing?

Hi,

I am running a simple program with my series 1 XSC module that transmits a single incrementing byte (0 to 255). The receiver simply receives this byte and displays it on a serial terminal.

But what I get is this (for example):

: 218
: 218
: 218
: 218
: 218
: 154
: 154
: 250
: 253
: 250
: 255
: 251
: 251

(the colons are hard coded in my code)

My code is below (PBASIC).

Anybody have any ideas on this?

I also have tried several display options, including using the XBIX-R Serial Dev board and using the Terminal window in X-CTU. If I do that, I usually get data that looks a lot like “…M…[…]…M…M…[;…[…;.;…”

The code I am using does not employ any flow control - it is the simplest form I could find for initial testing.

These are running on two separate BS2 development boards. The microcontrollers used are BS2SX.

Thanks very much for any help.

[CODE FOR TRANSMIT SIDE:]*

’ {$STAMP BS2sx}
’ {$PBASIC 2.5}
'***********************

XRX PIN 5 ’ Receive Pin (pin 2 on Xbee- DOut)
XTX PIN 4 ’ Transmit Pin (pin 3 on Xbee- Din)

X VAR Byte

HIGH XTX ’ Idle transmit pin

DO
X = X + 1
SEROUT XTX,84, [DEC X,CR] ’ Send value of X as decimal, any ascii message in quotes: “ASCII Message Here!”
DEBUG DEC X, CR
’ Second CR is added byte buffer for flow control example
PAUSE 1000
LOOP

END

*****[CODE FOR RECEIVE SIDE:]

’ {$STAMP BS2sx}
’ {$PBASIC 2.5}
’ ***************************

RX PIN 14 ’ Receive Pin
TX PIN 13 ’ Transmit Pin
X VAR Byte

HIGH TX ’ Idle transmit pin
DO
SERIN RX, 84, [X] ’ Receive data
DEBUG ": ", DEC X, CR
LOOP

On your recieve side change SERIN RX, 84, [X] to SERIN RX, 84, [dec X]. You are sending numerical data and the the recieving stamp thinks it is ASCII data. See if that works and post your findings. Great question!

Thanks for the reply! I had tried to clean out the remnants of all the things I had tried, including STR, DEC and HEX settings for displaying data… I forgot to clean that one up before I posted.

What I also forgot was that I had swapped out one of my BS2SXs for a regular BS2 on the receive side (I needed a BS2sx in another project) - and I forgot to change the BAUDMODE SETTING! The SX needs 240 for 9600, and I was giving it 84! Once I changed the baud setting, my data has flown flawlessly ever since!

Thanks for your having looked through my code, despite the fact I figured it out and as usual it turned out to be general dumbness on my part, I do genuinely appreciate your time on my behalf.

Dave X