Serial communication Protocol - Part 3: RS-232
In this series, we are looking at some of the different types of serial communication protocols that can be used to transfer data between devices. These articles will cover some of the more popular protocols and standards in use today, and at the end of this series, we will review and compare the pros and cons of each protocol. Hopefully, this information will be helpful the next time you need to implement a serial communication bus in your design to help you choose the most appropriate option for your circuit.
RS-232 stands for Recommended Standard 232, which is an electronic device protocol standard for data transfer between electronic devices created in 1960. Once upon a time, RS-232 was the most commonly used data transmission format and was mainly implemented using a single standard. 9-pin D-sub (DB-9) connection. Today, the standard is still widely used in a variety of electronic devices, including computers, automation, and medical devices.
RS-232 uses positive voltage to transmit low logic level signals (0) and negative voltage to transmit high logic level signals (1).
The communication principle of RS-232 communication is very simple. The sender device stores the data in its buffer, then sends the data over a cable (or PCB track), and the receiver stores that data in its buffer. The receiver can then read the buffered data.
To avoid sending information when the receiver is not connected, DTR (data ready to send) and DSR (data set ready) pins are used. When these pins are connected and the receiver has set the correct voltage on these pins, the transmitter device will know that the receiver is connected and ready.
If the sender sends data too fast and the receiver cannot read from its buffer fast enough, the buffer will overflow and the data will be lost. To prevent this, two more pins are added to the sender and one to the receiver. From the sender, the pin is labeled as RTS (request to send), and from the receiver, it is labeled as CTS (clear to send). The receiver notifies the sender that its buffer is full by pulling down the voltage of this pin. This tells the sender not to send more information until the receiver is ready. This is called hardware flow control.
There are also two pins available for telephony applications, which are now largely redundant. One is DCD (Data Carrier Detection), which tells the modem that an analog signal is being received, and the other is RI (ringing indicator), which indicates that the phone is ringing. These are hardly used today.
The final connection is SG or signal ground, which is the grounding reference voltage of the communication device.
There are two types of RS-232 communication equipment: DTE (Data terminal equipment) and DCE (Data communication equipment). Examples of DTE include a computer, PLC, or other command sending device. Examples of DCE are modems, cameras, printers, and general purpose automation devices.
Two Dtes or two DCE devices cannot send information to each other. There must be a DTE that sends commands to establish communication between devices, and a DCE that executes those commands
RS-232 can also be used to communicate between computers via modem, as shown below:https://www.kingfordpcb.com/yuan.php
Serial communication Protocol - Part 3: RS-232
However, to eliminate the need for DSR and RTS lines, packets from the receiver side must be sent to indicate when data can be sent and when it cannot. XON indicates that data can be sent, and XOFF indicates that data cannot be sent. This is called software flow control.
The main disadvantage of using RS-232 is that its communication speed is relatively slow compared to other serial communication protocols. In many applications, it can only reliably reach speeds up to 128 kbps. Another disadvantage is that it can reliably work with a maximum cable length of only 15 meters. Wire resistance and voltage loops become problems on long distance cables.
Although RS-232 is not commonly used in new devices these days due to other more modern communication protocols available, older devices are often found. That being said, even the latest high-tech computer motherboards often still have COM port connectors that can expose RS-232 if needed. In this field, there are still quite a few devices that are more than 10 years old, including printers, industrial automation equipment, etc., which need to be programmed and maintained when in use. For this, RS-232 is essential. Fortunately, there are a lot of converters out there, such as RS-232 to USB, which means we can still easily communicate with these devices.
This article examines some of the standard features of the older RS-232 protocol, and discusses some of its advantages and implementation details. In other articles in this series, we'll cover some of the alternative serial communication protocols available.