RS-232 Reference
Here's my reference notes on RS232. There's usually an air of frustration with RS232. No, it's not the design, or the detail of the signals. No. It's the cable.
All cables look the same. (Except when they don't: you may have a 25 way female when you really want a 9 way male.)
They might look the same, but not work the same. The internal wiring can be, seemingly, totally random.
(In my early days I was employed by a company that manufactured VDUs - emulations of VT52, VT200... We had a catalogue of 80 different RS232 cables. Different emulations, host interfaces, printer interfaces. Amazing.)
That's why USB is so popular, plug and play, and it might work too!
As you may be aware, males have things that stick out; females have holes. So it is with RS232 connectors.
This is the connector you'll find on a PC.
|
9-way |
Signal |
Direction |
Class |
|
1 |
Modem -> PC |
Control |
|
|
2 |
Modem -> PC |
Data |
|
|
3 |
PC-> Modem |
Data |
|
|
4 |
PC-> Modem |
Control |
|
|
5 |
|||
|
6 |
Modem -> PC |
Control |
|
|
7 |
PC-> Modem |
Control |
|
|
8 |
Modem -> PC |
Control |
|
|
9 |
Modem -> PC |
Control |
This is the connector you'll find on a VDU, or some other piece of old technology
|
25-way |
Signal |
Direction |
Class |
|
1 |
Protective Ground |
||
|
2 |
PC-> Modem |
Data |
|
|
3 |
Modem -> PC |
Data |
|
|
4 |
PC-> Modem |
Control |
|
|
5 |
Modem -> PC |
Control |
|
|
6 |
Modem -> PC |
Control |
|
|
7 |
|||
|
8 |
Modem -> PC |
Control |
|
|
20 |
PC-> Modem |
Control |
|
|
22 |
Modem -> PC |
Control |
Most of the other pins have assigned uses, but are not normally used.
|
Term |
Description |
Which typically means |
|
Clear To Send |
A control signal to the PC. The remote host is ready to receive your input. The host (remote DTE) may drop this from time to time as it becomes busy. |
|
|
Data Carrier Detect |
A control signal to the PC. The modem is receiving a valid carrier signal from the remote modem. AKA Received Line Signal Detect – RLSD. |
|
|
DCE |
Data Communication Equipment. |
Normally a Modem |
|
Data Set Ready |
A control signal to the PC. The modem is ready to answer or originate a call – as opposed to being in a test mode. The word set is a noun. It is the same word used by an elderly maiden aunt referring to a television set. |
|
|
DTE |
Data Terminal Equipment |
PC, VDU or Data Terminal, Mainframe, terminal concentrator. |
|
Data Terminal Ready |
A control signal from the PC. The PC uses this to enable the modem: the modem is allowed to go on-line or answer a call. (Cynically, this can also be considered as a modem reset line - use this signal to reset the modem after a firmware crash.) |
|
|
EIA |
Electronic Industries Alliance |
The US standards body. http://www.eia.org/ Their version is TIA/EIA-232-F |
|
ITU-T |
International Telecommunication Union |
An international organization that coordinates global telecom networks and services. |
|
Ground |
The common signal ground connection. All the other signals refer to this reference. This must be connected at both connectors. |
|
|
Protective Ground |
Protective Ground |
A ground screen. Ideally, this should be open at one of the connectors. |
|
Ring Indicator |
A control signal to the PC. Indicates the phone line is ringing. This signal follows the cadence of the ringing signal. |
|
|
Request To Send |
A control signal from the PC. The PC
is ready to receive data. The PC may drop RTS from time to time as it
"spins its wheels" - having to scroll text and other demanding
tasks. |
|
|
Receive Data |
The data signal to the PC. What the user sees from the remote host. |
|
|
Transmit Data |
The data signal from the PC. The data sent by the user. |
Voltage signalling is used – as opposed to current. Note the polarity is different between data and control signals!The Signals
|
Circuit class |
Circuit Condition | Voltage | Logic |
| Data | Mark (Asynchronous stop bit, idle) | -25v to –3v | 1 |
| Data | Space (Asynchronous start bit, break) | +25v to +3v | 0 |
| Control | Mark (Asserted) | +25v to +3v | 1 |
| Control | Space (Not Asserted) | -25v to -3v | 0 |
(30v/us slew limit, 3k 2500pF load.)
9 way connectors look something like this:
![]()
Male DTE
(The connector fitted in a PC)
![]()
Female DCE
(The connector that's on the cable that
plugs in to a PC)
Note – When thinking about the RS-232 spec, view the signal directions from the DTE's viewpoint. That is the DTE transmits on the TXD signal connection.
There are alternate designations. (EIA designate BA, BB, CB etc. ITU-T V.24 designate: 103, 104, 106 etc.) To describe them here in detail would not be particularly helpful, and would obfuscate. Leave them to sad network gurus.
Cables
A cable connecting a DTE to DCE is wired "straight through", male to female.
Null Modem
To connect two computers together, a special cable is required which mimics the behaviour of a modem. This specially wired cable, with two female connectors, is known as a null-modem cable.
A null modem cable swaps:
Still Issues?
Try building up and testing with a null cable incrementally. Using the above diagram try connecting only the GND, TXD and RXD between to connectors. You'll then have a null modem with no handshaking.
Try wiring up a loopback on each connector. Connect CTS to RTS on each connector only. DSR and DCD with DTR. These loopbacks are only on the connectors - don't wire between the two individual connectors: you still only have TX RX and GND connected between the two. This will fool the DTE and DCE that hardware conditions are all ready to send and receive.
RS232 Gender Benders
You can get adapters that are wired "straight through". There are 2 flavours: back-to-back male and back-to-back female. They tend not to be that useful as you usually need to re-assign pin connections too.
HyperTerminal
Windows comes with a terminal emulator "HyperTerminal." If you are using the HyperTerminal supplied with Windows 98 or HTPE 3.0, you will find that local echo doesn't work when "Echo typed characters locally" under ASCII Setup/ASCII Sending is checked. This bug has been fixed with HTPE 5.0. You'd better download and install their new version.
Sort of relevant - it caught me out!
Macintosh, and Linux
Phil Frost wrote to me:
When connecting a Macintosh and a pc, funny things happen. The Mac uses rs-422 and the pc uses rs-232. To connect the two the 422 has to be wired together with a common ground, etc. The cable is available as a "Macintosh modem cable".
In Linux it's possible to use DTR in lieu of RTS as the rs-422 lacks RTS when wired to a RS-232. Of course, then you can't use the other lines for modem control and you have to make a custom cable, but it may be useful for those wishing to connect a Mac to a pc via a null modem.
Cables
Cables can be wired in many different combinations. An unknown, incorrectly wired cable is very unlikely to damage anything. TX and RX may work - but the hardware handshaking will probably be incorrect.
If you do have problems - get a test meter and sketch out the wiring. Or treat yourself to a "Breakout Box" or Bob. (Pronounced "BoB" as Black Adder would say ) This is a set of patch wires and LEDs that lets you isolate and jumper each circuit. Comcraft have such a beast here which Mr Radiospares will be happy to sell you.
USB Adapters
USB Serial Adapter gives you and your software a RS232 connection.
Make sure you get a decent one! Old serial USB adapters are badly written by inept programmers. You'll get unreliable operation and more blue screens of death than Liptons have tealeaves.
Here's a link for one adapter I regularly recommend. "USB-COM-PL : USB-RS232 with detachable USB cable".
Errors, omissions, comments
...are welcome, and may be directed to me.
I've not covered these issues:
Serialisation: the components of the bit stream, start, stop, parity.
The difference of bits per second and baud.
Flow control. (XON XOFF, and hardware.)
Link
Here's a more in-depth tutorial of the RS232 (EIA232) standard with signal names, definitions, and examples.
Last update 16th September 2008.