In the fields of industrial control, power communication, smart instrumentation, etc., we often see or hear “RS-485” and “Modbus” appearing together, but do you really know what the two are and what is the connection?
RS-485 and Modbus protocol #
RS-485 is actually a physical interface, equivalent to hardware; Modbus is an international standard communication protocol used to exchange data between different devices. The so-called Modbus communication protocol is like our human language, equivalent to software .
The two devices transmit data through the Modbus communication protocol. At the beginning, RS-232C was used as the hardware interface. However, in industrial production, the devices are often distributed in long distances and different orientations, while RS-485 is used for multi-point It is very convenient to interconnect and can save many signal lines, so it has gradually become a commonly used interface standard in the industrial field.
RS-485 is the standard interface of the physical communication layer and a signal transmission method. It has the advantages of fast transmission speed, long distance, strong anti-interference ability, and the ability to connect multiple devices:
1. Using differential signal positive logic, logic “1” is represented by the voltage difference between the two lines as +(2~6)V; logic “0” is represented by the voltage difference between the two lines as -(2~6)V. The interface signal level is reduced, and the chip of the interface circuit is not easily damaged. It is compatible with the TTL level and can be easily connected with the TTL circuit.
2. The RS-485 communication speed is fast, and the higher data transmission rate is 10Mbps, and the RS-485 interface adopts a combination of a balanced driver and a differential receiver, and the anti-common mode interference ability is enhanced.
3. The transmission rate of RS-485 is inversely proportional to the transmission distance. The lower the transmission rate, the longer the transmission distance. The RS-485 bus generally supports up to 32 nodes. If a special 485 chip is used, it can reach 128 or 256 nodes for networking communication.
However, as a hardware layer protocol, RS-485 only defines the logic of 0 and 1 without explaining its meaning. At this time, a software layer protocol needs to be used. Modbus is used to explain the meaning of these 0101 codes. Only when the codes are sent according to the Modbus protocol, can different devices communicate clearly.
Modbus communication protocol is a common language applied to electronic controllers. Through this protocol, communication between controllers and controllers and between controllers and devices can be carried out. It has become a general industrial standard, through which control equipment produced by different manufacturers can also be connected into an industrial network for centralized monitoring.
This protocol defines an information structure that a controller can recognize and use, describes the process of a controller requesting access to other devices, how to respond to requests from other devices, and how to detect and log errors.
Modbus can be implemented through the following three communication methods: #
1. Ethernet mode: the corresponding transmission mode is Modbus TCP, and the communication medium includes Category 5/Category 6 network cable or optical fiber;
2. Asynchronous serial port mode: the corresponding transmission mode is Modbus RTU, ASCII, and various communication media include wired RS-232/422/485, optical fiber, wireless, etc.;
3. High-speed token passing mode: the corresponding transmission mode is Modbus PLUS, and the communication medium includes twisted pair, coaxial cable, etc.
In industrial production, different devices are connected in series through RS-485 to form a network of connected objects, and then rely on the Modbus protocol to access the network. Each device is interconnected to achieve centralized monitoring and decentralized control of the system, and promote industrial automation. development of.