2
2
e
This is written with the BS2's
BaudMode value. Be sure to adjust
the value for your BASIC Stamp.
2
2
e
U
SEROUT'
P
SING
S
ACE ARGUMENT
TO INSERT DELAYS BETWEEN
.
TRANSMITTED BYTES
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.
U
ASCII
.
SING
CODES
5: BASIC Stamp Command Reference – SEROUT
The SEROUT command sends quoted text exactly as it appears in the
OutputData list:
1
SEROUT 1, N2400, ( "HELLO", CR )
SEROUT 1, N2400, ( "Num = ", #100 )
--or--
2
2
SEROUT 1, 16780, [ "HELLO", CR ]
p
sx
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.
1
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.
2
2
The SEROUT command can also be configured to pause between
p
sx
transmitted bytes. This is the purpose of the optional Pace argument. For
example (9600 baud N8, inverted):
SEROUT 1, 16468, 1000, [ "Slowly" ]
Here, the BASIC Stamp transmits the word "Slowly" with a 1 second delay
between each character. See Table 5.79 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
BASIC Stamp Programming Manual 2.0c • www.parallaxinc.com • Page 299
Need help?
Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?