BS2SX array question
How would I take part of a char string stored in a 10 byte array and save it to a word variable?
ANI VAR Byte(16)
ID VAR Word
ID = STR ANI\7
????????????????
Thanks
ANI VAR Byte(16)
ID VAR Word
ID = STR ANI\7
????????????????
Thanks

Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Am I outa luck?
Aaron
' {$STAMP BS2} ' {$PBASIC 2.5} buf VAR Byte(5) value VAR Word idx VAR Nib Setup: buf(0) = "3" buf(1) = "1" buf(2) = "2" buf(3) = "b" buf(4) = "x" Main: DEBUG CLS, "String input.... ", STR buf\5, CR GOSUB Str_To_Dec DEBUG "Decimal value... ", DEC value END Str_To_Dec: value = 0 FOR idx = 0 TO 4 IF (buf(idx) >= "0") AND (buf(idx) <= "9") THEN value = value * 10 + (buf(idx) - "0") ELSE EXIT ENDIF NEXT RETURN▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax