| Code 39, the first alpha-numeric symbology to be developed, is still widely used-especially in non-retail environments. It is the standard bar code used by the United States Department of Defense, and is also used by the Health Industry Bar Code Council (HIBCC). Code 39 is also known as "3 of 9 Code" and "USD-3".
A typical Code 39 bar code is:
|Code 39 is a discrete, variable-length symbology. It is self-checking in that a single print defect cannot transpose one character into another valid character.|
|COMPUTING THE CHECKSUM DIGIT|
Since Code 39 is self-checking, a check digit normally isn't necessary. However, in applications that require an extremely high level of accuracy a modulo 43 checksum digit may be added.
To calculate the optional checksum digit, follow the following steps.
1. Take the value (0 through 42) of each character in the bar code. The start and stop characters are not included in the checksum calculation.
2. Sum the value of each of the values of each of the characters described in step 1.
3. Divide the result from step 2 by 43.
4. The remainder from the division in step 3 is the checksum character that will be appended to the data message before the stop character.
|ENCODING THE SYMBOL|
Once the checksum digit has been calculated we know the entire message which must be encoded in the bars and spaces. Continuing with our example, we will encode, from zero, the Code 39 bar code we used in our example above: HI345678 with a checksum digit of 67.
In the following text, we will discuss the encoding of the bar code by considering that the number "1" represents a "dark" or "bar" section of the bar code whereas a "0" represents a "light" or "space" section of the bar code. Thus the numbers 1101 represents a double-wide bar (11), followed by a single-wide space (0), followed by a single-wide bar (1). This would be printed in the bar code as:
|STRUCTURE OF A CODE 39 BARCODE|
|A Code 39 bar code has the following structure:
1. A start character - the asterisk (*) character.
2. Any number of characters encoded from the table below.
3. An optional checksum digit calculated as described above and encoded from the table below.
4. A stop character, which is a second asterisk character.
|CODE 39 ENCODING TABLE|
This table indicates how to encode each digit of a Code 39 bar code. Note that the "Width Encoding" column is expressed as "N" for narrow and "W" for wide while the "Barcode Encoding" column represents how the bar code will actually be encoded as described above in "Encoding the Symbol."
Keep in mind that each character begins and ends with a bar, thus the "bar code encoding" always starts and ends with a "1".
|If a Code 39 bar code starts with a space, that bar code will be appended to any previous code 39 bar code in the buffer and the system will wait for additional bar code(s). If a Code 39 bar code doesn't start with a space, the bar code will be appended to any previous code 39 bar codes and the entire message will be delivered to the application.
In other words, if a code 39 bar code has additional bar codes to follow, it must start with a space-if the bar code is the last bar code in the message it must not start with a space.
| We will now code the example we used above, TEST8052. In this case we will not use a check digit.
1. The START character (*): 100101101101.
2. The digit "T": enocded as 101011011001.
3. The digit "E": enocded as 110101100101.
4. The digit "S": enocded as 101101011001.
5. The digit "T": enocded as 101011011001.
6. The digit "8": enocded as 110100101101.
7. The digit "0": enocded as 101001101101.
8. The digit "5": enocded as 110100110101.
9. The digit "2": enocded as 101100101011.
10. The STOP character (*): 100101101101.
This is shown in the following graphical representation where the bar code has been sectioned-off into areas that reflect each of the 10 components just mentioned.
|NOTE: In the above encoding example note that there is an inter-character space between each character. This is not listed in the list of 10 components, but there is an inter-character space between each character. This inter-character space is represented in the graphic by the white space separating the grey areas.|
|EXTENDED CODE 39 ENCODING TABLE|