
SmartOne Manual Rev 1.5 DOC# 9100-0268-01 p.67
Total length range permitted: 5 bytes (Data field length 0) to 59 bytes (Data field length 54).
Serial Packet Format
The different fields are defined as:
Serial Packet Fields
Preamble
Fixed pattern 0xAA
Length
Total number of bytes in the serial packet including the preamble
Cmd
Command type (See table below). Responses to commands carry the
same command type as the command that initiated the answer
Data
Data associated with the command or answer
CRC low
Least significant byte of the 16-bit CRC
CRC high
Most significant byte of the 16-bit CRC
CRC Algorithm
The Security Field is a 16-bit CRC of all of the previous fields including the preamble, length, and command bytes.
The remainder is initialized to all 1's (0xFFFF) and the CRC is inverted before being sent. Following is a sample C
routine that implements the algorithm using the "reversed" technique:
WORD crc16_lsb(BYTE *pData, WORD length)
{
BYTE i;
WORD data, crc;
crc = 0xFFFF;
if (length == 0)
return 0;
do
{
data = (WORD)0x00FF & *pData++;
crc = crc ^ data;
for (i = 8; i > 0; i--)
{
if (crc & 0x0001)
crc = (crc >> 1) ^ 0x8408;
else
crc >>= 1;
}
}
while (--length);
crc = ~crc;
return (crc);
}
As an example, for a type (0x01) “Get ID” message made up of the following bytes:
AA 05 01
The following 2 byte CRC would be calculated:
D5 50
The complete message sent by the host to the
SMART
ONE is:
AA 05 01 50 D5
Содержание SmartOne Series
Страница 1: ...User Manual Models Included SmartOneA SmartOneB SmartOneBLP Revision 1 5...
Страница 26: ...SmartOne Manual Rev 1 5 DOC 9100 0268 01 p 26 the times in the Location Message Tab...
Страница 81: ...SmartOne Manual Rev 1 5 DOC 9100 0268 01 p 81...
Страница 82: ...SmartOne Manual Rev 1 5 DOC 9100 0268 01 p 82...
Страница 83: ...SmartOne Manual Rev 1 5 DOC 9100 0268 01 p 83...
Страница 84: ...SmartOne Manual Rev 1 5 DOC 9100 0268 01 p 84 Appendix I Diagnostic Message Decoding...
Страница 85: ...SmartOne Manual Rev 1 5 DOC 9100 0268 01 p 85 Appendix J Accumulate Count Message Decoding...