Online Encyclopedia Search Tool

Your Online Encyclopedia

 

Online Encylopedia and Dictionary Research Site

Online Encyclopedia Free Search Online Encyclopedia Search    Online Encyclopedia Browse    welcome to our free dictionary for your research of every kind

Online Encyclopedia



RS-232

RS-232 (also referred to as EIA RS-232C or V.24) is a standard for serial binary data interchange between a DTE (Data terminal equipment) and a DCE (Data communication equipment). It is commonly used in personal computer serial ports.

Contents

History

This standard was originally used for connecting a teletypewriter, which used ASCII code, asynchronous communication and electromechanical components, with a modem. Many early minicomputers from companies such as DEC used 33-ASR (Automatic Send Receive) teletypes as cheap system consoles (for a fancier machine one got a 35-ASR). When electronic terminals (smart and dumb) began to be used, they were often designed to be interchangeable with teletypes, and so supported RS-232. The C revision of the standard was issued in 1969 in part to accommodate the electrical characteristics of these devices. Then, because it was there, it was used for all sorts of remote communications, especially through modems, including computer to computer. Later personal computers (and other devices) started to make use of the standard so that they could connect to existing equipment. When IBM introduced the PC with an RS-232 port, this interface became truly ubiquitous. The IBM Selectric typewriter with RS-232 supplanted teletypes in many applications. For many years some form of RS-232 port was a standard feature for serial communications on almost all computers. It remained in widespread use into the late 1990s. For much of this time it was the standard way to connect modems.

One exception is mainframe computers, which generally do not communicate directly with terminal devices. These large systems generally have specialized I/O processors attached to them for this purpose. For instance, some IBM mainframes had a telecommunication control unit (TCU) attached to their multiplexer channel. The TCU would support multiple terminals, sometimes hundreds. Many of these TCUs could support RS-232 when it was required, although there were other serial interfaces as well.

There is some confusion about what the EIA actually standardized in RS-232. This standard only specifies electrical characteristics and circuits and pin numbers. The other characteristics of the teletype interface such as the D connector, use of the ASCII code and data format and asynchronous (or start-stop) communications are not part of RS-232, but were lumped into the name because these features usually all came together, so that in the end they became, effectively, mandatory, and the original meaning of the standard name was lost. There were about 100,000 33-ASR teletypes made in total, there are now almost that many PCs made every week, but they can all act as virtual teletypes. About the only feature that was required by teletypes that has been generally abandoned is that a real teletype required two stop bits to work reliably, so that a character took 11 bit times. This is why 100 word per minute teletypes transmitted at 110 baud. Today everyone uses one stop bit. In the rest of this article RS-232 means the 33-ASR teletype simulation, not the document.

IBM favored the use of the eight-bit EBCDIC code instead of the seven-bit ASCII code. IBM also favored a big endian transmission format instead of the little endian ASCII format. IBM did support all of these however. In order to send little endian characters, for instance, the mainframe would simply bit reverse each character in a string using a block translate instruction.

Earlier teletype machines had 3 rows of keys and only supported upper case letters. They used the 5 bit baudot code and generally worked at 60 words per minute. Teletypes with 4 row keyboards and ASCII code with upper and lower case letters were an innovation that came into use in the same period as computers began to become widely available. The UART serial communications integrated circuits, introduced in the early 1970s, and still emulated by most chipsets, still support the earlier teletype formats, including 1.5 stop bits, but these features are rarely used.

The importance of serial ports began to wane when high speed networking became available for computer to computer communications. Although there were many competing standards originally, today this usually means 10 or 100 Base T Ethernet type connections. In the near future (post 2004) even higher speeds will be common.

Role in modern computing

