10
6 Data parsing examples
Take Message ID as the target output information (Target Info) as an example, there is a frame
of the Target Info data message as follows:
Target Info Data:
0xAA 0xAA
0x0C 0x07
0x01 0xC8 0x07 0xD0 0x00 0x02 0xEE 0x90
0x55 0x55
Description:
Start Sequence
Message ID
Data Payload
End Sequence
Interpretation
:
Start Sequence = 0xAAAA
Message ID = 0x0C + 0x07*0x100 = 0x70C
Data Payload = 0x01 0xC8 0x07 0xD0 0x00 0x02 0xEE 0x90
End Sequence = 0x5555
Each field of Data Payload is parsed as following
:
Index
= 1
Rcs
= 0xC8*0.5 – 50 = 50
Range
= (0x07*0x100 +0xD0)*0.01 = 20
Rsvd1
= 0
RollCount = (0x0 & 0xE0) >> 5 = 0
Check sum = 0x90
//
The sum of lower eight bits of first
seven bytes: 0x90 = 0xFF&0x290;
//
0x290=0x01+0xC8+0x07+0xD0 +0x00+0x02 +0xEE
Note:
The user needs to program to parse the sensor output data
(hexadecimal).
The data before being parsed is hexadecimal, and is decimal after
being parsed. 0x2AF5 hexadecimal is converted to decimal:
10997 = 5 * 16 ^ 0 + F * 16 ^ 1 + A * 16 ^ 2 + 2 * 16 ^ 3