Parallax BASIC Stamp 2e Programming Manual page 282

Table of Contents

Advertisement

SERIN - BASIC Stamp Command Reference
To further illustrate this, consider the following examples (assuming we're
using the same code example as above):
1) Serial input: ABC
Result:
The BASIC Stamp halts at the SERIN command,
continuously waiting for decimal text.
2) Serial input: 123 (with no characters following it)
Result:
The BASIC Stamp halts at the SERIN command.
recognizes the characters "1", "2" and "3" as the number one
hundred twenty three, but since no characters follow the "3", it
waits continuously, since there's no way to tell whether 123 is the
entire number or not.
3) Serial input: 123 (followed by a space character)
Result:
Similar to example 2, above, except once the space
character is received, the BASIC Stamp knows the entire number
is 123, and stores this value in SerData. The SERIN command then
ends, allowing the next line of code, if any, to run.
4) Serial input: 123A
Result: Same as example 3, above. The "A" character, just like the
space character, is the first non-decimal text after the number 123,
indicating to the BASIC Stamp that it has received the entire
number.
5) Serial input: ABCD123EFGH
Result: Similar to examples 3 and 4 above.
"ABCD" are ignored (since they're not decimal text), the
characters "123" are evaluated to be the number 123 and the
following character, "E", indicates to the BASIC Stamp that it has
received the entire number.
Of course, as with all numbers in the BASIC Stamp, the final result is
limited to 16 bits (up to the number 65535). If a number larger than this is
received by the decimal formatter, the end result will look strange because
the result rolled-over the maximum 16-bit value.
The BS1 is limited to the decimal formatter shown above, however the
BS2, BS2e, BS2sx and BS2p have many more conversion formatters
Page 280 • BASIC Stamp Programming Manual 2.0b • www.parallaxinc.com
It
The characters
W
ATCH OUT FOR ROLLOVER ERRORS
.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents