I would like to extract the numbers shown as test[8] in the following program.
This from the program ser2mod.bas. I want to use the value of data received to change the program from one direction to another.
How do I access the bytes in the array to act upon.
'ser2mod.bas
' PicBasic Pro Code that demonstrates the use of modifiers
' with the Serin2 and Serout2 commands.
testword VAR WORD ' Define word variable
testbyte VAR BYTE ' Define byte variable
test8 VAR BYTE[8] ' Define array variable with 8 locations
pinin VAR PORTC.7 ' Define pinin as PORTC.7
pinout VAR PORTC.6 ' Define pinout as PORTC.6
' For these examples, assume that the following string
' is being received continuously at 2400 baud on PORTC.7:
' "X-1011Y-546Z-F7ZZ-0001"
loop:
Serin2 pinin,396,[WAIT("F"), STR test8\8]
Serout2 pinout,396,["14: ",STR test8\8,13,10] ' 15: 7ZZ-0001
' Waits for the string "F", then collects the next 8 characters. These are
' stored as ascii in 8 locations of the array variable test8. The SerOut2
' statement uses the same modifier to send all 8 locations of the array
' variable as an ascii string.
Pause 2000
Goto loop
Thanks, Ross Terry
Bookmarks