SEROUT DEC formatter acting funny
Cheech
Posts: 30
I'm trying to get my stamp to feed me back the numbers I give it, and it does for numbers up to and including 255, any number above that however is not fed back to me correctly.· I know 255 is the·last ASCII digit, but I don't see how that is relevant to what I thought the DEC command was supposed to do (convert decimals into ASCII bytes for each digit).· Here is my code:
' {$STAMP BS2p}
' {$PBASIC 2.5}
serData VAR Byte
Main:
· DO
··· PAUSE 3000
··· SERIN 16, 521, [noparse][[/noparse]WAIT("numb"), DEC serData]
··· SEROUT 16, 521, 50, [noparse][[/noparse]"Gotz it: ", DEC serData]
· LOOP
· END
example:I type "numb255 "· and I get "Gotz it: 255" as expected.· However, if I input "numb1337", I get "Gotz it: 57"
Whats up with that?
' {$STAMP BS2p}
' {$PBASIC 2.5}
serData VAR Byte
Main:
· DO
··· PAUSE 3000
··· SERIN 16, 521, [noparse][[/noparse]WAIT("numb"), DEC serData]
··· SEROUT 16, 521, 50, [noparse][[/noparse]"Gotz it: ", DEC serData]
· LOOP
· END
example:I type "numb255 "· and I get "Gotz it: 255" as expected.· However, if I input "numb1337", I get "Gotz it: 57"
Whats up with that?
Comments