Embedded communication protocol [Modbus] frame format of modbus RTU

Modbus frame format

device address function code Data Format CRC check L CRC check H
8bit 8bit N*8bit 8bit 8bit

1 The host writes data to a single register of the slave (0x06)

slave address function code Data format (data address) data format (data) CRC check L CRC check H
01 06 00 01 00 17 98 04

If the address of the slave is 01, then the slave receives the string of data, and checks whether the data is correct according to CRC16. If the data is correct, it changes the value of its own register. Then the slave returns this sentence intact, telling the master that the communication is successful! ! !

In terms of communication process

For the host, after sending 01 06 00 04 00 07 89 C9, it receives 01 06 00 04 00 07 89 C9;

For the slave, after receiving 01 06 00 04 00 07 89 C9, it sends 01 06 00 04 00 07 89 C9.

2 The master reads data from the slave (0x03)

slave address function code Data format (data address) data format&#x

Guess you like

Origin blog.csdn.net/qq_43445867/article/details/130694220