SERIN - BASIC Stamp Command Reference
Page 280
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
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. It
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. The characters
“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
W
ATCH OUT FOR ROLLOVER ERRORS
.
Summary of Contents for BASIC Stamp 2e
Page 1: ...BASIC Stamp Programming Manual Version 2 0c...
Page 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...