BASIC stamp manual v2.2
5: BASIC Stamp Command Reference – SEROUT
BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com • Page 417
All BASIC Stamp models (including the BS1) can also transmit RS-232 data
through any of their I/O pins (Tpin = 0 – 7 for BS1, Tpin = 0 – 15 on all
other BASIC Stamp models). The I/O pins only provide a 0 to +5 volt
swing (outside of RS-232 specs) and may need to be connected through a
line driver for proper operation with all serial ports. Most serial ports are
able to recognize a 0 to +5 volt swing, however. See Figure 5.38 for sample
wiring.
Figure 5.38: Serial port diagram
showing correct connections to a
BASIC Stamp's I/O pin.
NOTE: A line driver may have to be
used between the I/O pin and the
receiving serial port to ensure
proper communication.
DB-9 Male
(Connector Side)
from I/O pin
2
3
4
Transmit Data (TD)
Receive Data (RD)
Request to Send (RTS)
6
7
20
Data Set Ready (DSR)
Signal Ground (SG)
Data Terminal Ready (DTR)
3
2
7
6
5
4
DB25Function DB9
NOTE: The connections shown with double-lines are
normally not necessary. They indicate optional connection
s
to disable hardware handshaking (DTR-DSR-DCD and
RTS-CTS). This is only necessary if you are using softwar
e
or hardware that expects hardware handshaking.
DB-25 Male
(Connector Side)
252423222120191817161514
13121110987654321
9876
54321
Vss
from I/O pin
Vss
8Data Carrier Detect (DCD) 1
5Clear to Send (CTS) 8
Figure 5.38 shows the pinouts of the two styles of PC serial ports and how
to connect them to the BASIC Stamp's I/O 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.
SEROUT requires a value called Baudmode that tells it the important
characteristics of the outgoing serial data; the bit period, number of data
and parity bits, and polarity.
SERIAL TIMING AND MODE (BAUDMODE).
1
A
ll
2