Reference – KEYENCE N-410 User Manual
Page 151

A-15
6
Calculating Checksums
A
Calculating Checksums
will serve as an example in calculating checksums.
The characters are converted to ASCII code and converted into 8 bit binary numbers as shown
below.
Each bit of each character is then fed to an Exclusive Or function.
The 2-digit hexadecimal result of this calculation is the checksum.
So cc = 51 (35h 31h)
gives a cc = 08
gives a cc = 08
• Exclusive Or calculation
Exclusive Or calculations are carried out as follows.
0 0=0
0 1=1
1 0=1
1 1=0 * Exclusive Or operator
• Converting from hexadecimal to binary
Refer to the following chart for converting ASCII code to binary.
ASCII code
Bit
%
25h
0010
0101
P
50h
0101
0000
0
30h
0011
0000
1
31h
0011
0001
-
2Dh
0010
1101
0
30h
0011
0000
0
30h
0011
0000
0
30h
0011
0000
8
38h
0011
1000
A
41h
0100
0001
B
42h
0100
0010
1
31h
0011
0001
2
32h
0011
0010
0101
0001
51h
Hexadecimal
0
1
2
3
4
5
6
7
Binary
0000
0001
0010
0011
0100
0101
0110
0111
Hexadecimal
8
9
A
B
C
D
E
F
Binary
1000
1001
1010
1011
1100
1101
1110
1111
P mm -
Header %
Delimiter
cc
0008
AB12
+
Example
P
01
-
Header
ERROR
%
Delimiter
cc
ERROR
Delimiter
cc
ERROR
ERROR
0009
Header
AB12
Delimiter
cc
0004
Reference
+
+
+
+
+