Reference

Last revision 2025/12/17

This article provides an in-depth look at RS-485 and ModBus communication protocols, focusing on RS-485's long transmission distance, noise rejection, and differential transmission method, and ModBus's master/slave architecture, addressing structure, and command execution in industrial applications.

Communication Protocol Description

RS485

RS-485 is one of the typical serial communication standards.

And the RS-485 interface features good noise rejection, long transmission distance, multidrop capability, simple wiring, and other advantages, so it is widely used in industrial applications.

RS-485 communication protocol only defines transmission voltage, impedance and other electrical characteristics, but does not define the software protocol. It transmits data signals using differential transmission method, which makes it able to suppress common-mode interference. And the bus transceiver has high sensitivity and can detect voltages as low as 200mV. In addition, it's very convenient for users when using RS-485 for multi-point interconnection as it can save a lot of signal lines.
RS-485 uses a pair of twisted-pair cables often defined as A and B respectively. Generally, the positive level between the transmitting drivers A and B is +2 - +6V, which is a positive 1 logic state; the negative level is -2 - 6V, which is a negative 0 logic state. And it's transmission distance can reach up to about 1200 meters, and the transmission rate is inversely proportional to the distance. The highest rate can only be obtained at very short distance. To eliminate signal reflection from long-distance communication, RS-485 requires 2 terminal resistors, and their resistance values must be equal to the characteristic impedance(generally 120Ω) of the transmission cable. Meanwhile, the terminal resistor needs to be connected to the two ends of the transmission bus.

ModBus

The Modbus protocol is a master/slave architecture protocol. Except for the master node, all nodes that use Modbus protocol for communication are slave nodes. Each slave device has a unique RS-485 address, through which the device that executes a ModBus command can be recognized. When the master sends a command, all slave devices will receive it, but only the one with the same RS-485 address as in the command will execute and respond to it (address 0 is an exception, since the command to designate address 0 is a broadcast one, all devices that receive the command will run but not respond to it).

All Modbus commands include the check code used to ensure that the command sent by Master and received by Slave isn't damaged or lost. Basic Modbus commands can instruct an RTU to change a value in one of its registers, control or read an I/O port, and command the device to send back one or more data contained in its registers.

Modbus frame format: here we take the RS485 laser ranging sensor as an example.

Slave Address Function Code Register Address High-bit Register Address Low-bit Read Length High-bit Read Length Low-bit CRC High-bit CRC Low-bit
0x50 0x03 RegH RegL LenH LenL CRCH CRCL

Sensor address: 0x50 (default);

Read holding register: 0x03;

Address of register for measuring distance: 0x34;

Read length: 1 bit;

Holding register: The unit of the register is not a bit but two bytes, which means that it can store a specific amount of data that can be read and written. The distance data measured by the sensor is stored in this register.

Was this article helpful?

TOP