What is RS-232? Fundamentals of the Protocol
There is an entire generation of technicians in the
What Is It?
At one time, RS-232 / EIA-232 was the most widely used communication standard on the planet. It was defined and redefined many times. The “EIA” stands for “Electronic Industries Association” and the “RS” stands for “Recommended Standard.” That being the case, it was always rather loose.
The physical characteristics of the hardware include both a 25-pin and 9-pin D sub connector. RS-232 is capable of operating at data rates up to 20 Kbps and can transmit data about 15 meters (50 ft). The absolute maximum data rate is difficult to determine due the differences in the transmission line and cable length. It is possible to operate at rather high data rates if the distance is short.
Voltage levels are defined as a range from -12 to +12 Volts. RS-232 is also single-ended. This means that a single electrical signal is compared to a common signal (Ground) to determine binary logic states. A voltage of +12 Volts (usually +3 to +10 Volts) represents a binary 0 and -12 Volts (-3 to -10 Volts) is a binary 1.
Also, RS-232 is an “asynchronous serial protocol”. This implies that the data word is transmitted as single bits to the receiver, which puts the word back together. To make this happen correctly, the data rate, hand-shaking, start and stop bits, and error checking must all be pre-defined.
RS-232 is also an “unbalanced protocol.” It uses a single conductor for each signal and a common ground. The signal level is relative to the common ground. This method is cost effective and easy. However, it is also susceptible to noise and almost always requires a lower data rate than balanced protocols such as RS-422 or RS-485. The effective distance is roughly 15 meters (50 ft).
One of the confusing aspects of RS-232 is the cable pin-out and the dual nature of the signals. In some cases Transmit Data may be an input and in others it is an output. To those of us who have been around awhile, it is second nature.
However, it can create problems to those who are unaware. RS-232 defines two types of equipment: the first is Date Terminal Equipment or DTE; the second is Data Communication Equipment or DCE. These terms were introduced by IBM and are used to differentiate the different device types at each end of the cable.
DTE is the computer or terminal that serves as the data source or the data sink. It also provides the control functions. The DTE usually has a male DB connector.
The DCE is the MODEM or peripheral device. It typically has a female DB connector. Connecting a DTE to a DCE is easy. The cabling is straight through. Pin x goes to Pin x on the other side.
You run into problems when you try to connect two
The hardware control signals can also be confusing. For the most part, we only use the actual data (TD and RD). In some cases, the hardware may be required to act as a “traffic cop” by asserting or RTS and CTS. Here is a list of the available control signals and what they do:
In some applications, RS-232’s use of the RTS and CTS lines is asymmetric: DTE asserts RTS to indicate a desire to transmit to the DCE, and in response, DCE asserts CTS to grant permission. This allows for half-duplex modems that disable their transmitters when not required and must transmit a synchronization preamble to the receiver when they are re-enabled. Most of the time though, flow control is handled by the software and the RTS and CTS lines do not play a significant role in communications.
However, these lines do present a handy but unplanned feature. Instead of letting the power available on these lines go to waste, they can be used to power a serial converter or
The communications speed is measured in “baud.” Simply put this is a measure of “bits transferred per second.” For example, 19200 baud is 19200 bits per second.
Data bits are a measurement of the actual data bits in the word. For example, the below diagram shows an
Typical RS-232 Waveform
1 Start Bit, 8 Data Bits, No Parity, 1 Stop Bit
For Odd parity, the parity bit is 0 so that the number of logic-high bits is Odd. Mark parity simply sets the parity bit to logic-high and Space sets the parity bit to
Stop bits are used to signal the end of a communication packet. This also helps to synchronize different clocks on the serial devices.
In summary, RS-232 is not nearly as mysterious as it seems. If you have this basic knowledge, you should be able to utilize this valuable communications port both now and in the future. As far as the demise of the RS-232 port goes, who knows? Prognosticators have been threatening its demise for years. But billions of ports still remain active in the industrial world. The RS-232