The RS-232 standard interface (also known as EIA RS-232) is one of the commonly used serial communication interface standards. It was jointly established in 1970 by the Electronic Industries Association (EIA) in conjunction with Bell Systems, modem manufacturers and computer terminal manufacturers. Established, its full name is “Technical Standard for Serial Binary Data Exchange interface Between Data Terminal Equipment (DTE) and Data Communication Equipment (DCE)”.


In serial communication, both parties are required to use a standard interface so that different devices can be easily connected for communication. The RS-232-C interface (also known as EIARS-232-C) is currently the most commonly used serial communication interface. (The “-C” in “RS-232-C” only indicates the version of RS-232, so it is the same as the abbreviation of “RS-232”).

It is a standard for serial communication formulated by the Electronic Industries Association (EIA) of the United States in conjunction with Bell Systems, modem manufacturers and computer terminal manufacturers in 1970. Its full name is “Technical Standard for Serial Binary Data Exchange Interface Between Data Terminal Equipment (DTE) and Data Communication Equipment (DCE)”. The standard stipulates that a 25-pin DB-25 connector is used for each connector. The signal content of each pin is specified, and the levels of various signals are also specified. Later, IBM’s PC simplified rs232 into a DB-9 connector, which became the de facto standard. The RS-232 port of industrial control generally only uses three lines of RXD, TXD, and GND.


Less signal lines

The RS-232 bus specifies 25 lines, including two signal channels, namely the first channel (called the main channel) and the second channel (called the secondary channel). The RS-232 bus can be used to achieve full-duplex communication, usually the main channel is used, and the secondary channel is used less. In general applications, full-duplex communication can be realized by using 3 to 9 signal lines, and a simple full-duplex communication process can be realized by using three signal lines (receiving line, sending line and signal ground).

Flexible baud rate selection

The standard transmission rates specified by RS-232 are 50b/s, 75b/s, 110b/s, 150b/s, 300b/s, 600b/s, 1200b/s, 2400b/s, 4800b/s, 9600b/s, 19200b /s, can flexibly adapt to devices of different speeds. For slow peripherals, you can choose a lower transfer rate: conversely, you can choose a higher transfer rate.

Use negative logic to transfer

It is stipulated that the level of logic “1” is -5V ~ -15 V, and the level of logic “0” is +5 V ~ +15 V. The purpose of selecting this electrical standard is to improve the anti-interference ability and increase the communication distance. The noise tolerance of RS-232 is 2V. The receiver will recognize signals as high as +3V as logic “0”, and signals as low as -3 V as logic “1”.

Long transmission distance

Because RS-232 adopts serial transmission mode and converts the TTL level of the microcomputer to RS-232C level, the transmission distance is generally up to 30 m. If the optically isolated 20 mA current loop is used for transmission, the transmission distance can reach 1000 m. In addition, if you add a Modem to the RS-232 bus interface and transmit via wired, wireless or optical fiber, the transmission distance can be longer.

Two physical interfaces

A kind of connector of RS-232 interface is D13-25 25-pin plug socket, usually the plug is at the DCE end, and the socket is at the DTE end.



(1) The signal level of the interface is high, which is easy to damage the chip of the interface circuit, and because it is incompatible with the TTL level, a level conversion circuit is needed to connect with the TTL circuit.
(2) The transmission rate is low. In asynchronous transmission, the baud rate is 20Kbps; therefore, in the CPLD development board, the integrated program baud rate can only be 19200, which is also the reason.
(3) The interface uses a signal line and a signal return line to form a common ground transmission form. This common ground transmission is prone to common mode interference, so the anti-noise interference is weak.
(4) The transmission distance is limited, the maximum transmission distance standard value is 50 feet, in fact it can only be used at about 15 meters.

Communication mechanism

The following describes the principle of RS-232 serial communication with the communication process between the computer and the modem. Consider the interaction and working process of the RS-232 signal between the computer and the modem when the modem is in the answering mode. Assume that the modem is full-duplex and uses RS-232.

Standard specification work.

