Cookies are important for this site to function properly, to guarantee your safety, and to provide you with the best experience. By clicking OK, you accept all cookies. For more information, please access our Privacy Policy.
Table of Contents
Tutorials / 
What is the RS-232 Protocol, What it's used for, and RS232 Serial Communication in Industrial Automation
Intermediate

What is the RS-232 Protocol, What it's used for, and RS232 Serial Communication in Industrial Automation

EtherNet/IP
Industrial Networking
Hardware

Introduction

Serial communications, known for their simplicity and reduced hardware requirements compared to parallel interfacing, are widely adopted in the industry.

The concept of serial communication involves the transmission of data bits in a sequential manner, one bit at a time, through a specific communication channel. Parallel communication refers to transmitting multiple bits of data simultaneously across multiple channels, allowing for higher data transfer rates compared to serial communication.

Figure 1.1: RS-232 protocol - Serial communication vs parallel communication
Figure 1.1: RS-232 protocol - Serial communication vs parallel communication

In today's context, RS-232 is firmly established as the predominant serial communications standard. Often, you might hear the term 'RS-232' in the workplace, particularly from older and more experienced personnel.

Figure 1.2: RS-232 protocol - Types of serial communication protocols
Figure 1.2: RS-232 protocol - Types of serial communication protocols

Prerequisites

Prior familiarity with the 'PLC Networking Basics Tutorial' will prepare you to engage more effectively and enhance this tutorial comprehension, optimizing your learning experience.

RS-232 Definition

RS-232 is an acronym that expands to 'Recommended Standard 232.' RS-232 functions as a method for serial data transfer, serving as a recognized communication protocol that outlines the physical and electrical properties inherent to serial communication networks. Although RS-232 remains commonly referred to, it has officially been renamed TIA-232, derived from 'Telecommunications Industry Association Recommendation 232.'

Figure 2.1: RS-232 protocol - RS-232 definition
Figure 2.1: RS-232 protocol - RS-232 definition

RS-232 Connector

The RS-232 standard employs DB9 and DB25 connectors, each characterized by its D-shaped form. These connectors facilitate communication with their male and female interfaces on either end.

Figure 3.1: RS-232 protocol - RS-232 connection types
Figure 3.1: RS-232 protocol - RS-232 connection types

Given the limited utilization of most pins on the 25-pin connector within various applications in the industry, manufacturers embraced the 9-pin connector for its cost-saving benefits and its ability to occupy less physical space, thus optimizing device design.

Figure 3.2: RS-232 protocol - DB9 connector vs DB25 connector
Figure 3.2: RS-232 protocol - DB9 connector vs DB25 connector

RS-232 Pinout

Since the DB9 connector is more commonly used in the industry, in this tutorial, you will delve more into the pinout for a standard RS-232 9-pin connector.

  • TXD (Transmit Data): This is where data is transmitted to the receiver device.
  • RXD (Receive Data): This is where data is received from the receiver device.
  • DTR (Data Terminal Ready): This signal indicates that the terminal or transmitter is ready to launch a connection with the receiver device.
  • DSR (Data Set Ready): This signal indicates that the receiver device is powered on and ready to communicate.
  • RTS (Request to Send): This signal is sent from the terminal or transmitter to the receiver device to request permission to send data.
  • CTS (Clear to Send): This signal is sent from the receiver device to the terminal or transmitter to grant permission to send data.
  • GND (Ground): This is the electrical ground reference voltage.
  • DCD (Data Carrier Detect): This is an indication from the data communication equipment that a carrier tone from the remote end has been detected.
  • RI (Ring Indicator): This signal indicates the telephone line is ringing.

It's worth mentioning that the DCD (Data Carrier Detect) and RI (Ring Indicator) signals are primarily associated with modem applications and are less commonly used in modern computing and communication systems.

Figure 4.1: RS-232 protocol - DB9 pinout
Figure 4.1: RS-232 protocol - DB9 pinout