Today, RS-232 is gradually being superseded by USB for local communications. USB is faster, has connectors that are simpler to connect and use, and has better software support. This is why many PCs intended for office use often ship with 'legacy-free' motherboards without any RS-232 circuitry. However, RS-232 is still quite common in point-of-sale (cash drawers, barcode and magnetic stripe readers) and industrial (measurement and remote-control devices) peripherals, so computers made for such applications are still equipped with RS-232 ports either 'on-board', or on a separate PCI or ISA card. As an alternative, USB docking ports are available which can provide connectors for PS/2 keyboard, PS/2 mouse, one or more serial ports, and one or more parallel ports.

Standard details

In RS-232, characters are sent 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 signaling 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. Signals are plus or minus 3 to 15 volts. The range near zero volts is not a valid RS-232 level; logic one is defined as a negative voltage, the signal condition is called marking, and has the functional significance of OFF. Logic zero is positive, the signal condition is spacing, and has the function ON. Signal levels of +-5, +-10, +-12, and +-15 are all commonly seen depending on the power supplies available within a device.

Mark and space are terms carried over from teletypes. The native mode of communication for a teletype is a simple series DC circuit that is interrupted, much like a rotary dial interrupts a telephone signal. The marking condition is when the circuit is closed, the spacing condition is when the circuit is open. The start of a character is signalled by a space. The stop bits are marking. When the line is broken, a teletype cycles continuously but prints nothing because it is receiving all zeros, the ASCII NUL character.

Connectors

RS-232 devices may be classified as Data Terminal Equipment (DTE) or Data Communications Equipment (DCE); this defines which wires will be sending and receiving each signal. In general, computers and terminals have DTE connectors and modems and printers have DCE connectors. However, these definitions are not always adhered to strictly; it is often necessary to consult documentation, test connections with a breakout box, or use trial and error to find a cable that works.

The standard specifies 20 different signal connections, and a 25-pin "D-sub" (D-shaped subminiature) connector known as DB-25 was commonly used. Most of these pins were unused by many devices, however, so it was common for machines to save money and space by using smaller connectors, notably the 9-pin D-sub or DB-9 connector used by most PC's since the IBM PC AT as well as many other devices. DB-25 and DB-9 connectors on most devices are female, but this is not universal. More recently, 8 pin RJ-45 connectors have become common, although pin assignments vary widely. Standard EIA/TIA 561 specifies a pin assignment, but the "Yost Serial Device Wiring Standard" invented by Dave Yost is common on Unix computers, and many devices don't follow either of these.

The following table lists the commonly used RS-232 signals and common pin assignments:


Signal DB-25 DB-9 EIA/TIA 561 Yost
Common Ground 7 5 4 4,5
Transmitted Data (TD) 2 3 6 3
Received Data (RD) 3 2 5 6
Data Terminal Ready (DTR) 20 4 3 2
Data Set Ready (DSR) 6 6 1 7
Request To Send (RTS) 4 7 8 1
Clear To Send (CTS) 5 8 7 8
Carrier Detect (DCD) 8 1 2 7
Ring Indicator (RI) 22 9 1 -


The signals are labeled from the standpoint of the DTE device; TD, DTR, and RTS are generated by the DTE and RD, DSR, CTS, DCD, and RI are generated by the DCE. The ground signal is a common return for the other connections; it appears on two pins in the Yost standard but is the same signal. Use of a common ground is one weakness of RS-232. If the two pieces of equipment are far enough apart or on separate power systems, the ground will degrade between them and communications will fail; this is a difficult condition to trace.

Note that EIA/TIA 561 combines DSR and RI, and the Yost standard combines DSR and DCD.

Cables

Because of the variation and inconsistencies of RS-232 implementations, it is not always easy to determine the proper cable for connecting two devices. Connecting a DCE device and a DTE device with the same types of connectors requires a straight cable with appropriate ends. "Gender changers" are available to solve gender mismatches between cables and connectors. Connecting devices with different types of connectors requires a cable that connects the corresponding pins according to the table above. Cables with 9 pins on one end and 25 on the other are common, and manufacturers of equipment with RJ-45 connectors usually provide and appropriate cable with either a DB-25 or DB-9 head (or sometimes interchangable heads so they can work with multiple devices).

