![Shinko BCS2 Communication Instruction Manual Download Page 9](http://html.mh-extra.com/html/shinko/bcs2/bcs2_communication-instruction-manual_1258175009.webp)
9
5.3 Checksum Calculation
Checksum is used to detect receiving errors in the command or data.
Set the program for the master side as well to calculate the checksum of the response data from the slaves
so that communication errors can be checked.
The ASCII code (hexadecimal) corresponding to the characters which range from the address to that before
the checksum is converted to binary notation, and the total value is calculated.
The lower one byte of the total value is converted to 2’s complement, and then to hexadecimal numbers,
that is, ASCII code for the checksum.
• 1’s complement: Reverse each binary bit. 0 will become 1 and vice versa.
• 2’s complement: Add 1 to 1’s complement.
[Example of checksum calculation]
SV1 (0001H): 600
(0258H)
Address (instrument number): 0 (20H)
(Fig. 5.3-1)
20H
20H
50H
30H
30H
30H
31H
30H
32H
35H
38H
0010 0000
0010 0000
0101 0000
0011 0000
0011 0000
0011 0000
0011 0001
0011 0000
0011 0010
0011 0101
0011 1000
+
10 0010 0000
[Hexadecimal]
[Binary]
1101 1111
1
+
1110 0000
E
0
45H
30H
[1's complement]
[2's complement]
[Hexadecimal]
[ASCII]
Checksum
STX
ETX
P
0
0
0
1
0
2
5
8
02H
20H
20H
50H
30H
30H
30H
31H
30H
32H
35H
38H
03H
[Characters above are represented in ASCII.]
Checksum
Checksum calculation range
[e.g.]
E
45H 30H
0