SERIN - BASIC Stamp Command Reference
Figure 5.32 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 22K resister 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.
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 Stamps, 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.71 indicates the Baudmode value or symbols to use when selecting
the desired mode.
Baudmode
Value
0
1
2
3
4
5
6
7
On the BS2, BS2e, BS2sx and BS2p, serial communication is very flexible.
The Baudmode argument for SERIN accepts a 16-bit value that determines
its
characteristics:
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.72
Page 276 • BASIC Stamp Programming Manual 2.0b • www.parallaxinc.com
Symbol
Baud Rate
T2400
2400
T1200
1200
T600
600
T300
300
N2400
2400
N1200
1200
N600
600
N300
300
1-stop
bit,
8-data
Note that PC serial ports are
Polarity
TRUE
TRUE
TRUE
TRUE
INVERTED
INVERTED
INVERTED
INVERTED
bits/no-parity
or
S
ERIAL TIMING AND MODE
(
).
BAUDMODE
1
Table 5.71: BS1 Baudmode values.
2
2
2
2
e
sx
p
7-data
Need help?
Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?