MODBUS protocol
The product uses the function code:
0x03: Read Holding Registers.
0x04: Read Input Registers.
0x06: Single Relay Holding Register
0x10: Write multiple Hold Registers.
register type
|
register address
|
content information
|
number of bytes
|
input register
|
0x0001
|
temperature value
|
2
|
0x0002
|
moisture value
|
2
|
catch registration
|
0x0101
|
device address
( 1 ~ 247 (Chinese) )
|
2
|
0x0102
|
Baud Rate
0:9600
1:14400
2:19200
|
2
|
0x0103
|
Temperature correction (/10)
-10.0-10.0
|
2
|
0x0104
|
Humidity Corrected Value (/10)
-10.0-10.0
|
2
|
Modbus communication format :
The host sends the frame data:
address slave
|
code function
|
register address
High Byte
|
register address
low bytes
|
Number of Registers
High Byte
|
Number of Registers
low bytes
|
CRC
High Byte
|
CRC
low bytes
|
|
|
|
|
|
|
|
|
Slave response data frame:
address slave
|
In Response to function code
|
number of bytes
|
Register 1 information
High Byte
|
Register 1 information
low bytes
|
Register N data
High Byte
|
Register N data
low bytes
|
CRC
High Byte
|
CRC
low bytes
|
|
|
|
|
|
|
|
|
|
The MODBUS the Command frame
HOST Read Temperature Command Frame (0x04) :
address slave
|
code function
|
register address
High Byte
|
register address
low bytes
|
Number of Registers
High Byte
|
Number of Registers
low bytes
|
CRC
High Byte
|
CRC
low bytes
|
0x01
|
0x04
|
0x00
|
0x01
|
0x00
|
0x01
|
0x60
|
0x0a
|
Slave response data frame:
address slave
|
code function
|
number of bytes
|
temperature
High Byte
|
temperature
low bytes
|
CRC
High Byte
|
CRC
low bytes
|
0x01
|
0x04
|
0x02
|
0x01
|
0x31
|
0x79
|
0x74
|
Temperature value = 0x131, TO decimal conversion 305, the actual temperature value = 305/10 = 30.5 ℃.
Note: temperature marked 16 decimal, temperature value = 0 xFF33, to decimal conversion -205, the actual temperature = -20.5 ℃;
HOST Read Humidity Command Frame (0x04) :
address slave
|
code function
|
register address
High Byte
|
register address
low bytes
|
Number of Registers
High Byte
|
Number of Registers
low bytes
|
CRC
High Byte
|
CRC
low bytes
|
0x01
|
0x04
|
0x00
|
0x02
|
0x00
|
0x01
|
0xC1
|
0xCA
|
Slave response data frame:
address slave
|
code function
|
number of bytes
|
moisture
High Byte
|
moisture
low bytes
|
CRC
High Byte
|
CRC
low bytes
|
0x01
|
0x04
|
0x02
|
0x02
|
0x22
|
0xD1
|
0xBA
|
humidity value = 0x222, TO decimal conversion 546, actual humidity value = 546 / 10 = 54.6% ;
Continuously read temperature and humidity Command Frame (0x04) :
address slave
|
code function
|
register address
High Byte
|
register address
low bytes
|
Number of Registers
High Byte
|
Number of Registers
low bytes
|
CRC
High Byte
|
CRC
low bytes
|
0x01
|
0x04
|
0x00
|
0x01
|
0x00
|
0x02
|
0x20
|
0x0B
|
Slave response data frame:
address slave
|
code function
|
number of bytes
|
temperature
High Byte
|
temperature
low bytes
|
moisture
High Byte
|
moisture
low bytes
|
CRC
High Byte
|
CRC
low bytes
|
0x01
|
0x04
|
0x04
|
0x01
|
0x31
|
0x02
|
0x22
|
0x2A
|
0xCE
|
Read the contents of the Maintenance register (0x03) :
Use to read the slave address AS, for example:
address slave
|
code function
|
register address
High Byte
|
register address
low bytes
|
Number of Registers
High Byte
|
Number of Registers
low bytes
|
CRC
High Byte
|
CRC
low bytes
|
0x01
|
0x03
|
0x01
|
0x01
|
0x00
|
0x01
|
0xD4
|
0x0F
|
Slave response frame:
address slave
|
code function
|
number of bytes
|
address slave
High Byte
|
address slave
low bytes
|
CRC
High Byte
|
CRC
low bytes
|
0x01
|
0x03
|
0x02
|
0x00
|
0x01
|
0x30
|
0x18
|
Modify registration maintenance content (0x06) :
Use the slave address modifier AS, for example:
address slave
|
code function
|
register address
High Byte
|
register address
low bytes
|
The Register Value
High Byte
|
The Register Value
low bytes
|
CRC
High Byte
|
CRC
low bytes
|
0x01
|
0x06
|
0x01
|
0x01
|
0x00
|
0x08
|
0xD4
|
0x0F
|
Modify Slave Address : 0x08 = 8
The slave responds to the framework ( and sends the same ) :
address slave
|
code function
|
register address
High Byte
|
register address
low bytes
|
The Register Value
High Byte
|
The Register Value
low bytes
|
CRC
High Byte
|
CRC
low bytes
|
0x01
|
0x06
|
0x01
|
0x01
|
0x00
|
0x08
|
0xD4
|
0x0F
|
Continuously Modify Holding Register (0x10) :
address slave
|
code function
|
start address
High Byte
|
start address
low bytes
|
Number of Registers
High Byte
|
Number of Registers
low bytes
|
number of bytes
|
Register 1 High Byte
|
Register 1 low byte
|
Register 2 High Byte
|
Register 2 low bytes
|
CRC
High Byte
|
CRC
low bytes
|
0x01
|
0x06
|
0x01
|
0x01
|
0x00
|
0x02
|
0x04
|
0x00
|
0x20
|
0x25
|
0x80
|
0x25
|
0x09
|
Modify Slave Address : 0x20 = 32
Baud Rate : 0x2580 = 9600
Slave response frame:
address slave
|
code function
|
register address
High Byte
|
register address
low bytes
|
Number of Registers
High Byte
|
Number of Registers
low bytes
|
CRC
High Byte
|
CRC
low bytes
|
0x01
|
0x06
|
0x00
|
0x11
|
0x00
|
0x04
|
0xD4
|
0x0F
|
Conventional protocol version
Baud rate default 9600 (user can set by themselves), 8 bit, 1 bit, authentication
RS485Communication
Serial command
|
nature
|
read
|
Trigger temperature and humidity report
(27.4 ℃ 67.7% temperature 27.4 ℃ humidity 67.7%)
|
automatic
|
Auto start report temperature and humidity function
( Ditto )
|
stop
|
Auto stop temperature and humidity reporting function
|
BR:XXXX
|
Set Baud Rate
from 9600 to 19200
(BR:9600 Baud Rate 9600)
|
TC:X XX
|
set temperature correction
(-10.0 ~ 10.0)
(TC:02.0 temperature correction 2.0 ℃ )
|
HC:X XX
|
Calibration humidity setting
(-10.0 ~ 10.0)
(HC:-05.1 humidity correction value -5.1 %)
|
HZ:XXX
|
Set temperature and humidity report rate
(0.5,1,2,5,10)
(HZ:2 does not only automatically report Rate 2)
|
PARAM
|
Read current system settings
|
PARAM Recommendations :
TC:0.0,HC:0.0,BR:9600 HZ:1 -> Temperature Correction 0.0 Humidity Correction Value 0.0 Baud Rate 9600 Report Rate 1Hz
SLAVE_ADD:1 -> MODBUS slave address 0x01