BASIC stamp manual v2.2
5: BASIC Stamp Command Reference – SEROUT
BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com • Page 421
SEROUT 1, 16780, ["Hello", CR]
SEROUT 1, 16780, ["Num = ", DEC 100]
The above code will display "HELLO" on one line and "Num = 100" on the
next line. Notice that you can combine data to output in one SEROUT
command, separated by commas. In the example above, we could have
written it as one line of code, with "HELLO", CR, "Num = ", DEC 100 in the
OutputData list.
The BS1’s SEROUT command is limited to above-mentioned features. If
you are not using a BS1, please continue reading about the additional
features below.
The SEROUT command can also be configured to pause between
transmitted bytes. This is the purpose of the optional Pace argument. For
example (9600 baud N8, inverted):
SEROUT 1, 16780, 1000, ["Slowly..."]
Here, the BASIC Stamp transmits "Slowly..." with a 1 second delay
between each character. See Table 5.104 for units of the Pace argument.
One good reason to use the Pace feature is to support devices that require
more than one stop bit. Normally, the BASIC Stamp sends data as fast as
it can (with a minimum of 1 stop bit between bytes). Since a stop bit is
really just a resting state in the line (no data transmitted), using the Pace
option will effectively add multiple stop bits. Since the requirement for 2
or more stop bits (on some devices) is really just a "minimum"
requirement, the receiving side should receive this data correctly.
Keep in mind that when we type something like “XYZ” into the SEROUT
command, the BASIC Stamp actually uses the ASCII codes for each of
those characters for its tasks. We could also typed: 88, 89, 90 in place of
“XYZ” and the program would run the same way since 88 is the ASCII
code for the “X” character, 89 is the ASCII code for the “Y” character, and
so on.
The decimal formatter is only one of a whole family of conversion
formatters available with SERIN on all BS2 models. See Table 5.110 for a
list of available conversion formatters. All of the conversion formatters
work similar to the decimal formatter. The formatters translate the value
into separate bytes of data until the entire number is translated or until the
USING SEROUT'S PACE ARGUMENT TO
INSERT DELAYS BETWEEN TRANSMITTED
BYTES
.
U
SING ASCII CODES.
A
DDITIONAL CONVERSION FORMATTERS.
NOTE: The rest of the code examples
for this section are written for the BS2,
using the BS2's Baudmode and
Timeout values. Be sure to adjust the
value for your BASIC Stamp model.
This is written with the BS2's Baudmode
value. Be sure to adjust the value for
your BASIC Stamp model.
All
2
1
All
2