SERIN SEROUT via RF
varmavarun
Posts: 6
Heya,
I've been working on some RF code that utilizes SERIN and SEROUT; but am having issues with sending data. Now this code is really basic(no pun intended), but I can't figure out where the problem lies... I'm sure its just a small tweak (or at least I hope it is). Take a look:
SENDER
' {$STAMP BS2}
' {$PBASIC 2.5}
Xcoord VAR Word
Ycoord VAR Word
DEBUG ? Xcoord
DEBUG ? Ycoord
DEBUG "enter X coord:", CR
DEBUGIN DEC Xcoord
DEBUG "enter Y coord:", CR
DEBUGIN DEC Ycoord
SEROUT 11, 9600, [noparse][[/noparse]DEC Xcoord]
SEROUT 11, 9600, [noparse][[/noparse]DEC Ycoord]
END
RECEIVER
' {$STAMP BS2}
' {$PBASIC 2.5}
X VAR Word
Y VAR Word
DO
SERIN 1, 9600, [noparse][[/noparse]DEC X]
SERIN 1, 9600, [noparse][[/noparse]DEC Y]
DEBUG ? X
DEBUG ? Y
LOOP
Basically the programs need to ask for two coordinates, which are then wirlessly sent to the other basic stamp, after which the data is displayed in the receiver basic stamp's debug window. What could be the issue?
could it be something regarding a. DEC formatter? b. Baud rate c. needing to use some kind of WAIT command?
Thanks,
Varun
I've been working on some RF code that utilizes SERIN and SEROUT; but am having issues with sending data. Now this code is really basic(no pun intended), but I can't figure out where the problem lies... I'm sure its just a small tweak (or at least I hope it is). Take a look:
SENDER
' {$STAMP BS2}
' {$PBASIC 2.5}
Xcoord VAR Word
Ycoord VAR Word
DEBUG ? Xcoord
DEBUG ? Ycoord
DEBUG "enter X coord:", CR
DEBUGIN DEC Xcoord
DEBUG "enter Y coord:", CR
DEBUGIN DEC Ycoord
SEROUT 11, 9600, [noparse][[/noparse]DEC Xcoord]
SEROUT 11, 9600, [noparse][[/noparse]DEC Ycoord]
END
RECEIVER
' {$STAMP BS2}
' {$PBASIC 2.5}
X VAR Word
Y VAR Word
DO
SERIN 1, 9600, [noparse][[/noparse]DEC X]
SERIN 1, 9600, [noparse][[/noparse]DEC Y]
DEBUG ? X
DEBUG ? Y
LOOP
Basically the programs need to ask for two coordinates, which are then wirlessly sent to the other basic stamp, after which the data is displayed in the receiver basic stamp's debug window. What could be the issue?
could it be something regarding a. DEC formatter? b. Baud rate c. needing to use some kind of WAIT command?
Thanks,
Varun
Comments
You need to put BAUDMODE, not baud RATE in the SERIN and SEROUT statements. Check the PBASIC Help file for details.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Programming can't be all that difficult, it's nothing but 1's and 0's