Summing up the running checksum for each digit, we get 103 + 40 + 82 + 297 + 136 + 280 + 468 = 1406. This value
divided by 103 is 1406 / 103 = 13 with a remainder of 67. Thus the checksum digit is the character which has a
value of 67.
STRUCTURE OF A CODE 128 BARCODE
A Code 128 bar code consists of a leading quiet zone, one of three start codes, the data itself, a check character,
a stop character, and a trailing quiet zone.
The Code 128 specification defines three "character sets" or "character modes." The start code that is used
determines which character set will be used. The character set may also be changed in the middle of the bar code.
For example, in the bar code above the bar code starts in "Character set A" to encode the text "HI", and then switches
to "Character set C" to more efficiently encode the numbers that follow.
To encode a value as a Code 128 bar code, the checksum digit must first be calculated (see procedure above) and the
entire bar code, including check digit, may then be encoded as a sequence of bars and spaces.
A Code 128 bar code has the following physical structure:
- Start code, which is the code 103, 104, or 105 from the encoding table below (either 11010000100 (Start-A),
11010010000 (Start-B), or 11010011100 (Start-C).
- Each of the data bytes of the message, encoded with the encoding table below.
- The checksum byte, calculated as described above and encoded using the table below.
- Stop character of 11000111010.
- Termination bar of 11.