RS232 / EIA232

RS232/EIA232 what is it ?

RS means 'Recommended Standard'.

During the 1960's, a comity, presently named 'Electronic Industries Association' (from which came the EIA232 of the 1990's), has developed a standard serial communication interface between equipment's. At that time, it was mainly planned for communication between computer and modem. Later, it was used for other kind of transmission between computers, computer and its peripherals units (printer, plotter, ...), computer and other equipment which use microprocessor such as machine tool numerical control, ...

That standard define the different voltage level representing 1 and 0, connector pin assignment, description of each signal and protocol for data exchange. It enable synchronous bi-directional communications (both equipment can send at the same time, full duplex) or asynchronous communications (each equipment send one after the other, half duplex). It seems that the most common one is asynchronous.

Electrical characteristics

Voltages

Voltage representing 1 and 0 are regarding the common ground (0V) connected between the 2 equipment's. They are specified as follow.

Voltage Status
-Vmax to -3V Logical 1, mark, waiting
-3V to 3V Forbidden area, in order to prevent trouble due to noise on the line
3V to Vmax Logical 0, space, active

Standard version Vmax
RS232 48V
RS232A 25V
RS232B 12V
RS232C 5V

The extreme voltage are depending on the standard version used. A so large voltage range can introduce communication trouble between the 2 equipment's. I personally experience such problem during an installation where a computer was sending program to two different machines through a T-switch. It was perfectly working up to the day I have to change the computer. On one of the two machines, communication between computer and machine has stop working. It was due to the computer serial port which was not delivering enough voltage to be detect by the machine at the end of the cable.

Cable length and type

The theoretical cable length is 15 meters. Practically, with a good cable quality, we can largely increase that length. Just use shielded cable (general or by pair) to be able to increase the length to 25-30 meters. With low capacitance cable, it seems that 100 meters can be possible.

I personally install a 40 meters RS232 line fixed on a power channel (machine tool main power line 380V AC) close to fluorescent tube without any trouble. Of course, RS232 emitter and receiver power, solding quality on connector pins, have an effect on the result.

I was personally using a 10 times 0,22mm cable with general shield. As I was only needing 3 lines, I was using 2 wires for each line and solding them together. The connector pins where also solded before solding wire on them. Putting two wire all together reduce electric resistance and increase mechanical resistance. Also, if one wire brake, you still have the other one ;-)

Short reminder, shield has to be connected at only one side of the cable otherwise it doesn't work correctly to protect signal cable from noise.

In a documentation, somebody was suggesting to use a grade 5 cable frequently used to do network connections. This enable to get good quality cable, produced in large quantity, so with low price.

Pin assignment

They are depending of the equipment type. There is 2 kind of equipment:

  • DTE (Data Terminal Equipment), computer for example
  • DCE (Data Communication Equipment), modem for example

25 pins male connectors (computer or DTE)

Pin Signal Type Use
1 Shield
2 TD Output Transmitted Data: pin on which data are sent. When the equipment is in a waiting state, that output is logical 1.
3 RD Input Received Data: pin on which data are received.
4 RTS Output Request To Send: when changed to logical 0, prompt the opposite equipment for being ready to receive.
5 CTS Input Clear To Send: when changed to logical 0, inform that the opposite equipment is ready to receive.
6 DSR Input Data Set Ready: when changed to logical 0, inform that the opposite equipment is ready. In modem case, this means that it is connected to a phone line in data mode, phone number dialling is finished and it is ready to send answer signal.
7 SG Signal Ground: signal ground reference (0V)
8 CD Input Carrier Detect: when changed to logical 0, inform that the opposite equipment receive an answer. In modem case, it inform that connection is established and that it receive answer signal from the one at opposite side of phone line.
9
10
11
12 SCD Input Secondary Carrier Detect: same as CD for secondary channel
13 SCTS Input Secondary Clear To Send: same as CTS for secondary channel
14 STD Output Secondary Transmitted Data: same as TD for secondary channel
15 TC Input Transmitter Clock: clock signal used when connecting in synchronous mode with a modem. This enable it to check data sending rhythm on computer's TD pin.
16 SRD Input Secondary Received Data: same as RD for secondary channel
17 RC Input Receiver Clock clock signal used when connecting in synchronous mode with a modem. This enable it to check data receiving rhythm on computer's RD pin.
18 LL Output Local Loopback: turn modem in test mode. When set to logical 0, modem connect its output phone connection to its input phone connection. This enable modem check.
19 SRTS Output Secondary Request To Send: same as RTS for secondary channel
20 DTR Output Data Terminal Ready: when changed to logical 0, inform the opposite equipment that when want to dialogue. In modem case, it prepare it to do phone line connection and to stay connected while succeed.
21 RL Output Remote Loopback: turn distant modem in test mode. When set to logical 0, opposite modem connect its output phone connection to its input phone connection. This enable modem check.
22 RI Input Ring Indicator: when changed to logical 0, inform that modem receive an incoming connection.
23 DSRS Output Data Signal Rate Selector: enable to select one of the two pre-set transmission speed. If set to logical 0, the highest speed is selected.
24 ETC Output External Transmitter Clock: enable only if TC and RC are not used. Computer send a clock signal to enable modem synchronisation.
25 TM Input Test Mode: inform that we are in RL or LL test mode.

