RS485 And Modbus Communication Protocol Tutorial
In the fields of industrial control, power communication, and smart instruments, serial communication is usually used for data exchange. The RS232 interface was initially adopted. Due to the complexity of the industrial site, various electrical equipment will generate more electromagnetic interference in the environment, which will lead to signal transmission errors.
In 1979, Schneider Electric developed a bus protocol Modbus protocol for industrial fields. Now, many of the RS485 communication occasions in the industry use the Modbus protocol, so today we will learn about the RS485 communication and the Modbus communication protocol.
RS485 communication
1. In fact, RS232 was born before RS485, but RS232 also has shortcomings:
1) The signal level of the interface is relatively high, reaching more than ten V, which is easy to damage the chip of the interface circuit, and is not compatible with the TTL level, so a conversion circuit must be added if it is connected with the single-chip circuit.
2) The signal line used by the interface forms the communication in the common ground mode with other devices. This common ground mode transmission is prone to interference, and the anti-interference performance is relatively weak.
3) The transmission distance and speed are limited and can only communicate at most tens of meters. It can only communicate between two points and cannot realize multi-machine networking communication.
2、In view of the shortcomings of the RS232 interface, new interface standards such as RS485 have emerged. RS485 has the following characteristics:
1) The logic "1" is represented by the voltage difference between the two lines as +(2-6)V; the logic "0" is represented by the voltage difference between the two lines as -(2-6)V. The interface signal level is lower than that of RS232, which is not easy to damage the chip of the circuit, and the level is compatible with the TTL level, which can be easily connected to the TTL circuit.
2) RS485 communication speed is fast, and the maximum data transmission rate is above 10Mbps. Its internal physical structure adopts a combination of balanced driver and check-point receiver, which greatly increases the anti-interference ability.
3) The maximum transmission distance can reach about 1200 meters, but the transmission rate and transmission distance are inversely proportional. Only the transmission rate below 100KB/s can achieve the maximum communication distance. If you need to transmit longer distances, you can use relays.
4) Multi-machine communication can be realized by networking on the bus, and multiple transceivers are allowed to be hung on the bus. From the perspective of the existing RS485 chip, there are drivers that can be connected to different devices such as 32, 64, 128, and 256.