Datasheet

AF5485 User Manual
- 7 -
TEL020-89851175 / 89850036 www.aosong.com v1.0-20170726
The following table is an example of returning a set of temperature and humidity data: 01 03
04 01 D7 00 D6 CA 69
Slave response
Byte
number
Message
Remarks
Slave Address
1
01
Slave that send to address 01
Function Code
1
03
Read the register
Return Byte Number
1
04
Returned 4 registers, total 4 bytes
Register 0 High Byte
1
01
Contents of address 0x00 (humidity high byte)
Register 0 Low Byte
1
D7
Contents of address 0x00 (humidity low byte)
Register 1 High Byte
1
00
Contents of address 0x00 (temperature high byte)
Register 1 Low Byte
1
D6
Contents of address 0x00 (temperature low byte)
CRC Code
2
CA69
The returned CRC calculated by the slave, the low
byte first(CA)
@ Temperature and humidity output format and calculation
Examples for temperature and humidity output format and calculation:
The temperature and humidity resolution are 16-bit. The temperature and humidity are
printed in the actual positive or negative format, and the numerical value is 10 times the
actual temperature and humidity value.
Humidity: 01D7 = 1x256+13x16+4 =471 = > Humidity = 471÷10=47.1%RH
Temperature: 00D6 = 13x16+6 = 214 = > Temperature = 214÷10 = 21.4
Calculation of CRC Codes
1. Preset 1 16-bit register is hexadecimal FFFF (all 1); this register is called the CRC
register;
2The first 8-bit binary data (the first byte of the communication information frame) is
different from the lower 8 bits of the 16-bit CRC register, and the result is placed in the CRC
register;
3Move the contents of the CRC register one bit to the right (towards the low) to fill the most
significant bit with 0 and check the shifted bit;
4If the shift bit is 0: repeat step 3 ( right shift one bit again); if the shift bit is 1: The CRC
register is xor with the polynomial A001 (1010 0000 0000 0001) ;
5Repeat steps 3 and 4 until you move 8 times, so that the entire 8-bit data is processed;