What Is a Universal Product Code?
The Universal Product Code, commonly referred to as the UPC code, is a commodity barcode developed by the Uniform Code Council (UCC) and is mainly used in the United States and Canada. The EAN code developed on this basis has developed into the most widely applicable universal bar code.
UPC code is an engineer at IBM
UPC-A code
Used for general merchandise, it is the most widely used UPC code. There are 113 modules in total, each module is 0.33 mm long. The left and right are blanks consisting of 9 modules each. The UPC-A code is a fixed length code and can only represent 12 digits. From left to right, they are the start code of 3 modules (101), the system code of 1 digit, the data code of 5 digits left, the middle code of 5 modules (01010), and the data of 5 digits right Code, check code, and termination codes for the three modules (101). Among them, the module length of the start code, middle code, and end code must be longer than the data code.
Correspondence rule: The numerical correspondence rules of the left data code and the right data code are different. The left data code contains an odd number of modules, and the right data code contains an even number. The black module corresponds to a logic value of 1 and the white module is 0.
Data code on the left | Data code on the right | |
Value | Logical value | Logical value |
0 | 0001101 | 1110010 |
1 | 0011001 | 1100110 |
2 | 0010011 | 1101100 |
3 | 0111101 | 1000010 |
4 | 0100011 | 1011100 |
5 | 0110001 | 1001110 |
6 | 0101111 | 1010000 |
7 | 0111011 | 1000100 |
8 | 0110111 | 1001000 |
9 | 0001011 | 1110100 |
It can be seen that the left data code is the inverse of the right data code. The number 4 in the figure above is taken as an example: first determine that it is the right data code, and then read out its logical value: 1011100. Converted into bars and spaces are: thin black (1), thin white (0), thick black (111), thick white (00).
Check code: The check code is the last digit of all 12-digit data codes. If the first eleven digits of the data code are named N1-N11 from left to right, the check code is named C. The check code C is calculated as follows:
CC = (N1 + N3 + N5 + N7 + N9 + N11) * 3 + (N2 + N4 + N6 + N8 + N10) and then take the single digit. C = 10-CC (0 if C is 10). Take the barcode in the figure as an example, cc = (0 + 6 + 0 + 2 + 1 + 5) * 3 + (3 + 0 + 0 + 9 + 4) = 58 c = 2
UPC-B \ C \ D code
It is basically the same as the UPC-A code. Among them: B code is mainly used in medicine and health; C code is used in the industrial sector, the second digit is the system code, the penultimate digit is the check code; the D code is used for warehouse wholesale, and the third digit is the check code.
UPC-E code
Short code with a total length of 8 words. The corresponding rules of numbers between A code and E code are related to the last check code. as follows:
Check code | UPC-E | UPC-A |
0 | XXNNN0 | 0XX000-00NNN + Check code |
1 | XXNNN1 | 0XX100-00NNN + Check code |
2 | XXNNN2 | 0XX200-00NNN + Check code |
3 | XXXNN3 | 0XXX00-000NN + Check code |
4 | XXXXN4 | 0XXXX0-0000N + check code |
5 | XXXXX5 | 0XXXXX-00005 + check code |
6 | XXXXX6 | 0XXXXX-00006 + check code |
7 | XXXXX7 | 0XXXXX-00007 + check code |
8 | XXXXX8 | 0XXXXX-00008 + check code |
9 | XXXXX9 | 0XXXXX-00009 + check code |
Correspondence rule: As for the correspondence between numbers and modules, it is also related to the last bit:
Check code | rule |
0 | EEEOOO |
1 | EEOEOO |
2 | EEOOEO |
3 | EEOOOE |
4 | EOEEOO |
5 | EOOEEO |
6 | EOOOEE |
7 | EOEOEO |
8 | EOEOOE |
9 | EOOEOE |
E means even code and O means odd code. The odd code of UPC-E is exactly the same as the odd code of UPC-A.
| Odd code | Even code |
Value | Logical value | Logical value |
0 | 0001101 | 0100111 |
1 | 0011001 | 0110011 |
2 | 0010011 | 0011011 |
3 | 0111101 | 0100001 |
4 | 0100011 | 0011101 |
5 | 0110001 | 0111001 |
6 | 0101111 | 0000101 |
7 | 0111011 | 0010001 |
8 | 0110111 | 0001001 |
9 | 0001011 | 0010111 |
Check code: When calculating the check code of UPC-E, first convert it to the corresponding UPC-A code, and then calculate the check code according to the same pattern [2] .