PDA

View Full Version : serin DEC



barkerben
- 12th November 2005, 14:17
Hi,

I was wondering...

If I use serin2 and dec, will the read stop when a non numeric character is received?

For instance, if I have the following arrive at my serial port:

A12abcd

and I use the command SERIN2.... [WAIT("A"),dec foo]

where foo is a byte, will foo end up with the value 12 in it? In other words, is the compiler "smart" enough to notice the following characters are non numeric?

Also, what would happen if my input string was instead:

A1234abcd

1234 is too large to fit into one byte, wich is however what the code is asking for. What kind of error would this give? Would the byte just end up as 255?

And how about if I had the following:

Input string is:

ABCDEFG123

SERIN2.... [WAIT("A"),dec foo]

The command now waits for "A", then tries to read in a numeric value, but the next character is B. Will it keep skipping characters for ever until it finds a numeric value (eventually returning 123), or just return nothing...?

Cheers,

Ben