78
VP-553xl - The VP-553xl RS-232 Communication Protocol
3. If Ready:
Send a packet
Receive OK on the last packet
Receive OK for the command
4. Packet structure:
Packet ID (1, 2, 3…) (2 bytes in length)
Length (data 2 for CRC) - (2 bytes in length)
Data (data length -2 bytes)
CRC - 2 bytes
01
02
03
04
05…
Packet ID
Length
Data
CRC
5. Response:
~
NNNN
SP
OK
CR LF
Where
NNNN
is the received packet ID in ASCII hex digits.
9.3.5.2
Calculating the CRC
The polynomial for the 16-bit CRC is:
CRC-CCITT: 0x1021 = x
16
+ x
12
+ x
5
+ 1
Initial value: 0000
Final XOR Value: 0
For a code example, see:
http://sanity-free.org/133/crc_16_ccitt_in_csharp.html
CRC example:
Data = “123456789”
Result => 0x31C3