Before a Code 128 symbol may be encoded, the software must compute the correct checksum digit which will be included in the bar code. The checksum digit is based on Modulus 103 Checksum based on the weighted sum of the values of each of the digits in the message that is being encoded, including the start character.
The steps for calculating the check digit are as follows:
This is easier to understand with an example.
Let's calculate the checksum digit for the sample bar code above, "HI345678".
The checksum digit is included in all Code 128 bar codes, but it isn't printed as part of the text below the bar code symbol (as is the case with UPC and EAN symbols).
Table 2.1. Calculate checksum digit of "HI345678"
Barcode | START-A | H | I | CODE C | 34 | 56 | 78 |
---|---|---|---|---|---|---|---|
Character Value | 103 | 40 | 41 | 99 | 34 | 56 | 78 |
Character Position | - | 1 | 2 | 3 | 4 | 5 | 6 |
Calculation | 103 | 40 * 1 | 41 * 2 | 99 * 3 | 34 * 4 | 56 * 5 | 78 * 6 |
Weighted Sum | 103 | 40 | 82 | 297 | 136 | 280 | 468 |
Summing up the running checksum for each digit, we get:
103 + 40 + 82 + 297 + 136 + 280 + 468 = 1406
Then,
1046 MOD 13 = the remainder of 1406 / 103 = 67
Thus the checksum digit is the character which has a value of 67.
Note | |
---|---|
|