| |
| RS-232 is a straightforward,
universal, and commonly implemented serial interface. Despite
RS-232's limited
15 m transmission distance, its
low cost and easy wiring features make RS-232 the first choice
for many applications. RS-232 establishes two-way (full-duplex)
communications, with signals represented by voltage levels
measured with respect to a system common ground (power/logic
ground). The "idle" state (MARK, or bit value of
1) is negative with respect to the common ground, and the "active" state
(SPACE, or bit value of 0) is positive with respect to common
ground. Note that RS-232 is limited to point-to-point communication. |
| |
| RS-232 Data Format |
RS-232 data is
transmitted in short data frames. Serial device hardware
can be configured
to use frames of different lengths and characteristics,
but for a given configuration, each data frame has the
same length.
By common agreement, the communication line uses MARK to
indicate an idle state. When one of the devices starts
transmitting, it switches to the SPACE state so that
the opposing device knows that it should start reading
the incoming data.
Each RS-232 frame is divided into 4 sections: Start, Data,
Parity, and Stop, with each section using a certain number
of bits. For example, the Start section always has length
of 1 bit and value of 0. The Data section can have 5, 6,
7, or 8 bits, with the values of the data bits changing
as the data changes. The common Parity settings are None
(bit
value = 0), Even, or Odd. When Parity is set to Even, the
Parity bit value is 1 if the number of data bits is odd,
and the Parity bit value is 0 if the number of data bits
is even. When Parity is set to Odd, the Parity bit value
is
0 if the number of data bits is odd, and the Parity bit
value is 1 if the number of bits is even. Some devices
also support Parity of Space and Mark.
|
| Frame Section |
Number of bits used |
Bit values |
| 1 |
0 (Space) |
| 5, 6, 7, 8 |
depends on the data |
| 1 |
0
0 or 1 |
(for
Parity = None)
(for Parity = Even or Odd)
(for Parity = Space)
(for Parity = Mark) |
1
1.5 (for data bits = 5 )
2 (for data bits > 5 ) |
1 (Mark) |
|
|
RS-232 Specs
|
|
RS-232 has the following basic
specifications: |
EIA-232 |
RS-232 |
Point to point |
Single Ended |
1 |
1 |
20 Kbps |
|
| |
| RS-232
Signal Definition |
The
standard output signal level of RS-232 usually varies
between +12V and -12V,
with a "dead area" between +3V and -3V designed
to absorb line noise. The most general form of RS-232
uses 8 signal lines, listed in the table at the right.
The TxD and RxD signals are used to transmit the data
frame, with the rest of the signals available for other
purposes, as explained below in the "Flow Control"
section below.
|
|
|
The following figure illustrates the generation and transmission
of an RS-232 data frame. The signal starts in the UART
as a TTL signal between 0 and 5 volts,
and then is
transformed
by
the RS-232 transceiver to the +12V to -12V range.
|
|
 |
| |
| Flow Control |
| Serial communication
often involves using data buffers to store data temporarily.
However, if a device is receiving data, and the device's
buffer is almost full, the device needs a way to alert the
opposing device to suspend transmission until the buffer
has more storage room. Flow control is the term that refers
to controlling the flow of data between the two devices.
Two types of flow control can be used: Hardware Flow Control
and Software Flow Control. |
| |
| H/W Flow Control |
| The RTS and CTS signals can
be used for H/W flow control. When PC1 is ready to receive
data, it raises the RTS (Request To Send) signal to request
data from PC2. PC2 will then send the data on the Tx to Rx
line. Note that since the transmission is full duplex, PC1
could be transmitting to PC2 simultaneously. |
 |
| |
| S/W Flow Control |
| The Tx / Rx lines can
also be used for flow control, although the reaction time
will be longer. The system works by sending an XON/XOFF
to control data flow.
For example, when PC2 is ready to receive, it will send an
XON pattern to to PC1. If PC2's
Rx buffer is almost
full, PC2 will send an XOFF pattern to request that PC1 cease transmitting. |
 |
| |