RS-232 Working Principle

Begin with two pieces of equipment that need to be communicated. To simplify matters, imagine one device only transmits data while the other only receives it. In reality, however, both devices perform both functions, but understanding communication in one direction allows you to apply it in both.

Figure 5.1: RS-232 protocol - Establishing communication between transmitter and receiver
Figure 5.1: RS-232 protocol - Establishing communication between transmitter and receiver

The data creation of the transmitter triggers the need for transmission through a physical wire to reach the receiver. This transmission is made possible by the transmit data (TXD) pin at the site of the transmitter and the received data (RXD) pin at the receiver’s end. Linking these links establishes an essential pathway, ensuring data flow from transmitter to receiver.

Figure 5.2: RS-232 protocol - The role of TXD and RXD pins in wired communication
Figure 5.2: RS-232 protocol - The role of TXD and RXD pins in wired communication

The RS-232 specification addresses scenarios where you want to ensure a receiver exists and is not absent for particular applications. But how?

The RS-232 designers incorporated an essential control wire into the system, which communicates the presence of the receiver to the transmitter. This link, designated as Data Terminal Ready (DTR) on the side of the transmitter and Data Set Ready (DSR) on the end of the receiver, ensures that once connected and the receiver sets the appropriate voltage, the transmitter is aware that the receiver is there and present, thereby allowing data to be transmitted safely.

Figure 5.3: RS-232 protocol - The role of DTR and DSR pins in wired communication 
Figure 5.3: RS-232 protocol - The role of DTR and DSR pins in wired communication 

Another issue that may arise is the data transmission speed from the transmitter to the receiver. If the transmitter sends data too quickly, due to the receiver being unable to process the incoming data at that rate, it may result in data loss.

Figure 5.4: RS-232 protocol -  Impact of transmission speed on data integrity
Figure 5.4: RS-232 protocol -  Impact of transmission speed on data integrity

To mitigate the issue of coordinating data transfers, RS-232 designers introduced an additional control wire, which ensures coordination between the transmitter and receiver. This control is known as Request to Send (RTS) on the side of the transmitter and Clear to Send (CTS) on the receiver's end. When the transmitter is ready to transmit data, the RTS sends a request signal. Then, The CTS clears the path, indicating the receiver's readiness to accept the data. Once the path is cleared, data is sent from the TXD pin of the transmitter to the RXD pin on the receiver. This method, called hardware flow control, uses the RTS-CTS control to manage the data flow, ensuring efficient and reliable communication between devices.

Figure 5.5: RS-232 protocol - The role of RTS and CTS pins in wired communication
Figure 5.5: RS-232 protocol - The role of RTS and CTS pins in wired communication

Besides hardware flow control, RS-232 also supports software flow control. When specific control characters (called XON and XOFF) are used to manage when data is sent from the transmitter to the receiver, it is referred to as software flow control. The receiver signals its readiness to accept data by sending an XON character to the transmitter. When it needs the transmitter to stop transmitting, it sends an XOFF character instead. Although this approach to flow control is less reliable than hardware-based methods due to the use of data characters for signaling, it typically performs adequately enough to be considered worthwhile in many cases.

Figure 5.6: RS-232 protocol - Software flow control - XOFF control character
Figure 5.6: RS-232 protocol - Software flow control - XOFF control character
Figure 5.7: RS-232 protocol - Software flow control - XON control character
Figure 5.7: RS-232 protocol - Software flow control - XON control character

In the simplest case of transferring data between two devices using RS-232, you connect the transmit and receive wires. A third wire, the ground wire, is also necessary to maintain technical accuracy and ensure proper functioning. This wire, called the Signal Ground (SG), establishes the reference point for signal voltages. Therefore, the simplest communication form between the two RS-232 devices can be successfully achieved, using these three wires.

Figure 5.8: RS-232 protocol - Three wires for basic communication
Figure 5.8: RS-232 protocol - Three wires for basic communication

