Serial Interfaces: RS-232 Interface
Serial Interfaces: RS-232 Interface
Serial Interfaces
Serial interfaces are typically used to connect computer systems and low-speed external peripherals such as modems
and printers.
You should be able to describe the operation and format of data and handshaking signals on an RS-232 interface.
RS-232 Interface these, the most useful are called RTS (Request To
Send) and CTS (Clear To Send). The CTS pin is a
The most widely used peripheral interface is the DCE output and is used by the DCE to indicate that
“RS-232” serial interface. This interface is available it can accept data on the TxD line. The RTS line is an
on most general-purpose microcomputers. output on a DTE and is used to indicate that the DTE
wants to send (RTS was originally used to control
half-duplex modems – these are rarely seen today).
DTE and DCE Since these signals are used to control the flow of
data from the DTE (and optionally from the DCE)
The serial interface was originally designed to con-
these pins are called [hardware] “flow control” sig-
nect modems (Data Communications Equipment -
nals.
DCE) to computer terminals (Data Terminal Equip- DTE DCE
ment - DTE). In its simplest form the interface has
RTS RTS
two signal lines, Transmit Data (TxD or TD) and
Receive Data (RxD or RD), and a ground reference. CTS CTS
The TxD signal is an output on a DTE device and an DTR DTR
input on a DCE device. Similarly, RxD is an output DSR DSR
on a DCE device and input on a DTE device.
DTE DCE ("terminal") (modem)
lec8.tex 1
cally smaller and carry a subset of the RS-232 pins. or odd) can be sent, followed by a one “stop” bit.
The most common are the DB-9 connectors popu-
lar on IBM PC-AT clones, the round DIN connectors
(popular on Apple computers), and the inexpensive
telephone-style “RJ-11” (6-pin) and “RJ-45” (8-pin)
connectors (popular on devices with many serial in-
terfaces).
Exercise: Draw the waveform used to send the ASCII char-
Adapters are often used not only to convert be-
acter ’e’ (hex 65) at 9600 bps with no parity.
tween different styles of connectors but also to con-
The start bit allows a receiver to re-synchronize
vert between male and female connectors (a “gender
itself at the start of each character. This allows
adapter” which allows two males or two females to for small variations between transmitter and receiver
be connected together) and to switch between DCE
timing.
and DTE pinouts (a “null modem” which allows two
Exercise: What happens if the receiver’s clock is running
DCEs or two DTEs to be connected together).
faster than the transmitter clock?
The stop bit guarantees that there will be a tran-
sition at the start of each character. It also allows
Interface Voltages a receiver to re-synchronize to a character boundary
in the middle of a continuous data stream. If the re-
The serial interface voltage levels are bipolar with ceiver does not see a ’one’ stop bit (called a “framing
respect to ground. The table below summarizes the error”) it knows it is unsynchronized and treats that
relationship between voltage level, logical meaning bit as a start bit. Eventually the receiver will syn-
on handshaking lines and data bit value (values on chronize to an actual start bit.
TxD and RxD lines). Exercise: What would happen if the receiver was expecting 8-
bit characters and the transmitter was sending 7-bit characters?
Level State Handshaking Data There are a number of standard bit rates, typically
negative mark false 1 powers of two times 1200 bps (1200, 2400, 4800 bps
positive space true 0 etc). The RS-232 standard specifies maximum bit
rates, distances, etc but these are usually ignored in
practical applications. For short distances it’s possi-
The received signal must be greater than +3 volts ble to send in excess of 100 kbps.
to be considered positive and less than -3 volts for
negative. Intermediate values are considered invalid.
This allows disconnected pins to be detected. Other Serial Interfaces
Note: The data lines (TxD and RxD) are asserted
The RS-422 serial interface specification uses a simi-
when negative. The control lines (e.g. CTS) are as-
lar signaling scheme but uses differential signals (op-
serted when positive.
posite voltages on two signal lines) to increase im-
munity to noise and increase maximum transmission
distance. Data rates up to 1 Mbps are common. RS-
Character Format 422 is common in industrial applications because of
its improved noise immunity.
Data is transferred over the serial interface one bit at There are also two relatively new high-speed serial
a time. A positive (zero) bit (the “start bit”) is sent interfaces: USB and IEEE 1394.
to indicate the start of the character being sent. This The Universal Serial Bus (USB) serial interface is
is followed by the bits in the character, from LS to designed to connect desktop PC peripherals such as
MS bit. After sending the 7 (for plain ASCII) or 8 keyboards and printers and runs around 10 Mbps. It
(for arbitrary bytes) bits, an optional parity bit (even supports multiple devices on each bus. Each device
2
has a socket and a plug and the devices are daisy-
chained.
IEEE 1394 (“Firewire”) is a high-speed (100 to
400 Mbps) serial interface designed to connect high-
speed devices such as digital video cameras, digital
video disks and hard disks. The network consists of a
“tree” of short (4.5 m maximum) point-to-point links
between devices.
It remains to be seen whether either of these two
interfaces will become popular enough to displace
the traditional RS-232 and SCSI standards.