Datasheet
- 13 -
Sensor response message format returned:
Numerical calculation:
From the temperature and humidity sensor value is read back, as long as the value into decimal
number 10 is divided by the corresponding values of temperature and humidity, corresponding
temperature unit
℃
, humidity unit is% RH. Such as the above data read back:
Humidity: 01F4 = 1
×
256+15
×
16+4 =500 => humidity = 500
÷
10=50.0%RH;
Temperature: 00FA= 15
×
16+10 = 250 => temperature = 250
÷
10 = 25.0
℃
Note: CRC
verification code calculated by the CRC code drawn, then the sensor on the transmission of CRC
codes ratio; same, then that data is received correctly, otherwise that data has errors.
2. Function code "10": Write multiple registers to sensor
Host code can use this feature to save multiple data storage sensor. Single AM2320 sensor
register is a byte, or 8 bits. Sensor allows you to save a maximum of 10 data registers. Thus, the
single most host to the sensor to save up to 10 registers. Over 10, the sensor will return the
corresponding error code.
The host sends the write frame format:
START + (I
2
C address + W) + function code (0x10) + start address register number + save data
+ CRC + STOP
The host reads the confirmation instruction:
START + (I
2
C address + R) + read sensor data returned + STOP
Sensor response frame format:
Function code (0x10) + start address + number + CRC register
For example: The host should be saved to address 10,11 ,01,02 sensors to register.
Host message format sent:
The host sends
Byte count
Transmitting information
Remarks
Sensor address
1
0XB8
Sensor C address (0xB8) + W (0)
Function Code
1
0x10
Write Multiple Registers
Starting address
1
0x10
Start address of the register to be written
Sensor address
1
0xB8
Sensor C address (0xB8) + W (0)
Function Code
1
0x03
Read register
Starting address
1
0x00
Register start address is 0x00
Number of registers
1
0x04
Read the number of register
Slave response
Byte count
Transmitting information
Remarks
Function Code
1
0x03
Read register
Returns the number of bytes
1
0x04
Returns 4 of 4 byte register
Register 1
1
0x01
Address for the content of 0x00 (high humidity bytes)
Register 2
1
0XF4
Address for the content of 0x01 (low humidity bytes)
Register 3
1
0x00
Address for the content of 0x01 (low humidity bytes)
Register 4
1
0XFA
Address for the content 0x03 (temperature low byte)
CRC code
2
31A5
Sensors calculate the CRC code returned, low byte first;