Cygbot CygLiDAR D1 Руководство пользователя - Страница 7
Просмотреть онлайн или скачать pdf Руководство пользователя для Измерительные приборы Cygbot CygLiDAR D1. Cygbot CygLiDAR D1 20 страниц.

6. Serial Communication
UART
Data Bit
Parity
Stop Bit
Baud Rate
PINMAP
VCC
Rx
Tx
GND
GPIO
Packet structure
Packet
Header1
Header2
Header3
1 byte
1 byte
Header : Three fixed values assigned to every valid dataset, consisting of 0x5A, 0x77 and 0xFF.
Payload Length : Payload size in byte.
Payload Header : A unique value for a clarification of the device version.
Payload Data : A set of the significant bits of the pixel component data.
Checksum : The result of XOR of all values only except Headers from 1 to 3.
Checksum
Checksum is the last byte of a frame that is only used for an integrity check.
#define PAYLOAD_LENGTH_LSB_INDEX 3
uint8_t CalcChecksum(uint8_t *buff, int buffSize)
{
uint8_t CheckSum = 0;
for(int i = PAYLOAD_LENGTH_LSB_INDEX; i < buffSize – 1; i++)
{
CheckSum ^= buff[i];
}
return CheckSum;
}
: 8 bit
: none
: 1 bit
: 3,000,000 bps
: +5V
: UART TTL Rx
: UART TTL Tx
: GND
: Reserved
Payload
Payload
Length
Length
LSB
MSB
1 byte
1 byte
1 byte
Payload
Payload
Payload
Payload
Header
Data 0
Data 1
1 byte
7
...
Payload
Data n
n byte
Ver 0.2.2
Packet
Checksum
1 byte