Thermal printer
Barcode Knowledge

What is Code 39 barcode and how to encode a Code 39 barcode

What is Code 39 barcode?

Code 39 (also known as Code 3 of 9) is a barcode system invented by Intermec Corporation (acquired by Honeywell in 2013) in 1974. It is a distributed barcode that can be scanned bidirectionally by users, which means that there must be a meaningless space (its logical value is 0) between adjacent data codes. It has the ability to support characters and numbers, making it more widely used than general one-dimensional barcodes. Currently, it is mainly used in industrial products, commercial data, and healthcare data for hospitals. Its biggest advantage is that there is no mandatory limit on the number of codes, uppercase English letter codes can be used, and the checksum can be ignored.

The standard Code 39 barcode consists of a start safe space, starting code, data code, negligible checksum, end code and, end safe space. Taking the string "Z135+" as an example, its Code 39 barcode is shown in the following figure:

Structure of Code 39 barcode

Structure of Code 39 barcode

Characteristics of Code 39 barcode

Code 39 has the following characteristics:

The length of the barcode is not limited and can be flexibly adjusted according to demand. But when planning the length, consideration should be given to the range allowed by the barcode reader to avoid the inability to read complete data during scanning.

The start and end codes must be fixed to the "*" character. Allow barcode scanners to perform bidirectional scanning processing. Due to the self checking ability of code 39, the verification code is optional and does not necessarily need to be set. Barcodes take up a large amount of space.

The data that can be represented includes: numbers from 0 to 9, English letters from A to Z, as well as special symbols such as "+", "-", "*", "/", "%", "$", ".", and the blank character "", totaling 44 sets of codes, and can be combined to form 128 ASCII CODE characters, as shown in the table.

Comparison of ASCII CODE Characters and Code 39 characters

Table 1. Comparison of ASCII code characters and Code 39 characters

Encoding method of Code 39 barcode

Each barcode code in Code 39 is composed of nine units (bar or space), of which three are wide units and the rest are narrow units, hence it is called Code 39.

Code 39 has only two types of cell widths - wide cells and narrow cells. The width of a wide unit is 2 to 3 times that of a narrow unit, and generally 2, 2.5, or 3 times is preferred.

The character encoding method of Code 39

Table 2: Character Encoding Methods for Code 39

(1) English letters

The logical values of Code 39 corresponding to the 26 English letters are shown in the following table.

The logical value of 26 English letters

Table 3: Code 39 Code Correspondence Table (English letters)

(2) Numbers and Special characters

Code 39 can also represent numbers 0-9 and special characters, and their corresponding logical values are shown in the following table.

Code 39 Code Correspondence Table (Numbers and special characters)

Table 4: Code 39 Code Correspondence Table (Numbers and special characters)

Calculation of Code 39 checksum digit

The checksum digit of Code 39 must refer to "Comparison table of code and value for checksum ", as shown in Table 5. The accumulated corresponding values are then divided by 43, and the corresponding encoding character of the remainder is the checksum digit.

For example, to calculate the checksum digit of the string * S123 $5 *, the calculation process is as follows:

(1) Refer to the comparison table of characters and values to find the corresponding value of the encoded character

Referring to the table below, the corresponding values of each encoded character are:

The corresponding value of S is 28;

The corresponding value of 1 is 1;

The corresponding value of 2 is 2;

The corresponding value of 3 is 3;

The corresponding value of $ is 39;

The corresponding value of 5 is 5.

(2) Accumulate the corresponding values and divide by 43

Accumulated corresponding value=28+1+2+3+39+5=78

78 ÷ 43=1….35

(3) Look up the table, find the encoding character corresponding to the remainder

Remainder=35

Look up the table below, the encoded character of 35 is Z.

Therefore, the checksum digit is Z.

The code 39 codes, including the checksum digit, are: * S123$5Z* .

Query table of checksum digit for Code 39

Table 5: Query table of checksum digit for Code 39

Prev:

Related Posts

Contact

Contact Us

Tel: +

WhatsApp: +

Wechat: +

Email: ﮪqq.com

WhatsApp

WhatsApp QRCode

WhatsApp
Share
BacktoTop