The usual Modbus communication protocol has two kinds, one is Modbus ASCII, one is Modbus RTU. Each device must have the same transfer mode. All devices support RTU mode, and ASCII transfer mode is an option. What is the difference between the ASCII mode and the RTU mode?
1. ASCII mode
When the controller is set to communicate in the Modbus network, add the link description on the ASCII (US standard Information Interchange Code) mode, each 8Bit in the message
Bytes are sent as two ASCII characters. The main advantage of this approach is that the character can be sent at a time interval of 1 seconds without generating an error.
Code system
Hexadecimal, ASCII character 0 ... 9,a ... F
Each ASCII character in the message is made up of a hexadecimal character
Bits per byte
1 Starting Bits
7 data bits, the smallest significant bit is sent first
1 parity bits, no checksum
1 stop bit (with checksum), 2 bit (no calibration)
Error detection Domain
LRC (longitudinal lengthy inspection)
2. RTU mode
When the controller is set to communicate in RTU (remote terminal Unit) mode on the Modbus network, each 8Bit byte in the message contains two
A hexadecimal character of 4Bit. The main advantage of this approach is that, at the same baud rate, more data can be transmitted than the ASCII method.
Code system
8-bit binary, hexadecimal number 0 ... 9,a ... F
Each 8-bit field in the message is made up of two hexadecimal characters
Bits per byte
1 Starting Bits
8 data bits, the smallest significant bit is sent first
1 parity bits, no checksum
1 stop bit (with checksum), 2 bit (no calibration)
Error detection Domain
CRC (cyclic verbose detection)
Modbus ASCII protocol and RTU protocol, compared to the Modbus protocol has a start and end tag, and Modbus RTU is not, so the ASCII protocol in the program to the processing of data packets more convenient.
The data domain of the MODBUS ASCII protocol transmits all the visible ASCII characters, so it becomes more intuitive during the debugging phase, and the LRC verification program is also relatively easy to write, which is the advantage of Modbus ASCII.
The main disadvantage of MODBUS ASCII is low transmission efficiency, because it transmits all the visible ASCII characters, the original data transmitted with the RTU every byte, ascii words are to divide this byte two bytes, for example, RTU transmits a hexadecimal number 0xf9, ASCII will need to transmit the characters ' F ' and the character ' 9 ', the corresponding ASCII code 0x46 and 0x39 two bytes, so that its transmission efficiency is certainly lower than the RTU.
So in general, if the amount of data that needs to be transmitted is small, consider using the ASCII protocol, if the amount of data to be transferred is larger, it is best to use the RTU protocol.
In addition, since the ASCII protocol has a start flag and an end flag, the transmission interval between each byte of a packet can be greater than 1 seconds, while the Modbus RTU mode, because there is no specified start and end tag, So the protocol specifies that the time interval between two bytes sent or received cannot exceed 3.5 times times the character transfer time. If the two-character time interval exceeds 3.5 times times the character transfer time, it is considered that a frame of data has been received, a new frame of transmission began, so the rtu mode of two bytes between the transmission interval has time requirements.
This distinction between MODBUS's two protocols for ASCII and RTU may determine that only one of these protocols can be selected in certain applications
Modbus difference between two modes of transmission of ASCII mode and RTU mode