(1) In the initial state, RTS and CTS are continuously ON, and the rs232 pin status is set and monitored through the communication program. In the answering mode, the software in the computer has been monitoring the ringing indication (RI), waiting for the RI to send an ON signal.
(2) After the communication program on the computer receives the RI signal, it starts to count the ringing by the number of times the ringing indicator is ON/OFF. When the number of ringing set by the arrival process is reached, the communication program will be ready for the data terminal. (DTR) signal, forcing the modem to go off-hook.
(3) After waiting for 2s (FCC regulations), the modem automatically starts to send its response carrier. At this time, the modem sends out a modem ready (DSR) signal to inform the computer that it has completed all preparations and is waiting for the carrier signal.
(4) During the continuous sending of the DTR signal, the computer software monitors the DSR signal. When the DSR signal turns ON, the computer knows that the modem is ready to connect to the data link, and the computer immediately starts monitoring the data carrier monitor (CD) signal to confirm the existence of the data link.
(5) When the carrier of the source modem appears on the telephone line, the answering modem sends out a CD signal.
(6) Through the transmission data line (TD) and the receiving data line (RD), full-duplex communication is started. During the data link transmission, the computer monitors the CD to ensure the existence of the data link.
(7) Once the communication task is completed, the computer prohibits DTR, and the modem responds by removing its carrier tone, prohibiting CD and DSR. As the link is torn down, the modem will return to its initial state.
When the RS-232 serial communication distance is short (<12m), you can use a cable to directly connect to the standard rs232 port. If the distance is long, an additional modem (Mode) is required. The simplest and commonly used method is the three-wire connection, that is, ground. , Receive data, send data three-pin connection.


Mechanical properties

The interface used in the rs232 standard is a 9-pin or 25-pin D-type plug, and a 9-pin plug is commonly used.
The RS232C standard interface has 25 wires, and there are only 9 wires commonly used. They are:
(1) Received Line Signal Detection (RSD)-used to indicate that the DCE has connected the communication link and inform the DTE that it is ready to receive data. When the local MODEM receives the carrier signal sent by the MODEM at the other end of the communication link (remote), it makes the RLSD signal valid, and informs the terminal that it is ready to receive, and the MODEM demodulates the received carrier signal into digital data. ,Send to the terminal along the receive data line RXD. This line is also called the Data Carrier Detection (DCD) line.
(2) Received data (RXD)——Receive the serial data (DCE→DTE) sent from the MODEM through the RXD line terminal.
(3) Transmitted data (TXD)——Send serial data to MODEM (DTE→DCE) through TXD terminal.
(4) Data terminal ready (Data Terminal Ready, DTR)-valid (ON) state, indicating that the data terminal can be used.
(5) Ground wire-GND.
(6) Data Set Ready (Data Set Ready, DSR)-valid (ON) state, indicating that the communication device is in a usable state.
(7) Request to Send—It is used to indicate that DTE requests DCE to send data, that is, when the terminal wants to send data, make the signal valid (ON state) and request sending to the MODEM. It is used to control whether the MODEM should enter the sending state.
(8) Clear to Send (CTS)-used to indicate that the DCE is ready to receive the data sent by the DTE, and is a response signal to the request to send the signal RTS. When the MODEM is ready to receive the data from the terminal and send it forward, the signal is enabled to notify the terminal to start sending data along the sending data line TXD.
(9) Ringing indication (Ringing, R)-When the MODEM receives the ringing call signal sent by the exchange, it makes the signal valid (ON state) to notify the terminal that it has been called.


Electrical characteristics

On TXD and RXD: logic 1 (MARK)=-3~-15V; logic 0 (SPACE)=3~15V. On control lines such as RTS, CTS, DSR, DTR and DCD: signal valid (on, ON state, positive voltage)=3~15V; signal invalid (off, OFF state, negative voltage)=-3~-15V . [3]
The above regulations explain the definition of logic levels in the RS232C standard. For data (information code), the level of logic 1 (mark) is lower than -3V, and the level of logic 0 (empty sign) is higher than +3V; for control signals, the ON state (ON) is the electrical signal when the signal is valid. When the level is higher than 3V, the OFF state (OFF) means that the signal level is lower than -3V, that is, when the absolute value of the transmission level is greater than 3V, the circuit can be effectively checked, and the Voltage is between -3~3V. It is meaningless. Voltages lower than -15V or higher than 15V are also considered meaningless. Therefore, in actual work, ensure that the level is within ±(3~15)V. When connecting the system with rs232 bus, there is short-range communication and remote communication. There are two ways. Short-range communication refers to communication with a transmission distance of less than 15m, which can be directly connected with an RS232 cable; long-distance communication above 15m requires a modem.