Xbee Help, values not transmitting
Hi Guys,
I'm having trouble getting my xbees to communicate from prop to prop. I'm working on a remote control and I can't seem to get the signals from my controller to be read on my robot.
I've checked the obvious, each is receiving 3.3V, Dout is connected to the XB_Rx pin and Din is connected to the XB_Tx pin, and I've tested the xbees with the x-ctu software to make sure they are actually working.
Below is my code for the transmitter and receiver:
Transmitter
So I'm just trying to get the values from my remote to be read on my receiver and printed to the PST.
Any help would be much appreciated
Thanks,
Marc
I'm having trouble getting my xbees to communicate from prop to prop. I'm working on a remote control and I can't seem to get the signals from my controller to be read on my robot.
I've checked the obvious, each is receiving 3.3V, Dout is connected to the XB_Rx pin and Din is connected to the XB_Tx pin, and I've tested the xbees with the x-ctu software to make sure they are actually working.
Below is my code for the transmitter and receiver:
Transmitter
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
cpin = 0
dpin = 1
spin = 2
XB_Rx = 26
XB_Tx = 27
XB_Baud = 9600
VAR
Long Sldr[6]
Long Gmbl[6]
OBJ
ADC : "MCP3208"
PST : "Parallax Serial Terminal"
XB : "Xbee_Object_2"
Pub Start
XB.start(XB_Rx, XB_Tx, 0, XB_Baud) ' Initialize comms for XBee
repeat
Sldr[1] := ADC.average(0,10)
Sldr[2] := ADC.average(1,10)
Sldr[3] := ADC.average(2,10)
Gmbl[1] := ADC.average(3,10)
Gmbl[2] := ADC.average(4,10)
Gmbl[3] := ADC.average(5,10)
Gmbl[4] := ADC.average(6,10)
IF Gmbl[4] > 2500
Gmbl[4] := 1
ELSE
Gmbl[4] := 0
XB.Tx("!") ' Send start delimiter
XB.Dec(Sldr[1])
XB.CR
XB.Dec(Sldr[2])
XB.CR
XB.Dec(Sldr[3])
XB.CR
XB.Dec(Gmbl[1])
XB.CR
XB.Dec(Gmbl[2])
XB.CR
XB.Dec(Gmbl[3])
XB.CR
XB.Dec(Gmbl[4])
XB.CR
ReceiverCON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
XB_Rx = 26
XB_Tx = 27
XB_Baud = 9600
VAR
Long Sldr[6]
Long Gmbl[6]
OBJ
XB : "Xbee_Object_2"
PST : "Parallax Serial Terminal"
Pub Go | DataIn
XB.Start(XB_Rx,XB_Tx,0,XB_Baud)
PST.start(115200)
PST.str(string("Awaiting Data..."))
Repeat
DataIn := XB.Rx ' Accept incoming byte
If DataIn == "!" ' If start delimiter
DataIn := XB.RxDecTime(500) '
if DataIn <> -1 ' If wasn't time out
Sldr[1] := DataIn
DataIn := XB.RxDecTime(500)
if DataIn <> -1
Sldr[2] := DataIn
DataIn := XB.RxDecTime(500)
if DataIn <> -1
Sldr[3] := DataIn
DataIn := XB.RxDecTime(500)
if DataIn <> -1
Gmbl[1] := DataIn
DataIn := XB.RxDecTime(500)
if DataIn <> -1
Gmbl[2] := DataIn
DataIn := XB.RxDecTime(500)
if DataIn <> -1
Gmbl[3] := DataIn
DataIn := XB.RxDecTime(500)
if DataIn <> -1
Gmbl[4] := DataIn
PST.str(string(" Sldr 1 ="))
PST.dec(Sldr[1])
PST.str(string(" Sldr 2 ="))
PST.dec(Sldr[2])
PST.str(string(" Sldr 3 ="))
PST.dec(Sldr[3])
PST.str(string(" Gmbl LR ="))
PST.dec(Gmbl[1])
PST.str(string(" Gmbl UD ="))
PST.dec(Gmbl[2])
PST.str(string(" Gmbl ROT ="))
PST.dec(Gmbl[3])
PST.str(string(" Gmbl Btn ="))
IF Gmbl[4] == 1
PST.str(string("ON"))
ELSE
PST.str(string("OFF"))
PST.newline
So I'm just trying to get the values from my remote to be read on my receiver and printed to the PST.
Any help would be much appreciated
Thanks,
Marc

Comments
Also your receive loop will fall through on timeouts and may mess up your data sync. Just use xbee.rx instead and make sure you are actually sending data to get you out of the receive mode.
If the radios are working in XCTU then you have them set up fine.
Try transmitting from one prop to XCTU terminal as a check and from XCTU to the receiver prop as well.
Good luck.
sm