Greetings mackrackit,
The 13,10 it's just for carriage return like so:
How can i detect it ?Code:DEBUG DEC VALUE,13,10
.
Greetings mackrackit,
The 13,10 it's just for carriage return like so:
How can i detect it ?Code:DEBUG DEC VALUE,13,10
.
The only thing i could find in the manual was the Serin and Serin2 commands.
The manual says that:
SERIN2 DataPin {\FlowPin}, Mode, {ParityLabel,}, {Timeout,Label,} [Item...]
with the example:
( where A is the caracter to wait for. )Code:SERIN2 1,16780,[wait (“A”),B0]
and
[code]SERIN2 PORTA.1,84,[skip 2,dec4 B0][code]
( where it will skip the first 2 digits and grab the next 4 digits)
I didnt test it yet, but can i use something like this?
Its not making sense to me because i have values with one, two or three digits ( temps from 0 to 160). The idea is to grab each value - and this line knows when to start for the first value but doesnt know when to finish before grabbing a new one.Code:SERIN2 PORTA.1,84,[wait (13,10),dec3 B0]
And you'll see the same 'type' of thing for HSERIN and DEBUGIN
Now you're thinkin'! Except that it does know when to finish, because you specified when to finish in that line of code above with dec3 B0. As soon as it grabs a 3 digit decimal, the statement is done...I didnt test it yet, but can i use something like this?
Its not making sense to me because i have values with one, two or three digits ( temps from 0 to 160). The idea is to grab each value - and this line knows when to start for the first value but doesnt know when to finish before grabbing a new one.Code:SERIN2 PORTA.1,84,[wait (13,10),dec3 B0]
So in your case, you don't wait for a 13,10 then grab a decimal, flip it around.
Grab a decimal, then wait for the 13,10.
Code:SERIN2 PORTA.1,84,[dec B0, wait (13,10)]
Just use the string input option with the terminator set to 13.
This will receive up to 3 bytes, 0-160, and terminate reception on receipt of 13.Code:MyVar VAR BYTE(3) Main: HSERIN [STR MyVar\3\13] ' receive up to 3 characters, terminate input on receipt of 13 HSEROUT [STR MyVar\3,13,10] ' show it PAUSE 100 goto Main
Bruce, skimask,
Thank you very much for your help.
Will try when i get home, but it makes perfect sense !
.
Another thing to try is just a plain DEC.
DEBUGIN [DEC MyVar]
DEC waits for a numeric character and discards anything else until it gets one. Once it receives a character that is a number, it continues receiving more digits until it gets a non-numeric char which would be the 13.
This way the value can be any length, and you don't have to convert it to a byte.
<br>
DT
Bookmarks