what is RS232? First and foremost, it is a form of serial data transmission. Or simply put, it is a form of communication. Most people simply called it a serial connection.
RS-232 is the most widely used serial interface in the PC and communication industry and is a serial physical interface standard formulated by the American Electronics Industry Association. RS is the abbreviation of “Recommended Standard” in English, and 232 is the identification number.
RS-232 is a regulation on electrical characteristics and physical characteristics, it only acts on the data transmission path, and it does not include the processing method of data.
RS232 protocol is a popular serial interface used to connect computers to networked devices such as serial servers. In serial communication, both communication parties are required to adopt a standard interface, so that different devices can be easily connected for communication.
RS-232-C interface (also known as EIARS-232-C) is the most commonly used serial communication interface at present. (The “-C” in “RS-232-C” just means the version of RS-232, so it is the same as “RS-232” for short).
It is a standard for serial communication jointly developed by the Electronic Industries Association (EIA) in conjunction with Bell System, 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)”, which stipulates that a 25-pin DB-25 connector is used for each connector. The signal content of each pin is specified, and the level of various signals is also specified. Later, IBM’s PC simplified RS232 into a DB-9 connector, which became the de facto standard.
The RS232 port of industrial control generally only uses three lines RXD, TXD, and GND.
In RS232, the data is transmitted serially in one direction over a single data line. In order to establish two-way communication, we need at least three wires (RX, TX, and GND) apart from the control signals. A byte of data can be transmitted at any time provided the previous byte has already been transmitted.
RS232 follows asynchronous communication protocol i.e. there is no clock signal to synchronize the transmitter and receiver. Hence, it uses start and stop bits to inform the receiver when to check for data.
There is a delay of a certain time between the transmissions of each bit. This delay is nothing but an inactive state i.e. the signal is set to logic ‘1’ i.e. -12V (if you remember, logic ‘1’ in RS232 is -12V, and logic ‘0’ is +12V).
First, the transmitter i.e. the DTE sends a Start bit to the receiver i.e. the DCE to inform it that data transmission starts from the next bit. The Start bit is always ‘0’ i.e. +12V. The next 5 to 9 characters are data bits.
If a parity bit is used, a maximum of 8 bits can be transmitted. If parity isn’t used, then 9 data bits can be transmitted. After the data is transmitted, the transmitter sends the stop bits. It can be either 1 bit or 1.5 bits or 2 bits long. The following image shows the frame format of the RS232 protocol.
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). Full-duplex communication can be realized by using the RS-232 bus, and the main channel is usually used, while the secondary channel is rarely used.
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 line).
The standard transmission rates stipulated 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 with different rates. For slow peripherals, a lower transfer rate can be selected; conversely, a higher transfer rate can be selected.
It is stipulated that the level of logic “1” is -5V~-15V, and the level of logic “0” is +5V~+15V. The purpose of choosing this electrical standard is to improve the anti-interference ability and increase the communication distance. RS-232 has a noise margin of 2V, and the receiver will recognize signals as high as +3V as a logic “0” and signals as low as -3V as a logic “1”.
Because RS-232 adopts serial transmission mode and converts the TTL level of the microcomputer into RS-232C level, its transmission distance can generally reach 30 m. If a photoelectrically isolated 20 mA current loop is used for transmission, the transmission distance can reach 1000 m. In addition, if a Modem is added to the RS-232 bus interface and transmitted through wired, wireless, or optical fiber, the transmission distance can be further.
A connector of the RS-232 interface is a D13-25 25-pin 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, and the chip of the interface circuit is easy to be damaged, and because it is incompatible with the TTL level, a level conversion circuit is required to connect with the TTL circuit.
(2) The transmission rate is low. During 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, but in fact, it can only be used at about 15 meters.
Though RS232 is a very famous serial communication protocol, it is now has been replaced with advanced protocols like USB. Previously they we used for serial terminals like Mice, Modem, etc.
But, RS232 is still being used in some Servo Controllers, CNC Machines, PLC machines, all in one monitor pc, and some microcontroller boards using RS232 Protocol.