当前位置:首页 > 01 Modbus Data Struture
Read Input Registers (FC=04)
Request
This command is requesting the content of analog input register # 30009 from the slave device with address 17. 11 04 0008 0001 B298
11: The Slave Address (17 = 11 hex)
04: The Function Code (read Analog Input Registers)
0008: The Data Address of the first register requested. (30009-30001 = 8) 0001: The total number of registers requested. (read 1 register) B298: The CRC (cyclic redundancy check) for error checking. Response
11 04 02 000A F8F4
11: The Slave Address (17 = 11 hex)
04: The Function Code (read Analog Input Registers)
02: The number of data bytes to follow (1 registers x 2 bytes each = 2 bytes) 000A: The contents of register 30009
F8F4: The CRC (cyclic redundancy check).
4 | Page
Force Single Coil (FC=05)
Request
This command is writing the contents of discrete coil # 173 to ON in the slave device with address 17. 11 05 00AC FF00 4E8B
11: The Slave Address (17 = 11 hex)
05: The Function Code (Force Single Coil)
00AC: The Data Address of the coil. (coil# 173 - 1 = 172 = AC hex) FF00: The status to write ( FF00 = ON, 0000 = OFF )
4E8B: The CRC (cyclic redundancy check) for error checking. Response
The normal response is an echo of the query, returned after the coil has been written. 11 05 00AC FF00 4E8B
11: The Slave Address (17 = 11 hex)
05: The Function Code (Force Single Coil)
00AC: The Data Address of the coil. (coil# 173 - 1 = 172 = AC hex) FF00: The status written ( FF00 = ON, 0000 = OFF )
4E8B: The CRC (cyclic redundancy check) for error checking.
5 | Page
Preset Single Register (FC=06)
Request
This command is writing the contents of analog output holding register # 40002 to the slave device with address 17. 11 06 0001 0003 9A9B
11: The Slave Address (17 = 11 hex)
06: The Function Code (Preset Single Register)
0001: The Data Address of the register. (# 40002 - 40001 = 1 ) 0003: The value to write
9A9B: The CRC (cyclic redundancy check) for error checking. Response
The normal response is an echo of the query, returned after the register contents have been written.
11 06 0001 0003 9A9B
11: The Slave Address (17 = 11 hex)
06: The Function Code (Preset Single Register)
0001: The Data Address of the register. (# 40002 - 40001 = 1 ) 0003: The value written
9A9B: The CRC (cyclic redundancy check) for error checking.
6 | Page
Force Multiple Coils (FC=15)
Request
This command is writing the contents of a series of 10 discrete coils from #20 to #29 to the slave device with address 17. 11 0F 0013 000A 02 CD01 BF0B
11: The Slave Address (17 = 11 hex)
0F: The Function Code (Force Multiple Coil, 15 = 0F hex)
0013: The Data Address of the first coil. (coil# 20 - 1 = 19 = 13 hex) 000A: The number of coils to written (10 = 0A hex)
02: The number of data bytes to follow (10 Coils / 8 bits per byte = 2 bytes) CD: Coils 27 - 20 (1100 1101)
01: 6 space holders & Coils 29 - 28 (0000 0001)
BF0B: The CRC (cyclic redundancy check) for error checking.
The more significant bits contain the higher coil variables. This shows that coil 20 is on (1) and 21 is off (0). Due to the number of coils requested, the last data field01 contains the status of only 2 coils. The unused bits in the last data byte are filled in with zeroes. Response
11 0F 0013 000A 2699
11: The Slave Address (17 = 11 hex)
0F: The Function Code (Force Multiple Coil, 15 = 0F hex)
0013: The Data Address of the first coil. (coil# 20 - 1 = 19 = 13 hex) 000A: The number of coils to written (10 = 0A hex)
2699: The CRC (cyclic redundancy check) for error checking.
7 | Page
共分享92篇相关文档