How to read 16 comma-delimited hex2 values with SERIN?
Al3
Posts: 6
I have this array
MemData VAR Byte(16)
1) I would like to send the following string and read it with SERIN or whatever appropriate command into above array.
"01,02,03,04,05,06,07,08,09,0A,0B,0C,0D,0E,0F,FF"
2) How would it be done if 16 values were not separated with commas?
"0102030405060708090A0B0C0D0E0FFF"
Thank you.
MemData VAR Byte(16)
1) I would like to send the following string and read it with SERIN or whatever appropriate command into above array.
"01,02,03,04,05,06,07,08,09,0A,0B,0C,0D,0E,0F,FF"
2) How would it be done if 16 values were not separated with commas?
"0102030405060708090A0B0C0D0E0FFF"
Thank you.
Comments
FOR i = 0 to 15
SERIN <pin>,<BaudValue>,[HEX2 MemData[ i ]]
NEXT
Your 1st case depends on how the last value is delimited. You have a comma as the delimiter for all but the last value. It's easier if you use a space or carriage return as the delimiter for the last value:
FOR i = 0 to 15
SERIN <pin>,<BaudValue>,[HEX MemData[ i ]]
NEXT
Read the description of the various input formatters in Appendix C of the Basic Stamp Syntax and Reference Manual to get the details of how these work.