9 pins male connector (computer or DTE)

Pin Signal Type Use
1 CD Input Carrier Detect: when changed to logical 0, inform that the opposite equipment receive an answer. In modem case, it inform that connection is established and that it receive answer signal from the one at opposite side of phone line.
2 RD Input Received Data: pin on which data are received.
3 TD Output Transmitted Data: pin on which data are sent. When the equipment is in a waiting state, that output is logical 1.
4 DTR Output Data Terminal Ready: when changed to logical 0, inform the opposite equipment that when want to dialogue. In modem case, it prepare it to do phone line connection and to stay connected while succeed.
5 SG Signal Ground: signal ground reference (0V)
6 DSR Input Data Set Ready: when changed to logical 0, inform that the opposite equipment is ready. In modem case, this means that it is connected to a phone line in data mode, phone number dialling is finished and it is ready to send answer signal.
7 RTS Output Request To Send: when changed to logical 0, prompt the opposite equipment for being ready to receive.
8 CTS Input Clear To Send: when changed to logical 0, inform that the opposite equipment is ready to receive.
9 RI Input Ring Indicator: when changed to logical 0, inform that modem receive an incoming connection.

25 pins connector (modem or DCE)

Pin Signal Type Use
1 Shield
2 RD Input Received Data: pin on which data are received.
3 TD Output Transmitted Data: pin on which data are sent. When the equipment is in a waiting state, that output is logical 1.
4 CTS Input Clear To Send: when changed to logical 0, inform that computer ask us to be ready to receive
5 RTS Output Request To Send: when changed to logical 0, inform that we are ready to receive.
6 DSR Output Data Set Ready: when changed to logical 0, inform that we are ready.
7 SG Signal Ground: signal ground reference (0V)
8 CD Output Carrier Detect: when changed to logical 0, inform the computer that we receive an answer.
9
10
11
12 SCD Output Secondary Carrier Detect: same as CD for secondary channel
13 SRTS Output Secondary Request To Send: same as RTS for secondary channel
14 SRD Input Secondary Received Data: same as RD for secondary channel
15 TC Output Transmitter Clock: clock signal enabling to check rhythm of data send through computer TD pin
16 STD Output Secondary Transmitted Data: same as TD for secondary channel
17 RC Output Receiver Clock: clock signal enabling to check rhythm of data received through computer RD pin
18 LL Input Local Loopback: inform that computer is asking us to turn to test mode.
19 SCTS Input Secondary Clear To Send: same as CTS for secondary channel
20 DTR Input Data Terminal Ready: when changed to logical 0, inform that computer wants to dialogue
21 RL Input Remote Loopback: inform that computer wants that the distant modem turn to test mode
22 RI Output Ring Indicator: when changed to logical 0, inform that computer gets an incoming call.
23 DSRS Input Data Signal Rate Selector: enable to select one of the two pre-set transmission speed. If set to logical 0, the highest speed is selected.
24 ETC Input External Transmitter Clock: enable only if TC and RC are not used. Computer send clock signal to enable synchronisation.
25 TM Output Test Mode: inform computer that we are in RL or LL test mode.

9 pins female connector (modem or DCE)

Pin Signal Type Use
1 CD Output Carrier Detect: when changed to logical 0, inform the computer that we receive an answer.
2 TD Output Transmitted Data: pin on which data are sent. When the equipment is in a waiting state, that output is logical 1.
3 RD Input Received Data: pin on which data are received.
4 DTR Input Data Terminal Ready: when changed to logical 0, inform that computer wants to dialogue
5 SG Signal Ground: signal ground reference (0V)
6 DSR Output Data Set Ready: when changed to logical 0, inform that we are ready.
7 CTS Input Clear To Send: when changed to logical 0, inform that computer ask us to be ready to receive.
8 RTS Output Request To Send: when changed to logical 0, inform that we are ready to receive.
9 RI Output Ring Indicator: when changed to logical 0, inform that computer gets an incoming call.

One of the encounter trouble is to known how was build the equipment. Was it configured as DTE or DCE?

Here is how to check (below information are give regarding 25 pin connectors):

  • With a DC voltmeter, put the black ends on pin number 7.
  • Make voltage measurement between tha pin and pin 2 and 3.
  • If pin 2 voltage is more negative than pin 3, this means it is set up as a DTE, otherwise it is DCE.

9 pins / 25 pins adapter

9 pins connector 25 pins connector
1 8
2 3
3 2
4 20
5 7
6 6
7 4
8 5
9 11

RJ45 connector or RS232D (computer or DTE)

RJ45

