ModBus协议-功能码-0x04

04 (0x04) Read Input Registers

This function code is used to read from 1 to 125 contiguous input registers in a remote device.The Request PDU specifies the starting register address and the number of registers. In the PDU Registers are addressed starting at zero. Therefore input registers numbered 1-16 are
addressed as 0-15.The register data in the response message are packed as two bytes per register, with the binary contents right justified within each byte. For each register, the first byte contains the high order bits and the second contains the low order bits.

ModBus协议-功能码-0x04_第1张图片


The contents of input register 9 are shown as the two byte values of 00 0A hex, or 10 decimal.



Tx:01 04 00 08 00 01
Rx:01 04 02 00 0A

Tx分析
01 从机地址
04 功能码
00 08 起始地址
00 01 输入寄存器数量
Rx分析
01 从机地址
04 功能码
02 字节数
00 0A 输入寄存器

0x08 = 0
0x01 = 1
[9] 00 0A



ModBus协议-功能码-0x04_第2张图片

你可能感兴趣的:(ModBus协议)