Connecting two DTE devices together requires a null modem that acts as a DCE between the devices by swapping the corresponding signals (TD-RD, DTR-DSR, and RTS-CTS). This can be done with a separate device and two cables, or using a cable wired to do this. One feature of the Yost standard is that a null modem cable is a "rollover" cable that just reverses pins 1 through 8 on one end to 8 through 1 on the other end (not to be confused with an Ethernet crossover cable, which is wired very differently).

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 and provisions for interconnecting pins in different configurations.

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.

The reason that a minimal two-way interface can be created with only 3 wires is that all the RS-232 signals share a common ground return. The use of unbalanced circuits makes RS-232 highly susceptible to problems due to ground potential shifts between the two devices. RS-232 also has relatively poor control of signal rise and fall times, leading to potential crosstalk problems. RS-232 was recommended for short connections (15 meters or less). RS-232 interface cables are not usually constructed with twisted pair because of the unbalanced circuits.

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.

Settings

There is a multitude of software 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 (bit/s). 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 none (not used), but can be odd or even. 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 last or 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. If parity is correct there may have been no errors or an even number of errors.

Stop bits are sent at the end of every byte transmitted in order to allow the receiving signal hardware to 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 (1.5 was used by the 60 wpm baudot teletypes).

Other settings define when pins will send handshake signals, or other data integrity checks. Common combinations are RTS/CTS, DTR/DSR, or XON/XOFF (which actually does not use connector pins but rather special characters inserted into the data streams).

The XON/XOFF characters are sent by the receiver to the sender to control when the sender will send data, that is, these characters go in the opposite direction to the data being sent. The XON character tells the sender that the receiver is ready for more data. The XOFF character tells the sender to stop sending characters until the receiver is ready again. The use of XON/XOFF is deprecated, and it is preferable to use RTS/CTS flow control instead.

XON/XOFF is an in-band method that works between the endpoints, but both ends must support the protocol, and there is the potential for confusion in starting up. It can be done on a 3 wire interface. RTS/CTS was originally intended to allow the teletype and the modem to coordinate half-duplex links where only one modem could transmit at a time. The terminal would raise Request To Send and wait for the modem to respond with Clear To Send. RTS/CTS is a hardware handshake, but it does have advantages.

An ASR teletype had a paper tape reader. Characters were sent when the tape was read (ASR stands for Automatic Send Receive). In an ASR teletype machine receipt of the XOFF character turned off the paper tape reader and receipt of an XON character turned it back on. The distant system would send XOFF when it was necessary to slow down the sender. In the original systems messages were prepared ahead on paper tape so that transmission time could be minimized. Bandwidth was very scarce and expensive. Sometimes the transmission was put off until late at night. This also motivated the development of the terse "telegraphic" style of expression. In some early minicomputers the ASR paper tape reader and punch were the only way to back up and restore software.

Related standards

There are a couple of signaling "standards" often called RS-232, but really not. 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.

Other interfaces similar to RS-232:

  • RS-422 (a high-speed system similar to RS-232 but with differential signalling)
  • RS-423 (a high-speed system similar to RS-422 but with unbalanced signalling)
  • RS-449 (a proposed successor of RS-232 that used RS-422 and RS423 signals - it never caught on like RS-232)
  • RS-485 (a descendant of RS-422 that can be used as a bus in multidrop configurations)
  • MIL STD 188 (a system like RS-232 but with better impedance and rise time control)

Related Wikibooks

Please see the serial communications bookshelf for a number of helpful titles, including the RS-232 Technical Manual.

External links

  • RS-232 tutorial http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html
  • Yost Serial Device Wiring Standard http://www.yost.com/Computers/RJ45-serial/
  • D-Subminiature Nomenclature http://epl.meei.harvard.edu/Engineering/d-subminiature.html


Last updated: 02-20-2005 19:44:51