EasyManua.ls Logo

Nooploop TOFSense-F - Protocol Frame Examples

Nooploop TOFSense-F
16 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Protocol Unpack
Copyright © Nooploop LTd 2023. All Rights Reserved.
9
the method of left shift and then divide by 256. For example, for position data, we use int24 to
represent it, and the multiplier is 1000. The parsing code is as follows:
uint8_t byte[] = {0xe6,0x0e,0x00};//Decimal value: 3.814
//uint8_t byte[] = {0xec,0xfb,0xff};//Decimal value: -1.044
int32_t temp = (int32_t)(byte[0] << 8 | byte[1] << 16 | byte[2] << 24) / 256;
float result = temp/1000.0f;
Currently, the protocol verification is mainly based on the single-byte checksum at the end of the
protocol frame. Example code:
uint8_t verifyCheckSum(uint8_t *data, int32_t length){
uint8_t sum = 0;
for(int32_t i=0;i<length-1;++i){
sum += data[i];
}
return sum == data[length-1];
}
7.2 Example
The document assumes a single module continuous ranging scenario.
7.2.1 NLink_TOFSense_Frame0
Data source: Connect the module to the host computer, configure UART as active output mode,
using NLink_TOFSense_Frame0 protocol. For parsing distance data, please refer to the FAQ.
Raw data: 57 00 ff 00 9e 8f 00 00 ad 08 00 00 03 00 06 41
Table 1: NLink_TOFSense_Frame0 Parsing table
Data
Type
Length (Bytes)
Hex
Result
Frame Header
uint8
1
57
0x57
Function Mark
uint8
1
00
0x00
reserved
uint8
1
*
id
uint8
1
00
0
System_time
uint32
4
9e 8f 00 00
36766ms
dis*1000
uint24
3
ad 08 00
2.221m
dis_status
uint8
1
00
0
signal_strength
uint16
2
03 00
3
range_precision
uint8
1
06
6cm
Sum Check
uint8
1
41
0x41
7.2.2 NLink_TOFSense_Read_Frame0
Data source: Connect the module to the host computer, configure it as UART query output mode
with ID set to 0. To query data, send the following bytes from the host computer. If you need to query
modules with different IDs, simply change the ID and checksum bytes accordingly.
Raw data: 57 10 FF FF 00 FF FF 63