What is RS-232?

Posted by Kari Grosser on May 18, 2017 10:20:00 AM

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 push data about 50 ft. The absolute maximum data rate is difficult to nail down due to the differences in the transmission line and cable length. It is possible to operate at some pretty high data rates if the distance is short. The 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 stats. A voltage of +12 volts (usually +3 to +10 volts) represents a binary 0 and -12 volts (-3 to -1o 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 & 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 cheap and easy. However, it is also susceptible to noise and almost always requires a lower data rate then balanced protocols such as RS-422 or RS-485. The effective distance is roughly 50 feet or about 15 meters.

Connections

One of the confusing things about 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 that have been around awhile. it is second nature. However, it can create problems to those that are unaware. RS-232 defines two types of equipment. The first one is the Date Terminal Equipment or DTE. The other is the Data Communication Equipment. These terms were introduced by IBM and are used to differentiate the different device types at each end of the cable. The 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 DB male connector. The DCE is the MODEM or peripheral device. It typically has a female DB connector. Hooking up 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 hook up two DTE's or DCE's to each other. In this case you need to use a "Null-Modem" cable which cross transmits and receives lines. This makes more sense if you review the following chart and connector diagram.

rs-232 chart.jpg

Control Signals

The hardware control signals are also confusing to some. 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.

RS-232 List.jpg

In some applications RS-232's use of the RTS and CTS lines is asymmetric: The DTE asserts RTS to indicate a desire to transmit to the DCE, and the DCE asserts CTS in response 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, the 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 other device. This is often called "port powering". Be careful though, some manufacturers provide an externally sourced regulated 5 VDC power on Pin 1. This is used to power devices that have a higher current draw than can be supplied by the RS-232 port.

Protocol

The communication speed is measure in baud. Simply put, this is a measure of bits transferred per second. For example, 19200 baud is 19200 bits per second.

rs-232 protocol-1.jpg

Data bits are a measurement of the actual data bits in the word. For example, this diagram shows an 8 bit word. The word is a singles byte transfer, including Start/Stop bits, Data bits and Parity. If you are transferring standard ASCII (0 to 127) seven data bits are enough, If it is an extended ASCII code (128 to 255), then 8 data bits are needed.

Parity is a simple way to error-check. Parity is either Even, Odd, Mark or Space. You can also use no parity. For Even and Odd parity, the serial port sets the parity bit (the last bit after the data bit) to a value to ensure that the data packet has an Even or Odd number of logic-high bits. For example, if the data is 10010010, for Even parity, the serial port sets the parity bit as 1 to keep the number of logic-high bits Even. 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 logic-low, so that the receiving party can determine if the data is corrupted.

Stop bits are used to signal the end of a communication packet. This also helps to synchronize different clocks on the serial devices.

Summary

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 communication port now and in the future.

Information provided by Advantech B+B SmartWorx.

 

Subscribe to Email Updates

Recent Posts