Modbus is a simple, reliable, and open communication protocol commonly used in industry, which can be implemented on various communication media, including common RS232, RS485, and Ethernet. With the wide application of Modbus TCP, the Internet Organization has specified and reserved the 502 port of the system on the TCP/IP protocol stack, which is specially used to access Modbus devices.
The following figure roughly illustrates Modbus Protocol Stack Model.

Modbus Communication protocols currently exist for serial links, TCP/IP Ethernet and other network versions supporting Internet protocol. in application, Through RS485 and TCP/IP The most common way of connection. Below is an introduction Modbus Multiple variants of the protocol.
Modbus RTU
Modbus RTU is Modbus The most common implementation method, It is based on a serial communication bus (for example RS232, RS485) , And adopt a compact binary data format for protocol communication. RTU The format includes a checksum with cyclic redundancy check after the command/data as an error checking mechanism, To ensure the reliability of data. Modbus RTU Messages must be transmitted continuously, No hesitation between characters. Modbus Message from Idle (Silence) Time period composition (separate) .

RTU Pattern per byte (11Position)The format is:
| frame format | Instructions |
|---|---|
| coding system | 8Bit binary |
| data bit | 1Starting position 8Number of digits, First, send the least significant bit 1Bit parity check(Note:Default even check is mandatory, Odd or no verification can also be used) 1Stop position(Note:Require 2 stop bits when using no verification) |
| Frame transmission method | Each character or byte is sent in left to right order |
| inspection | CRC (Cyclic redundancy check) , Low byte first send |
| Start/End | The duration of the message frame should be at least 3.5 Differentiation of Idle Interval by Byte Time 1 Frame data |
Modbus ASCII
Modbus ASCII and Modbus RTU Both use serial link communication method, What differs is, Modbus ASCII Adopting a human readable approach, Verbose representation, And use the checksum of vertical redundancy check to ensure the integrity of data transmission. Modbus ASCII The message is preceded by a colon (":") And trailing line breaks (CR/LF) Constitute.

ASCII Pattern per byte (10Position)The format is:
| frame format | Instructions |
|---|---|
| coding system | hexadecimal, ASCII character 0-9, A-F |
| data bit | 1Starting position 7Number of digits, First, send the least significant bit 1Bit parity check(Note:Default even check is mandatory, Odd or no verification can also be used) 1Stop position(Note:Require 2 stop bits when using no verification) |
| Frame transmission method | Each character or byte is sent in left to right order |
| inspection | LRC (Vertical redundancy check) , Low byte first send |
| start | one‘colon’ (:) start, correspond to ASCII Hexadecimal is 3A |
| End | with‘Enter - Line Break’ (CR, LF)Yes, that's right(ASCII hexadecimal 0D and 0A) End |
It should be noted that, Due to different frame formats, Configured as RTU Nodes in the pattern cannot be configured with ASCII Normal communication between nodes in the mode, vice versa.
Modbus TCP
Modbus TCP (Also known as Modbus TCP/IP) is a kind of Modbus variant, Used to pass through TCP/IP Network communication, Through port 502 Connect now. Different from the previous two types, Modbus TCP No need for checksum calculation, Because of the lower layers TCP/IP The protocol stack has provided checksum protection.
If the checksum is included in the payload, Formation and Modbus RTU Similar frames, It is called Modbus RTU/IP.

Other versions
In addition to the three commonly used ones mentioned above Modbus agreement, There are also some less common ones as follows Modbus Extended Edition.
Modbus over UDP
Since there is Modbus over TCP, So naturally, some people will also try to Modbus Running on UDP aboveThat is Modbus over UDP. The advantage of doing this is that it eliminates TCP Required expenses.
Modbus Plus
Modbus Plus (Modbus+, MB+ or MBP) Protocol is Schneider Electric The patent, Different from other variants, It supports point-to-point communication between multiple master stations. but, It requires a dedicated coprocessor to handle similar tasks HDLC The high-speed token rotation. It uses 1 Mbit/s Twisted pair cables, And there is transformer isolation at each node, This makes it a transition/edge trigger rather than a voltage/level trigger. Connect Modbus Plus Computers require special hardware, Usually supporting ISA, PCI or PCMCIA Bus board.
Pemex Modbus
Pemex Modbus It's standard Modbus The Expansion, Support historical and traffic data. It is for Pemex Designed by oil and gas companies, Used for process control, But it has never been widely adopted.
Enron Modbus
Enron Modbus is Enron The standards developed by the company Modbus Another extension of, Support 32 Integer and floating-point variables, as well as historical and traffic data. Use standard address mapping for data types. Historical data is used to meet the requirements of the American Petroleum Institute (API) industry standard, How to store data.
Precautions
The first four types Modbus agreement (Modbus RTU, Modbus ASCII, Modbus TCP and Modbus UDP) It is the same in terms of data model and function calling, It's just that the encapsulation method for transmitting messages is different. but, Due to different frame formats, Therefore, these protocol variants are not interoperable.
Leave a Reply