Parallax BASIC Stamp 2e Programming Manual page 277

Table of Contents

Advertisement

2
2
e
U
-
SING THE BUILT
IN SERIAL PORT ON
BS2, BS2
, BS2
THE
E
SX AND
Figure 5.32: Serial Port Diagram
Showing Correct Connections to a
BASIC Stamp's I/O pin. NOTE:
The 22 kΩ resister is not required if
connecting to the SIN pin.
5: BASIC Stamp Command Reference – SERIN
RS-232 is the electrical specification for the signals that PC serial ports use.
Unlike normal logic, where a 5 volts is a logic 1 and 0 volts is logic 0, RS-
232 uses -12 volts for logic 1 and +12 volts for logic 0. This specification
allows communication over longer wire lengths without amplification.
Most circuits that work with RS-232 use a line driver/receiver. This
component does two things: (1) it converts the ±12 volts of RS-232 to
TTL-compatible 0 to 5-volt levels and (2) it inverts the relationship of the
voltage levels, so that 5 volts = logic 1 and 0 volts = logic 0.
2
2
All BASIC Stamps (except the BS1) have a line receiver on its SIN pin (Rpin
sx
p
= 16). See the "Hardware" section of the "Introduction to the BASIC
Stamps" chapter. The SIN pin goes to a PC's serial data-out pin on the DB9
BS2
.
P
connector built into BASIC Stamp development boards. The connector is
wired to allow both programming and run-time serial communication
(unless you are using the Stamp 2 Carrier Board which is only designed
for programming). For the built-in serial port set the Rpin argument to 16
in the SERIN command.
All BASIC Stamps (including the BS1) can also receive RS-232 data
through any of their I/O pins (Rpin = 0 – 7 for BS1, Rpin = 0 – 15 on all
other BASIC Stamps). The I/O pins don't need a line receiver, just a 22 k Ω
resistor. The resistor limits current into the I/O pins' built-in clamping
diodes, which keep input voltages within a safe range. See Figure 5.32
22 kΩ
to I/O pin
1
6
(Connector Side)
Function
Data Carrier Detect (DCD)
Receive Data (RD)
Transmit Data (TD)
Data T erminal Ready (DTR)
Signal Ground (SG)
Data Set Ready (DSR)
Request to Send (RTS)
Clear to Send (CTS)
2
3
4
5
7
8
9
Vss
DB-9 Male
DB9
DB25
1
8
NOTE: The connections shown with double-lines are
2
3
normally not necessary. They indicate optional connections
3
2
to disable hardware handshaking (DTR-DSR-DCD and
4
20
RTS-CTS). This is only necessary if you are using software
5
7
or hardware that expects hardware handshaking.
6
6
7
4
8
5
BASIC Stamp Programming Manual 2.0c • www.parallaxinc.com • Page 275
22 kΩ
to I/O pin
1
2
3
4
5
6
14
15
16
17
18
DB-25 Male
(Connector Side)
Vss
7
8
9
10
11
12
13
19
20
21
22
23
24
25

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?

Table of Contents