12.3.
CRC checksum example
Note:
A checksum of “00” will bypass checksum field verification by the controller.
The command to be sent to the unit is
0x01 – SYS GET MODEL.
Full command is:
‘~ 01 01 XX’ + carriage return,
where XX is an unknown checksum at this time.
NOTE:
This command assumes the unit address is set to 1.
1.
To calculate command checksum, add decimal values of all characters in
the packet, excluding start, checksum, and terminator. Divide result by
256 and the integer remainder converted to two ASCII hex digits is the
.
2.
Example in decimal, take 290 mod 256 and result is 34, which converted
to hex is 0x22. This is the command checksum. Example in hex, take
0x122 mod 0x100 and result is 0x22. This is the command checksum.
3.
The command to be sent to the unit is, ‘~ 01 01 22’ + carriage return.
4.
The unit will respond with, ’01 OK 00 DIGITEL MPCQ 0E’.
5.
To verify checksum for the response, perform similar calculations. See
6.
Example in decimal, take 1326 mod 256 and result is 46, which converted
to hex is 0x2E. This is the response checksum. Example in hex, take 0x52E
mod 0x100 and result is 0x2E. This is the response checksum.
Table 7. Command CRC checksum
Characters
Value (Decimal)
Value (Hex)
space
32
0x20
0
48
0x30
1
49
0x31
space
32
0x20
0
48
0x30
1
49
0x31
space
32
0x20
Total = 290
Total = 0x122
Table 8. Response CRC checksum
Characters
Value (Decimal)
Value (Hex)
0
48
0x30
1
49
0x31
Page 40
900034_C
900034_C - Serial communication