Share this

RS485 communication and Modbus communication protocols in industrial control

2026-04-06 07:07:41 · · #1

In fields such as industrial control, power communication, and smart meters, serial communication is typically used for data exchange. Initially, the RS232 interface was used, but due to the complexity of industrial environments and the significant electromagnetic interference generated by various electrical devices, signal transmission errors could occur.

In 1979, Schneider Electric developed the Modbus protocol, a bus protocol for industrial field use. Today, many applications of RS485 communication in industry use the Modbus protocol. So today, let's learn about RS485 communication and the Modbus communication protocol.

【RS485 communication】

RS232 actually existed before RS485, but RS232 also has its shortcomings:

1. The signal level of the interface is relatively high, reaching tens of volts, which can easily damage the chip in the interface circuit. Moreover, it is incompatible with TTL level, so a conversion circuit must be added if it is connected to a microcontroller circuit.

2. The signal lines used by the interface communicate with other devices in a common ground mode. This common ground mode transmission is prone to interference and has relatively weak anti-interference performance.

3. The transmission distance and speed are limited, and communication can only be carried out over a few tens of meters at most; communication can only be carried out between two points and cannot achieve multi-machine network communication.

To address the shortcomings of interfaces above RS232, new interface standards such as RS485 have emerged. RS485 has the following characteristics:

1. Logic "1" is represented by a voltage difference of +(2-6)V between the two lines; logic "0" is represented by a voltage difference of -(2-6)V between the two lines. The interface signal level is lower than that of RS232, which is less likely to damage the circuit chip, and this level is compatible with TTL level, which can be easily connected to TTL circuits.

2. RS485 communication is fast, with a maximum data transmission rate of over 10Mbps; its internal physical structure uses a combination of balanced driver and splitter receiver, which greatly increases its anti-interference capability.

3. The maximum transmission distance can reach about 1200 meters, but the transmission rate and transmission distance are inversely proportional. Only at a transmission rate of less than 100KB/s can the maximum communication distance be achieved. If a longer transmission distance is required, a repeater can be used.

4. It can be networked on the bus to realize multi-machine communication. Multiple transceivers can be connected on the bus. From the existing RS485 chips, there are drivers that can connect 32, 64, 128, 256 different devices.

RS485 has two-wire and four-wire versions. The four-wire version only supports point-to-point communication and is rarely used nowadays. The two-wire version uses a bus topology, allowing up to 32 nodes to be connected on the same bus. RS485 communication networks typically use a master-slave communication model, where one master device supports multiple slave devices.

In many cases, connecting an RS-485 communication link simply involves connecting the "A" and "B" terminals of each interface with a twisted pair of cables, neglecting the connection of the signal ground. While this method may work in many situations, it introduces significant hidden dangers for two reasons:

Common-mode interference: RS-485 interfaces use differential signal transmission, which does not require signal detection relative to a reference point; the system only needs to detect the potential difference between the two lines. However, people often overlook the fact that transceivers have a certain common-mode voltage range. The common-mode voltage range of RS-485 transceivers is -7 to +12V. Only when this condition is met can the entire network function normally. When the common-mode voltage in the network lines exceeds this range, it will affect the stability and reliability of communication, and may even damage the interface.

EMI issue: The common-mode portion of the output signal from the transmitting driver needs a return path. If there is no low-impedance return path (signal ground), it will return to the source in the form of radiation, and the entire bus will act like a giant antenna radiating electromagnetic waves outward.

Since PCs only have an RS232 interface by default, the following method can be used to obtain the RS485 circuit for the PC host computer:

1. Convert the PC serial port RS232 signal to RS485 signal using an RS232/RS485 conversion circuit. For complex industrial environments, it is best to choose a product with surge protection and isolation.

2. Through the PCI multi-serial port card, you can directly select an expansion card with an RS485 output signal.

Modbus communication protocol

The Modbus protocol is a universal language used in electronic controllers. Through this protocol, controllers can communicate with each other, and with other devices via networks (such as Ethernet). It has become a universal industry standard. With it, control devices from different manufacturers can be connected to form industrial networks for centralized monitoring.

This protocol defines a message structure that a controller can recognize and use, describes the process by which a controller requests access to other devices, how to respond to requests from other devices, and how to detect and log errors. It establishes a common format for message field structure and content.

Modbus has the following characteristics:

1. Standardized and open, the Modbus protocol can be used freely and safely by users without paying license fees or infringing on intellectual property rights. Currently, more than 400 manufacturers support Modbus, and more than 600 products support Modbus.

2. Modbus can support a variety of electrical interfaces, such as RS-232 and RS-485, and can transmit over various media, such as twisted pair, fiber optic, and wireless.

3. Modbus's frame format is simple, compact, and easy to understand. It is easy for users to use and simple for manufacturers to develop.

I. Description of Modbus Register Types

1—Coil Status: Output port. The output status of this port can be set, or the output status of this bit can be read.

2—Discrete Input State: Input port, whose input state can be changed by external settings; it is readable but not writable.

3—Holding Registers: Certain parameters set during controller operation; readable and writable.

4—Input Registers: These are registers containing parameters obtained from external devices during controller operation; they are readable but not writable.

II. Modbus Communication Data Format

Single write:

Multiple writes:

Read:

III. Brief Description of Modbus Function Codes

Function codes can be divided into bit operations and byte operations. The smallest unit of bit operations is a bit, and the smallest unit of byte operations is two bytes.

1-bit operation instructions: Read coil status 01H, Read discrete input status 02H, Write single coil 05H, Write multiple coils 0FH.

2-byte operation instructions: Read save register 03H, Read input register 04H, Write single save register 06H, Write multiple save registers 10H.

IV. Modbus function codes

Disclaimer: This article is a reprint. If there are any copyright issues, please contact us promptly for deletion (QQ: 2737591964). We apologize for any inconvenience.

Read next

CATDOLL 108CM Coco

Height: 108cm Weight: 14.5kg Shoulder Width: 26cm Bust/Waist/Hip: 51/47/59cm Oral Depth: 3-5cm Vaginal Depth: 3-13cm An...

Articles 2026-02-22