BASIC stamp manual v2.2
SEROUT – BASIC Stamp Command Reference
Page 428 • BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com
a. Unmatched settings on the sender and receiver side will cause
garbled data transfers or no data transfers. If the data you
receive is unreadable, it is most likely a baud rate setting
error.
5. If data transmitted to the Stamp Editor's Debug Terminal is
garbled, verify the output format.
a. A common mistake is to send data with SEROUT in ASCII
format. For example, SEROUT 16, 84, [ 0 ] instead of
SEROUT 16, 84, [ DEC 0 ]. The first example will send a byte
equal to 0 to the PC, resulting in the Debug Terminal clearing
the screen (since 0 is the control character for a clear-screen
action).
Demo Program (SEROUT.bs1)
' SEROUT.bs1
' This program transmits the string "ABCD" followed by a number and a
' carriage-return at 2400 baud, inverted, N81 format.
' {$STAMP BS1}
' {$PBASIC 1.0}
SYMBOL SOut = 1
SYMBOL Baud = N2400
SYMBOL value = W1
Setup:
value = 1
Main:
SEROUT SOut, Baud, ("ABCD", #value)
value = value + 1
PAUSE 250
GOTO Main
END
Demo Program (SERIN_SEROUT1.bs2)
' SERIN_SEROUT1.bs2
' Using two BS2-IC's, connect the circuit shown in the SERIN command
' description and run this program on the BASIC Stamp designated as the
' Sender. This program demonstrates the use of Flow Control (FPin).
' Without flow control, the sender would transmit the whole word "Hello!"
' in about 1.5 ms. The receiver would catch the first byte at most; by the
' time it got back from the first 1-second PAUSE, the rest of the data
NOTE: This example program was
written for BS2’s but it can be used with
the BS2e, BS2sx, BS2p, BS2pe, and
BS2px. This program uses conditional
compilation techniques; see Chapter 3
for more information.
All
2
1