60
Calculating Checksums (IDCHK, IHCHK)
IND100077-259
IHCHK
Let us calculate IHCHK. We send the same data package, the data value does not matter for this calculation. Instead,
we focus on the following formula that sums all the header values and inverts them. Note that DATA of
55
and
IDCHK of
200
is present in table below as described on previous page. Length is set to 1 as there is only 1 byte in
the DATA field.
Attention
Address
CMD
CMD
CMD
Length
IHCHK
Data
IDCHK
7
255
66
82
73
1
IHCHK
55
200
Add together as indicated below.
Attention field:
7
or as HEX
0x07
Address field:
255
or as HEX
0xFF
CMD 1 field:
66
or as HEX
0x42
CMD 2 field:
82
or as HEX
0x52
CMD 3 field:
73
or as HEX
0x49
Length field:
1
or as HEX
0x01
(Length of 1 indicates only 1 byte
55
is present in DATA field).
Add all the fields together.
7 + 255 + 66 + 82 + 73 + 1 = 484
Subtract 255 until the summed data value is below
255
.
484
-
255
= 229
Subtract 1 for every time subtracted
255
above.
229 - 1 = 228
Subtract 228 based on decimal values from the binary table (marked in green) until you reach 0:
228
-
128 - 64 - 32 - 4
= 0
1 or 0
1
1
1
0
0
1
0
0
Binary
2
7
2
6
2
5
2
4
2
3
2
2
2
1
2
0
Decimal
128
64
32
16
8
4
2
1
Which gives us binary number (by using explanations on previous page).
1110
0100
inverted is (by using explanations on previous page).
0001
1011
Convert 0001 1011 to decimal is
27
or as HEX
0x1B
Attention
Address
CMD
CMD
CMD
Length
IHCHK
Data
IDCHK
7
255
66
82
73
1
27
55
200
Содержание HATTELAND TECHNOLOGY X MMD G2 Series
Страница 56: ...56 This page left intentionally blank...
Страница 57: ...57 Appendixes...
Страница 68: ...Hatteland Technology AS www hattelandtechnology com Enterprise no NO974533146...