-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemperature sensor unformatted.txt
20 lines (20 loc) · 6.45 KB
/
temperature sensor unformatted.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Product parameters: Working voltage: DC4-30V (the highest should not exceed 33V) Maximum power: 0.2W Working temperature: temperature -20℃+60℃, humidity 0%RH-100%RH Control accuracy: temperature ±0.3℃(25℃), humidity ±3%RH(25℃) Output interface: RS485 communication (standard MODBUS protocol and custom common protocol), see protocol description for details Device address: 1-247 can be set, the default is 1 Baud rate: default 9600 (users can set by themselves), 8 data, 1 stop, no parity Size: 60*30*18
MODBUS protocol Function code used by the product: 0x03: Read holding register 0x04: Read input register 0x06: Write a single holding register 0x10: write multiple holding registers,Register type To Register address To Data content To Number of bytes Input register To 0x0001 To Temperature value To 2 0x0002 To Humidity value To 2 Holding register To 0x0101 To Device address (1~247) To 2 0x0102 To Baud rate 0:9600 1:14400 2:19200 To 2 0x0103 To Temperature correction value (/10) -10.0~10.0 To 2 0x0104 To Humidity correction value (/10) -10.0~10.0 To 2,
Modbus communication format: Host sends data frame: Slave address To function code To Register address High byte To Register address Low byte To Number of registers High byte To Number of registers Low byte To CRC High byte To CRC Low byte,
The slave responds to the data frame: Slave address To Response function code To Number of bytes To Register 1 data High byte To Register 1 data Low byte To Register N data High byte To Register N data Low byte To CRC High byte To CRC Low byte,MODBUS command frame The host reads the temperature command frame (0x04): Slave address To function code To Register address High byte To Register address Low byte To Number of registers High byte To Number of registers Low byte To CRC High byte To CRC Low byte 0x01 To 0x04 To 0x00 To 0x01 To 0x00 To 0x01 To 0x60 To 0x0a,
The slave responds to the data frame: Slave address To function code To Number of bytes To temperature High byte To temperature Low byte To CRC High byte To CRC Low byte 0x01 To 0x04 To 0x02 To 0x01 To 0x31 To 0x79 To 0x74,
Temperature value = 0x131, converted to decimal 305, actual temperature value = 305/10 = 30.5℃ Note: The temperature is a signed hexadecimal number, temperature value=0xFF33, converted to decimal -205, actual temperature = -20.5℃;
The host reads the humidity command frame (0x04): Slave address To function code To Register address High byte To Register address Low byte To Number of registers High byte To Number of registers Low byte To CRC High byte To CRC Low byte 0x01 To 0x04 To 0x00 To 0x02 To 0x00 To 0x01 To 0xC1 To 0xCA,
The slave responds to the data frame: Slave address To function code To Number of bytes To humidity High byte To humidity Low byte To CRC High byte To CRC Low byte 0x01 To 0x04 To 0x02 To 0x02 To 0x22 To 0xD1 To 0xBA,
Humidity value=0x222, converted to decimal 546, actual humidity value=546 / 10 = 54.6%;
Continuously read the temperature and humidity command frame (0x04): Slave address To function code To Register address High byte To Register address Low byte To Number of registers High byte To Number of registers Low byte To CRC High byte To CRC Low byte 0x01 To 0x04 To 0x00 To 0x01 To 0x00 To 0x02 To 0x20 To 0x0B,
The slave responds to the data frame: Slave address To function code To Number of bytes To temperature High byte To temperature Low byte To humidity High byte To humidity Low byte To CRC High byte To CRC Low byte 0x01 To 0x04 To 0x04 To 0x01 To 0x31 To 0x02 To 0x22 To 0x2A To 0xCE,
Read the content of the holding register (0x03): Take reading the slave address as an example: Slave address To function code To Register address High byte To Register address Low byte To Number of registers High byte To Number of registers Low byte To CRC High byte To CRC Low byte 0x01 To 0x03 To 0x01 To 0x01 To 0x00 To 0x01 To 0xD4 To 0x0F,
Slave response frame: Slave address To function code To Number of bytes To Slave address High byte To Slave address Low byte To CRC High byte To CRC Low byte 0x01 To 0x03 To 0x02 To 0x00 To 0x01 To 0x30 To 0x18,
Modify the content of the holding register (0x06): Take the modification of the slave address as an example: Slave address To function code To Register address High byte To Register address Low byte To Register value High byte To Register value Low byte To CRC High byte To CRC Low byte 0x01 To 0x06 To 0x01 To 0x01 To 0x00 To 0x08 To 0xD4 To 0x0F。
Modify slave address: 0x08 = 8 Slave response frame (same as sending): Slave address To function code To Register address High byte To Register address Low byte To Register value High byte To Register value Low byte To CRC High byte To CRC Low byte 0x01 To 0x06 To 0x01 To 0x01 To 0x00 To 0x08 To 0xD4 To 0x0F,
Continuously modify the holding register (0x10): Slave address To function code To initial address High byte To initial address Low byte To Number of registers High byte To Number of registers Low byte To Number of bytes To Register 1 high byte To Register 1 low byte To Register 2 high byte To Register 2 low byte To CRC High byte To CRC Low byte 0x01 To 0x06 To 0x01 To 0x01 To 0x00 To 0x02 To 0x04 To 0x00 To 0x20 To 0x25 To 0x80 To 0x25 To 0x09 Modify slave address: 0x20 = 32,Baud rate: 0x2580 = 9600,
Slave response frame: Slave address To function code To Register address High byte To Register address Low byte To Number of registers High byte To Number of registers Low byte To CRC High byte To CRC Low byte 0x01 To 0x06 To 0x00 To 0x11 To 0x00 To 0x04 To 0xD4 To 0x0F,
Normal version agreement The default baud rate is 9600 (users can set by themselves), 8 bits of data, 1 bit of stop, no parity RS485 communication,
Serial command To Description READ To Trigger a temperature and humidity report (27.4℃, 67.7% temperature 27.4℃ humidity 67.7%) AUTO To Start the automatic temperature and humidity report function (Same as above) STOP To Stop the automatic reporting of temperature and humidity BR:XXXX To Set the baud rate 9600~19200 (BR: 9600 baud rate is 9600) TC:XX.X To Set temperature calibration (-10.0~10.0) (TC:02.0 temperature correction value is 2.0℃) HC:XX.X To Set humidity calibration (-10.0~10.0) (HC:-05.1 Humidity correction value is -5.1%) HZ:XXX To Set the temperature and humidity report rate (0.5,1,2,5,10) (HZ: 2 automatic reporting rate 2Hz) PARAM To Read current system settings,
PARAM instruction: TC:0.0,HC:0.0,BR:9600,HZ:1 ->Temperature correction value 0.0 Humidity correction value 0.0 Baud rate 9600 Report rate 1Hz SLAVE_ADD:1 ->MODBUS slave address 0x01