EasyManua.ls Logo

Parallax BASIC Stamp 2e - Page 284

Default Icon
353 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SERIN - BASIC Stamp Command Reference
Page 282 BASIC Stamp Programming Manual 2.0b www.parallaxinc.com
The BS1’s SERIN command is limited to above-mentioned features. If you
are not using a BS1, please continue reading about the additional features
below.
The decimal formatter is only one of a whole family of conversion
formatters available with SERIN on the BS2, BS2e, BS2sx and BS2p. See
Table 5.76 for a list of available conversion formatters. All of the
conversion formatters work similar to the decimal formatter (as described
in the “Decimal Formatter Specifics” section, above). The formatters
receive bytes of data, waiting for the first byte that falls within the range of
characters they accept (e.g., “0” or “1” for binary, “0” to “9” for decimal,
“0” to “9” and “A” to “F” for hex, and “+” or “-” for signed variations of
any type). Once they receive a numeric character, they keep accepting
input until a non-numeric character arrives or (in the case of the fixed
length formatters) the maximum specified number of digits arrives.
While very effective at filtering and converting input text, the formatters
aren’t completely foolproof. As mentioned before, many conversion
formatters will keep accepting text until the first non-numeric text arrives,
even if the resulting value exceeds the size of the variable. After SERIN, a
byte variable will contain the lowest 8 bits of the value entered and a word
would contain the lowest 16 bits. You can control this to some degree by
using a formatter that specifies the number of digits, such as DEC2, which
would accept values only in the range of 0 to 99.
The BS2, BS2e, BS2sx and BS2p also have special formatters for handling a
string of characters, a sequence of characters and undesirable characters.
See Table 5.77 for a list of these special formatters. Also, see Appendix C
for example serial inputs and the result of using these formatters.
1
2
e
2
sx
2
p
2
ADDITIONAL CONVERSION
FORMATTERS
.
O
NCE AGAIN, PAY ATTENTION TO
POTENTIAL ROLLOVER ERRORS
.

Table of Contents

Related product manuals