25 / 73
Copyright © 2019 Toshiba Teli Corporation, All Rights Reserved.
http://www.toshiba-teli.co.jp/en/
D4296087A
- How to calculate GenCP checksum
The specified field is cut out in 2 byte units, and the one's complement sum is taken to be one's complement.
The specification fields are as follows.
preamble (0x0100)
CCD checksum (0x2E46)
SCD checksum (0xECCA)
channel_id (0x0000)
flags (0x4000)
command_id (0x0802)
length (0x000C)
request_id (0x89AB)
register address hi (0x00000000)
register address lo (0x0020405C)
0x00
0x04
0x08
0x0C
0x10
0x14
0x18
+0x0
+0x1
+0x2
+0x3
data (0x000000FF)
Prefix
CCD
(Common Command Data)
SCD
(Specific Command Data)
*CCD checksum
:
channel_id, CCD (In the example, the area of 0x06 to 0x0F)
*SCD checksum
:
channel_id, CCD, SCD (In the example, the area of 0x06 to 0x1B)
*The one's complement sum is taken to be one's complement.
:
It has the same calculation method as the UPD Checksum of RFC768.
Please refer to the following about UPD of RFC768.
https://www.ietf.org/rfc/rfc768.txt
- CCD checksum in the example
One's complement sum
=0x89AB
=0xD1B9
One's complement
=0xFFFF-0xD1B9
=0x2E46
- SCD checksum in the example
One's complement sum
=(CCD checksum comp0x00FF
=0x00FF
=0x11334
=0x001+0x1334
=0x1335
One's complement
=0xFFFF-0x1335
=0xECCA