BASIC stamp manual v2.2

SERIN - BASIC Stamp Command Reference
Page 396 BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com
Figure 5.36 shows the pinouts of the two styles of PC serial ports and how
to connect them to the BASIC Stamp's I/O pin (the 22 k resistor is not
needed if connecting to the SIN pin). Though not normally needed, the
figure also shows loop back connections that defeat hardware
handshaking used by some PC software. Note that PC serial ports are
always male connectors. The 25-pin style of serial port (called a DB25)
looks similar to a printer (parallel) port except that it is male, whereas a
parallel port is female.
Asynchronous serial communication relies on precise timing. Both the
sender and receiver must be set for identical timing, usually expressed in
bits per second (bps) called baud.
On all BASIC Stamp models, SERIN requires a value called Baudmode that
tells it the important characteristics of the incoming serial data; the bit
period, number of data and parity bits, and polarity.
On the BS1, serial communication is limited to: no-parity, 8-data bits and
1-stop bit at one of four different speeds: 300, 600, 1200 or 2400 baud.
Table 5.95 indicates the Baudmode value or symbols to use when selecting
the desired mode.
Baudmode
Value
Symbol Baud Rate Polarity
0 T2400 2400 TRUE
1 T1200 1200 TRUE
2 T600 600 TRUE
3 T300 300 TRUE
4 N2400 2400 INVERTED
5 N1200 1200 INVERTED
6 N600 600 INVERTED
7 N300 300 INVERTED
Table 5.95: BS1 Baudmode Values.
On all BS2 models, serial communication is very flexible. The Baudmode
argument for SERIN accepts a 16-bit value that determines its
characteristics: 1-stop bit, 8-data bits/no-parity or 7-data bits/even-parity
and virtually any speed from as low as 300 baud to greater than 100K
baud (depending on the BASIC Stamp). Table 5.96 shows how Baudmode is
calculated, while Table 5.97, Table 5.98, and Table 5.99 show common
baud modes for standard serial baud rates.
SERIAL TIMING AND MODE (BAUDMODE).
1
A
ll
2
1
All
2