' -----[ Program Title and Description ]----------------------------------- ' top_board.bs2 ' set pins according to values in code (xxx,yy,zzz) ' xxx = mode ' yy reserved ' zzz = arrow ' Author: "Speaker", IMT Industries, as usual - borrowing heavily from Parallax ' {$STAMP BS2} ' {$PBASIC 2.5} ' -----[ Select Stamp ]--------------------------------------- #SELECT $STAMP #CASE BS2, BS2E, BS2PE T9600 CON 84 #CASE BS2SX, BS2P T9600 CON 240 #CASE BS2PX T9600 CON 396 #ENDSELECT ' -----[ Variables ]------------------------------------------------------- Baud CON T9600 Rx CON 15 ' XBee DOUT Tx CON 14 ' XBee DIN RTS CON 11 ' XBee RTS My_Addr CON $4 ' Set address of node, modify as desired, - ' - $1-$FFFE check VAR Byte code VAR Byte mode VAR Nib arrow VAR Nib ' -----[ Initialization ]-------------------------------------------------- ' -----[ Configure XBee to use RTS and set Address ]--------------------- PAUSE 500 DEBUG CLS,"Configuring XBee...",CR PAUSE 3000 ' Guard time SEROUT Tx,Baud,["+++"] ' Command Mode Sequence PAUSE 2000 ' Guard time SEROUT Tx,Baud,["ATD6 1",CR] ' Enable RTS SEROUT Tx,Baud,["ATMY ", HEX My_Addr,CR] ' Set node address SEROUT TX,Baud,["ATCN",CR] ' Exit Command Mode DEBUG "Awaiting data...",CR ' -----[ Main Routine ]---------------------------------------------------- DO SERIN Rx\RTS,Baud,[check] ' Accept delimiter byte DEBUG CLS IF check = "!" THEN ' Is start delimiter? SERIN Rx\RTS,Baud,[DEC code] DEBUG "code = ", BIN8 code, CR mode = code >> 5 ' Get rid of 5 least significant bits arrow = code arrow = arrow << 1 ' Get rid of anything in the 4th bit arrow = arrow >> 1 DEBUG "mode = ", BIN3 mode, " arrow = ", BIN3 arrow,CR OUTL = code ' These two lines of code are causing the problem DIRL = 255 ENDIF LOOP