RS-232 Cables and Device Types

The RS-232 standard details the methods for serial data transmission, focusing on communication between a central system, called Data Terminal Equipment (DTE), and a connected peripheral device, known as Data Circuit-Terminating Equipment (DCE).

Figure 6.1: RS-232 protocol - Communication between DTE and DCE
Figure 6.1: RS-232 protocol - Communication between DTE and DCE

You can select from different RS-232 cable types, including straight-through cables, null-modem cables, and crossover cables, each tailored to meet distinct connection requirements.

Figure 6.2: RS-232 protocol - Types of cables
Figure 6.2: RS-232 protocol - Types of cables

According to RS-232 communication standards, a conventional DCE device should be connected to a DTE device via a straight-through cable, which ensures that the numbers of pins on each connector are precisely matched.

Figure 6.3: RS-232 protocol - Straight-through cable
Figure 6.3: RS-232 protocol - Straight-through cable

To connect two DTE devices directly, without a DCE device, a null modem cable meticulously reverses TXD (transmit data) and RXD (receive data) signals between Pin 2 and Pin 3 at each end. It ensures Pin 5 (Ground or GND) continuity and offers flexibility by crossing handshaking lines like DTR/DSR and RTS/CTS to optimize hardware flow management.

Figure 6.4: RS-232 protocol - Null-modem cable
Figure 6.4: RS-232 protocol - Null-modem cable

You can use crossover cables to connect two DCE devices, while connections between two DCE devices are similar to those made with null modem cables.

Figure 6.5: RS-232 protocol - Crossover cable
Figure 6.5: RS-232 protocol - Crossover cable

The DCE equipment connector boasts a robust design with a male housing intended for female pins, unlike its DTE counterpart, which utilizes female housing and male pins.

Figure 6.6: RS-232 protocol - Connector housing and pins in DCE and DTE
Figure 6.6: RS-232 protocol - Connector housing and pins in DCE and DTE

RS-232 Disadvantages

In this section, you will explore the drawbacks associated with the RS-232 protocol. The primary drawback lies in the cable's length restriction, which tops out at 50 feet. Beyond this threshold, issues arise from increased wire resistance and voltage drops.

Figure 7.1: RS-232 protocol - Cable’s length restriction
Figure 7.1: RS-232 protocol - Cable’s length restriction

The second issue to address is the rate at which data transfers, typically hovering at about 20 kilobytes per second.

Figure 7.2: RS-232 protocol - Data transfer speed
Figure 7.2: RS-232 protocol - Data transfer speed

The operational reliability of RS232 cables can be compromised by radio frequency interference (RFI) and electromagnetic interference (EMI), which originate from diverse sources such as machinery and wireless communications, potentially leading to degraded signal integrity or complete loss of data transmission capability.

Figure 7.3: RS-232 protocol - Cable vulnerability to interference
Figure 7.3: RS-232 protocol - Cable vulnerability to interference

RS-232 Application

Within the industrial automation realm, the RS-232 interface remains a standard choice for applications requiring limited-distance, slow-rate, and point-to-point wired data connections that are sufficient for some tasks. For instance, some PLCs use the RS-232 standard to establish communication with instruments like HMIs, IPCs, robots, motor controllers, vision systems, CNC machines, and other similar equipment.

Figure 8.1: RS-232 protocol - Application examples
Figure 8.1: RS-232 protocol - Application examples

Conclusion

In conclusion, you learned about the RS-232 protocol, including its definition, connector types, and pinout configurations. You explored the working principles of RS-232, covering the essential components of data transmission and the hardware and software flow control methods. You also examined the various types of RS-232 cables and device configurations alongside the advantages and disadvantages of using this protocol. Finally, you discovered the practical applications of RS-232 within industrial automation, demonstrating its enduring relevance despite the advent of more advanced communication technologies. This comprehensive understanding of RS-232 will equip you with the knowledge to utilize this protocol in your professional projects.