Download Print this page

Parallax 32440 Manual page 5

Xbee wireless pack kickstart

Advertisement

' Set pins and Baud rate for XBee communication
XB_Rx = 0
XB_Tx = 1
XB_Baud = 9600
' Set pins and baud rate for PC communication
PC_Rx = 31
PC_Tx = 30
PC_Baud = 115200
VAR
long stack[50]
Pub Go
PC.start(PC_Rx, PC_Tx, 0, PC_Baud) ' Initialize comms for PC
XB.start(XB_Rx, XB_Tx, 0, XB_Baud) ' Initialize comms for XBee
cognew(XB_to_PC,@stack)
PC.rxFlush
repeat
XB.tx(PC.rx)
Pub XB_to_PC
XB.rxFlush
repeat
PC.tx(XB.rx)
Note: This program uses the Parallax Serial Terminal object library, which is included with the
Propeller Tool software download.
Note: To view the results of the demonstration, after uploading is complete run the Parallax
Serial Terminal from the Run menu, or press F11, then click Enable. Momentarily depress the
Reset button on the Propeller QuickStart board to restart the program.
Note: Press a letter or number key. You will know things are working when each key you press
is echoed back as you type it. If you prefer, uncheck the Echo On box to prevent double
characters from appearing.
Copyright © Parallax Inc.
' XBee DOUT
Data coming in from XBee
' XBee DIN
Data going out of XBee
' Stack space for second cog
' Start cog for XBee--> PC comms
' Empty buffer for data from PC
' Accept data from PC and send to XBee
' Empty buffer for data from XB
' Accept data from XBee, send to PC
Page 5 of 7

Advertisement

loading