Pin Signal Type Use
1 DSR Input Data Set Ready: when changed to logical 0, inform that the opposite equipment is ready. In modem case, this means that it is connected to a phone line in data mode, phone number dialling is finished and it is ready to send answer signal.
2 CD Input Carrier Detect: when changed to logical 0, inform that the opposite equipment receive an answer. In modem case, it inform that connection is established and that it receive answer signal from the one at opposite side of phone line.
3 DTR Output Data Terminal Ready: when changed to logical 0, inform the opposite equipment that when want to dialogue. In modem case, it prepare it to do phone line connection and to stay connected while succeed.
4 SG Signal Ground: signal ground reference (0V)
5 RD Input Received Data: pin on which data are received.
6 TD Output Transmitted Data: pin on which data are sent. When the equipment is in a waiting state, that output is logical 1.
7 CTS Input Clear To Send: when changed to logical 0, inform that the opposite equipment is ready to receive.
8 RTS Output Request To Send: when changed to logical 0, prompt the opposite equipment for being ready to receive.

Common connections

Theory (DTE with DCE)

Theory

25 pins - 25 pins (DTE with DTE)

DB25 F / DB25 F

9 pins - 25 pins (DTE with DTE)

DB9 F / DB25 F

9 pins - 9 pins (DTE with DTE)

DB9 F / DB9 F

CTS / RTS 25 pins - 25 pins (DTE with DTE)

DB25 F / DB25 F + CTS/RTS

CTS / RTS 9 pins - 25 pins (DTE with DTE)

DB9 F / DB25 F + CTS/RTS

CTS / RTS 9 pins - 9 pins (DTE with DTE)

DB9 F / DB9 F + CTS/RTS

Test connectors

25 pins with loop back

DB25 F / test

9 pins with loop back

DB9 F / test

RS232 spy

DB9 F / DB9 M / DB9 F

Flow control

Hardware (CTS/RTS)

In the below explanation, equipment which send data will be called emitter and the one which receive data will be called receiver even they are both emitter and receiver.

Emitter send data. Receiver store these data in a memory buffer. When that buffer reach a defined level, receiver remove its CTS signal (changed to logical 1). Immediately, emitter stop sending data. Receiver continue memory buffer data processing. When the memory buffer reach enough available space level, it turn on CTS signal (changed to logical 0). Emitter restart to send data. That process is reproduce until there is no more data to send.

Software (XON/XOFF)

In the below explanation, equipment which send data will be called emitter and the one which receive data will be called receiver even they are both emitter and receiver.

Emitter send data. Receiver store these data in a memory buffer. When that buffer reach a defined level, receiver send XOFF code (character with decimal code 17) to the emitter. Immediately, emitter stop sending data. Receiver continue memory buffer data processing. When the memory buffer reach enough available space level, it send XON code (character with decimal code 19) to the emitter. Emitter restart to send data. That process is reproduce until there is no more data to send.

PC serial port

On PC's, the serial port are commonly configurated as follow:

Port number Adress Irq
1 3F8H 4
2 2F8H 3
3 3E8H 4
4 2E8H 3

Glossary

Bauds
It is the number of line status within a second. In case of direct cable connection, this is corresponding to bits per second. This is not right in modem case, which will use other techniques such as compression or phase modulation to increase the number of bits send in a second. The baud rate is depending of the used phone line.
Parity
This is a bit which can be added at the end of data bits.
Even parity
the transmitted bit is logical 0 if the logical 1 data bit number is even. It is a logical 1 in opposite case.
Odd parity
the transmitted bit is logical 0 if the logical 1 data bit number is odd. It is a logical 1 in opposite case.
Space parity
the transmitted bit is always logical 0.
Mark parity
the transmitted bit is always logical 1.
No parity
no parity bit is added.
Data bits
It is the number of bit (logical 0 or 1) send for coding one character. If set to 7 bits, the character decimal value can be from 0 to 127. If set to 8 bits, the character decimal value can be from 0 to 255.
Start bits
This is a logical 0 bit which define start of data to be transmitted.
Stop bits
This is one or more (1, 1.5, 2) logical 1 bit which define the end of transmitted data. Their quantity define the duration of the logical 1 (1 time, 1.5 times or 2 times the duration of a data bit).
Simplex
Unidirectional communication. It happen only in one direction, from the emitter to the receiver.
Half duplex
The 2 equipment can send and receive. They one after the other emitter or receiver. They cannot be both emitter at the same time.
Full duplex
The 2 equipment can send and receive. They can both send and receive simultaneously.
Shield
It is a metallic braid which is around cable or wires. It has to protect wires from noisy environment.
UTP/STP cable
UTP = Unshield Twisted Pair
STP = Shield Twisted Pair

Licence

That software is free in the respect of 'GNU General Public License' (version 2) from Free Software Foundation. It is supplied as it is and without any warranty.

Download

Documentation in PDF: format en_rs232.pdf

History

Date Version Author Changes
1 April 2002 Alain JAFFRE First english version.
6 October 2002 Alain JAFFRE Addition of the different standard version regarding voltage values. Addition of RS232D connection
4 October 2003 Alain JAFFRE Correction on CTS / RTS 9 pins - 9 pins (DTE with DTE) drawing. 7 and 8 crossing were missing.

Latest version always available on: http://jack.r.free.fr. You can find there also some RS232 transmission programs.