Chengdu Ebyte Electronic Technology Co.,Ltd.
ME31-XAAX0440_UserManul_EN
Copyright ©2012–2021,Chengdu Ebyte Electronic Technology Co.,Ltd.
22
4.9.5 Modbus instruction operation instructions
(
1
)
Read the status of the coil (DO)
Use the read coil status (01) function code to read the output coil status, for example:
01
01
00 00
00 04
3D C9
Modbus address
Function Code
Register first
address
Number of output coils read
CRC checkcode
After sending the above command to the device via the RS485 bus, the device will return the following values:
01
01
01
01
90 48
Modbus address
Function Code
Number of bytes of
data
Status data returned
CRC checkcode
The status data 01 returned above indicates that the output DO1 is on.
(
2
)
Control coil (DO) status
Support operation of single coil (05), operation of multiple coils (0F) function code operation.
Use the 05 command to write a single command, for example:
01
05
00 00
FF 00
8C 3A
Modbus address
Function Code
Register first address
Conduction
:
FF 00
closure
:
00 00
CRC checkcode
After sending the above command to the device via the 485 bus, the device will return the following values:
01
05
00 00
FF 00
8C 3A
Modbus address
Function Code
Register first address
Operation method
CRC checkcode
The DO1 coil is turned on.
Use 0F function code to write multiple coil commands, for example:
01
0F
00 00
00 04
01
0F
7E 92
Modbus
address
Function
Code
initial address
Number of
coils
Number of
bytes of data
Control coil data
CRC
checkcode
After sending the above command to the device via the 485 bus, the device will return the following values:
01
0F
00 00
OO O4
54 08
Modbus address
Function Code
Register Address
Number of coils
CRC checkcode
The coils are all turned on.
(
3
)
Read the holding register