Encyclopedia > RS-232

  Article Content

RS-232

RS-232 (also referred to as RS-232C) is a standard for asynchronous serial data communication between a DTE (Data terminal equipment) and a DCE (Data communication equipment), commonly used in personal computer serial ports. This originally meant a dumb terminal (or teletypewriter) and a modem; it was only later that minicomputers, personal computers, printers, and other devices started to make use of the standard. For many years some form of RS-232 port was a standard feature of almost all computers (other than IBM mainframes) and remained in widespread use into the late 1990s. For much of this time it was the standard way to connect modems. Today RS-232 is gradually being superseded by USB, which is faster and has connectors that are simpler to connect and use.

In RS-232 characters are send one by one as a pattern of bits. The most common encoding format is the asynchronous start-stop format which uses a "start bit" followed by seven or eight data bits, possibly a "parity" bit, and one or two "stop bits". Thus 10 bits are used to send a single character, which has the nice side effect that dividing the signalling rate by ten results in the overall transmission speed. The most common alternative to asynchronous start-stop is HDLC.

The RS-232 standard defines the voltage levels that correspond to logical one and logical zero levels, the standard transmission speeds and connector types.

The standard specifies 25 different signal connections, and a 25-pin "D-sub" (D-shaped subminiature) connector was commonly used. Male and female connectors are used – often cable ends are male and device connectors are female; but not always; m-m and f-f "gender changers" are available. For configuring and diagnosing problems with RS-232 cables, a "breakout box" may be used. This device normally has a female and male RS-232 connector and is meant to attach in-line; it then has lights for each pin.

Most of these pins were unused by many devices, however, so it was common for machines to save money by using smaller connectors. The IBM PC was released with 9-pin D-sub connectors, and that became the de facto standard; most external devices still use 25-pin connectors, so cables with 9 pins on one end and 25 on the other were common. The Apple Macintosh used a similar system, but later changed to a new connector with only 8 pins, less than what is needed for a modem.

RS-232 cables may be built with connectors commonly available at electronics stores. The cables may be between 3 and 25 pins; typically 4- or 6-pin wires are used. Flat RJ (phone-style) cables may be used with special RJ-RS232 connectors, which are the easiest to configure (since the wires are parallel and not twisted, the cables may not be able to support a signal over longer distances).

Signals are plus or minus 3 to 15 volts. Zero volts is not a valid RS-232 level; logic zero is defined as a negative voltage equal to logic one. Signal levels of +-5, +-10, +-12, and +-15 are all commonly seen depending on the power supplies available within a device.

There are three types of signals carried by these wires: ground, transmit/receive, and handshake. There are standard codes for these signals, for example:

SG or GND - Ground
TD or TX - Transmit Data
RD or RX - Receive Data
DTR - Data Terminal Ready
DSR - Data Set Ready
RTS - Ready to Send
CTS - Clear to send
DCD - Data Carrier Detect
RI - Ring Indicator
FG - Frame Ground

RS-232 devices may be classified as DTE (Data Terminal Equipment) or DCE (Data Communications Equipment) – this defines which wires will be sending and receiving each signal. However, these definitions are not always adhered to strictly; normally it's necessary to consult documentation or test connections with a breakout box to determine signals required.

The ground signal is meant to ground the other connections. It is reqired. However, if the equipment is far enough apart or on separate power systems, the ground will degrade between the two devices and communications will fail; this is a difficult condition to trace. For 25-pin connectors, pin 7 is normally ground (pin 1, chassis ground, is rarely used).

For 25-pin connectors, pin 2 and 3 are the normal transmit/receive pins. One device will be sending on 2 and receiving on 3; the other should be the reverse (if not, the reverse is done in the cable end as with a null modem[?] adapter). If you're wiring a connection, check with the breakout box on each device to see which pin it's transmitting on. Strictly speaking, only one device need be transmitting (if no handshakes or duplex communication is required)--for example a simple printer that does not report status back to the computer. But normally both TX and RX are required.

Other "handshakes" may be required by one or the other device. For example, pin 20 is commonly used to indicate "device ready". Pins may also be "jumpered" or routed back within the connector. For example a pin saying "are you ready?" from device A might be wired to the pin saying "I'm ready" on device A if device B did not transmit such a signal. Common handshake pins are 20, 8, 4, and 6.

Software-wise there are a multitude of settings for serial connections. Most common settings are speed, parity, and stop bits.

Speed is bit speed from one device to another in bits per second (bps). (Note that bits-per-second is not generally the same as baud; when techniques like Quadrature Amplitude Modulation[?] are employed, more than one bit can be transmitted per baud. In most RS-232 applications, only very low bitrates have one bit per baud.) Common bit rates per second are 300, 1200, 2400, 9600, 19200, etc. Typically both devices must be set to the same speed but some devices (such as modems) may be set to autodetect speed.

Parity is a method of verifying accuracy of data. Parity is usually either none (not used), odd, or even (other parity systems such as "mark" or "space" are much less common). Parity works by modifying the data in each byte sent (or restricting the bytes sent if you like). Parity none is simple, the data is not changed. In even parity the data is arranged so that the number of 1 bits (that is, the total count of them in a binary byte) is an even number; this is arranged by setting the parity bit (usually the most significant bit) to be a 0 or 1 accordingly. In odd parity the number of 1 bits is an odd number. Parity can be used by the receiver to detect transmission errors - if a byte is received with the wrong number of 1 bits, then it must have been corrupted.

Stop bits are sent at the end of every byte transmitted in order to help the signal hardware at either end of the link resynchronise.

There is a D/P/S conventional notation for specifying the software setup of a serial connection. 8/N/1 (very common) specifies 8 data bits, no parity, 1 stop bit. The number of data bits can be 7, 8, or (sometimes) 9. Parity can be none (N), odd (O), or even (E); the parity bit is borrowed from the data bits, so 8/E/1 means that one of the 8 data bits is used as the parity bit. There can be 1, 1.5, or 2 stop bits.

Other settings define when pins will send handshake signals, or other data integrity checks. The most common of these is XON/XOFF. The XON character tells the receiver that the sender is ready to receive more data. The XOFF character tells the receiver to stop sending characters. The use of XON/XOFF is deprecated, it is preferable to use RTS/CTS flow control instead.


There are a couple signaling "standards" often called RS-232, but really aren't. TTL-level RS-232 uses +5V for high, and 0V for low. CMOS-level RS-232 uses +3.3V for high, and 0V for low. Typically, these signal levels are used between two devices on the same circuit board. 20mA current loop uses the absence of 20mA current for high, and the presence of current in the loop for low; this signal level is often used for long-distance and optically isolated links.

See also:

RS-422[?] (a high-speed system similar to RS-232 but with differential signalling)
RS-485[?] (a descendant of RS-422 that can be used as a bus in multidrop configurations)



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
List of biological topics

... 1 A 2 B 3 C 4 D 5 E 6 F 7 G 8 H 9 I 10 J 11 K 12 L 13 M 14 N 15 O 16 P 17 Q 18 R 19 S 20 T 21 U 22 V 23 W 24 X 25 ...