RS-232C - What It Is (And How To Use It) by Jim Seymour WD8ABM The Electronics Industry Association (EIA) and the Comite Consultatif Internationale de Telegraphie et Telephonie (CCITT) define national and international standards for quite a number of things. One of these is a standard that defines connector type, specific pin numbers, and signal levels known in the U.S. as the RS-232C standard. There is a great deal of confusion regarding the exact meaning of 'RS-232C'. In this document I will try to clear up some of the confusion while offering some useful wiring examples and warnings. The RS-232C standard defines a set of rules to provide for the orderly exchange of data in a serial bit-stream. It also defines signals to allow the connected devices to tell each other when they are ready to send or receive data. These signals are called flow-control or 'handshake' signals. A full and precise description of the RS-232C standard is beyond the scope of this discussion. What I will present, in practical terms, is a description of the most commonly used signals (along some with common variances I have encountered). I would first like to dispel the common mis-conception that ASCII and RS-232C are the same thing... Nothing could be further from the truth! RS-232C defines connector types, pin definitions, and signal levels. ASCII (American Standard Code for Information Interchange) defines a 7-level bit code for the transfer of alpha-numeric, punctuation, and control data. ASCII-encoded data can be transmitted over any type of media, and it is still ASCII. You do not need RS-232C to send or receive ASCII data. For example: a common parallel port connection to a printer sends it's text data using the ASCII code set. DEFINITION OF RS-232C Now, back to RS-232C. First, to be true RS-232C, the connector used must be a standard 25-pin D-subminiature connector. The 'male' version of this connector is commonly known as the 'DB-25P' (pin) connector and the 'female' version the 'DB- 25S' (socket) connector (these are not EIA or CCITT designations). Second, RS-232C defines signal levels. Roughly the requirement is that the a 'MARKING' (or 'OFF') condition shall assert a voltage between -3vdc and -25vdc. A 'SPACING' (or 'ON') condition shall assert a voltage between +3vdc and +25vdc. Typically, levels of -15vdc and +15vdc are used for these states. Lastly (for our purposes), the RS-232C standard defines the purpose of the various connector pins. The ten most commonly used RS-232C signals are shown below. Signal Name Abbreviation Pin # Direction Protective Ground PROT. GND. 1 N/A * Transmitted Data TXD 2 ---> Received Data RXD 3 <--- Request To Send RTS 4 ---> Clear To Send CTS 5 <--- Data Set Ready DSR 6 <--- Signal Common SIG. GND. 7 <--> * Data Carrier Detect DCD 8 <--- Data Terminal Ready DTR 20 ---> Ringing Indicator RI 22 <--- (* denotes non-standard abbreviations) Note the 'Direction' column. The EIA and CCITT define two types of RS-232C devices: Data Terminal Equipment (DTE) (a terminal) and Data Communications Equipment (DCE) (like your modem). The DCE is also known as a Data Set. The 'Direction' column refers to the signal direction from the DTE (terminal) side. If you were looking at the definition from the DCE (modem) side, the pin numbers and signal names stay the same, but the 'direction' of each signal is reversed. One easy way to tell the difference between a DTE port and a DCE port is to examine the pin designated as Data Terminal Ready (DTR) --- if that pin ASSERTS DTR (like a terminal port does) then it is a DTE port, if it RECEIVES DTR from something else (like a modem does), the port is a DCE port. From there on, you can determine the direction and function of the remainder of the pins. A signal is asserted by a pin on a port if the voltage on the pin is greater than -3VDC or greater than +3VDC. This can be measured with a voltmeter between the pin in question and pin 7 (Signal Common). The function of each signal is detailed below. PROT. GND. (pin 1): This connection is usually to earth, or chassis, ground and it's function is exactly as described, a protective ground. This pin is normally connected to the shield of an RS-232C cable (if it has one). TXD (pin 2): This pin has the transmitted data from the DTE (terminal) to the DCE (modem). RXD (pin 3): This pin has the data received from the DCE. RTS (pin 4): This pin has a signal asserted by the DTE when it wishes to send data to the DCE. CTS (pin 5): This is a signal that the DCE uses to tell the DTE that it is OK to send data (usually in response to an RTS [above] from the DTE). DSR (pin 6): This is a signal sent by the DCE to tell the DTE that it is ready to operate. SIG. GND. (pin 7): This is the actual signal common. Do not confuse this with the Protective Ground (pin 1), they are NOT the same. An RS-232C connection will function without the pin 1's being connected, but will not function without the signal grounds being connected. DCD (pin 8): This is a signal asserted by the DCE to inform the DTE that a valid data carrier is being detected. DTR (pin 20): This is a signal asserted by the DTE to inform the modem that it is ready to receive data and decode the other status signals. RI (pin 22): This signal is asserted by the DCE (usually a modem) to let the DTE know that the phone is ringing. WHAT'S REQUIRED FOR DATA FLOW? As you might guess, certain combinations of signals must be present for data transfer between the DTE and DCE. A rough summary of these requirements is: For data to flow from DTE to DCE (terminal to modem): . The DTE must assert DTR and RTS . The DCE must assert DSR, DCD, and CTS For data to flow from DCE to DTE (modem to terminal): . The DTE must assert DTR . The DCE must assert DSR and DCD Perhaps you have noticed an interesting detail: the DCE has a way to tell the DTE when it is ready to accept data (via the CTS signal), but the DTE has no way to tell the DCE when it is ready (or not) to accept data. This leads us to our warnings. WARNINGS (or: Not All 'RS-232C' ports are created equal) Some manufacturers use the Request To Send signal as a 'Ready To Receive' signal. In other words, a signal used by the DTE to tell the DCE when it is ready to accept data. This is non- standard, but very common. The DTR signal cannot be used for this purpose. The DTR signal is used to signal the modem that the terminal is ready to operate. Most DCE devices, if they see the DTR signal go OFF, will terminate the connection immediately and will no longer accept data or commands from the DTE (this is known as 'DTR control'). Some printer manufacturers use pin 11 (Secondary Request To Send - SRTS) for data flow control. The Texas Instruments 800 Series printers and OKIData MicroLine 80 and 90 Series printers are examples of this. Other manufacturers use DTR for data flow control. Some manufacturers do not support all ten pins I have listed here. I have an old Exidy Sorcerer computer that only supports pins 1, 2, 3, and 7. A problem arises when one piece of equipment needs a signal that the other does not provide. The solution is a little imaginative wiring. For example: if your computer (or terminal) requires CTS to send data and the modem does not provide it, you can wire a different signal to the CTS pin (for example, the computer's own DTR signal). Usually, terminal and computer ports are wired as Data Terminal Equipment (DTE) to connect directly to modem (DCE) ports. There are exceptions -- as I recall, the old Apple II's were wired as DCE's. Even worse, manufacturers sometimes put 'special' signals on some pins. I've seen all kinds of weird stuff done, such as audio I/O for cassette storage and TTL signals placed on these pins. However, this is usually seen only in older machines. WARNING: if you connect RS-232C signals to one of these non-standard signals, you can damage either piece of equipment! WIRING EXAMPLES AND NULL MODEMS The rest of this discussion provides examples of how to connect two RS-232C devices so that they will 'talk' to each other. As you might imagine from the previous section, the possibilities are endless. I will cover the most common examples and leave the rest to your inventiveness. (The IBM-PC 9-pin connector is given special treatment here because it is so widely used.) NULL MODEMS How do you connect two of the same type devices together (such as DTE to DTE)? The answer is to fool each device into thinking it is connected to a DCE device (modem). The term for this type of box or cable is a 'null modem'. The most simple case is a null modem without any handshaking. This simply requires swapping pins 2 and 3 between each end. A more complete (and more complex) case is a full null modem. A Null Modem Without Handshaking 2 --------------------------- 3 3 --------------------------- 2 7 --------------------------- 7 A 'Full' Null Modem With Handshaking 1 --------------------------- 1 2 --------------------------- 3 3 --------------------------- 2 4 ---+----------------------- 8 | 5 ---+ +--- 4 | 8 -----------------------+--- 5 6 ----+---------------------- 20 | 22 ---+ +--- 6 | 20 ----------------------+--- 22 7 --------------------------- 7 Source: The Technical Aspects of Data Communications IBM-PC STYLE 9-PIN CONNECTORS For their own reasons, IBM adopted a 9-pin 'standard' for RS- 232C connectors. Nine of the 10 most commonly used signals are available with this connector. The missing connection is the chassis ground. Since this is not required for a data path, it is of little consequence. The only problem this presents is that there is no connection for the shield of a shielded cable. This can be resolved by connecting the shield to the case of the connector. IBM-PC 9-pin 'RS-232C' Connector Pin-Outs Signal Name Abbreviation Pin # Direction Data Carrier Detect DCD 1 <--- Received Data RXD 2 <--- Transmitted Data TXD 3 ---> Data Terminal Ready DTR 4 ---> Signal Common SIG. GND. 5 <--> Data Set Ready DSR 6 <--- Request To Send RTS 7 ---> Clear To Send CTS 8 <--- Ringing Indicator RI 9 <--- Note that this 9-pin standard (from reports I've heard) suffers from the same problems that standard RS-232C suffers: not all manufacturers use all of the pins. Null-Modem Cable for IBM 9-Pin Connectors This cable will allow you to connect two IBM-PC type serial ports together so that they can 'talk' to each other. 1 ----------------------+---- 7 | +---- 8 2 --------------------------- 3 3 --------------------------- 2 4 ----------------------+---- 6 | +---- 9 5 --------------------------- 5 6 ----+---------------------- 4 | 9 ----+ 7 ----+---------------------- 1 | 8 ----+ Translating an IBM 9-Pin Connector To A Standard 25-Pin Connector We wrap up this discussion with a wiring diagram to convert an IBM style 9-pin connector to a standard 25-pin RS-232C connector. IBM 25-Pin 1 ------------- 8 2 ------------- 3 3 ------------- 2 4 ------------- 20 5 ------------- 7 6 ------------- 6 7 ------------- 4 8 ------------- 5 9 ------------- 22 If you make the 25-pin connector a female (DB-25S) you will have a standard RS-232C connector that you can connect any other standard device to with an off-the-shelf cable. If you make the 25-pin end a male (DB-25P) you can simply plug it into any device with a standard RS-232C pin definition. FURTHER READING If you would like to explore data communications more thoroughly, I can recommend two very good books: The Technical Aspects of Data Communications Second Edition John E. McNamara Digital Press Bedford, Mass. Understanding Data Communications Howard W. Sams & Co. Available at Radio Shack stores I hope you have found this discussion interesting and informative. If you have any comments or suggestions, the author may be contacted at: Jim Seymour GEnie: jseymour