Skip to content

Archive

Tag: Barcodes

The interleaved 2 of 5 barcode uses an scheme which alternates using bars and spaces to encode data with narrow and wide bars (or spaces). The encoding is further split up into odd and even encodings.

Interleaved 2 of 5 Barcode

Interleaved 2 of 5 Barcode


The interleaved 2 of 5 barcode does not require a checksum digit, and can be any length.

The left and right guard bars are 1010 and 01101 respectively, and the digts are encoded alternatively with the odd and even encodings.

Digit Odd Even
0 1011001 0100110
1 1101011 0010100
2 1001011 0110100
3 1100101 0011010
4 1011011 0100100
5 1101101 0010010
6 1001101 0110010
7 1010011 0101100
8 1101001 0010110
9 1001001 0110110

continue reading…

Share

The standard 2 of 5 barcode format encodes all of the information in the bars, and only uses the spaces for spacing purposes, unlike all the other barcodes we have looked at so far, and is used mostly in warehouses and airline ticketing.

Standard 2 of 5 Barcode

Standard 2 of 5 Barcode


To calculate the checksum digit, working through the digits from right to left, you add up the odd-positioned elements and even-positioned elements separately. We then find the checksum by 10 – ((((3 * odd) + even) modulo 10) modulo 10).

Using this full string then we apply the encoding, where a narrow bar is defined by 11 and a wide bar with 111111. The left guard is 1111011110110 and the right guard is 1111011011110.

The encodings for each digit is as follows

0 11011011111101111110110
1 11111101101101101111110
2 11011111101101101111110
3 11111101111110110110110
4 11011011111101101111110
5 11111101101111110110110
6 11011111101111110110110
7 11011011011111101111110
8 11111101101101111110110
9 11011111101101111110110

continue reading…

Share

The MSI barcode, which also goes by the name of the Modified Plessey barcode is mainly used for inventory control in places such as warehouses.

MSI Barcode

MSI Barcode


This barcode format can encode any number of digits, and is ended by a checksum digit.

the checksum digit can be calculated using one of several methods.

Using the Modulo 10 method, moving through the string in reverse, you double the value of every second digit, starting at the rightmost digit, and then add the digits together. We then take a modulo 10 of this number, subtract it from 10. This then gives the checksum digit.

For the Modulo 11 method, you need to reverse the digit string first, and then apply a weighting to each digit. There are two ways to work out the weighting. The “IBM” method assigns a weighting of 2, 3, 4, 5, 6, 7 to successive digits, whereas the “NCR” method assigns a weighting of 2, 3, 4, 5, 6, 7, 8, 9 to each successive digit. Then, taking the weighted sum, the parity is found by taking the modulo 11 of this sum, and subtracting from 11.

The remaining two methods, Modulo 1011 and Modulo 1110, first applies the one method and then the other.

Now that we have the full string with the parity digit, we can encode.

The left guard of the barcode is 110 and the right guard 1001.

There is only one encoding per digit, which makes encoding rather easy.

0 100100100100
1 100100100110
2 100100110100
3 100100110110
4 100110100100
5 100110100110
6 100110110100
7 100110110110
8 110100100100
9 110100100110

continue reading…

Share

UPC-2 is a simpler variation of the UPC-5 barcode designed to contain 2 digits of data.

UPC-2 Barcode

UPC-2 Barcode


The checksum (or parity) for the UPC-2 format is used only to encode the barcode, and therefore is not coded directly, and out of all the UPc barcodes, is the only one in this series which does not use modulo 10.

The parity is simply the two digits treated as an integer and then applying modulo 4 to it, and the remainder is the parity.

Like with UPC-5, UPC-2 only has a left guard and centre guard (which is places after the third digit), which are encoded as 1011 and 01 respectively.

We then apply the odd or even encoding based on the parity string we determine from the parity

0 11
1 10
2 01
3 00

The odd and even encodings are the same as the ones for the UPC-5 format

Digit Odd Even
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

continue reading…

Share

UPC-5 is a variation on the UPC-A barcode designed to contain 5 digits of data.

UPC-5 Barcode

UPC-5 Barcode


The checksum (or parity) for the UPC-5 format is used only to encode the barcode, and therefore is not coded directly.

Calculating the parity uses the same modulo 10 method as the UPC-A, except that the weightings are different. Odd-numbered positions are weighted 3, while even-numbered positions are weighted 9.

Once we have the weighted sum, we apply a modulo 10 to the weighted sum, which gets the remainder after applying a modulo of 10 to the weighted sum.

The parity is then 10 – (modulo 10 of the weighted sum).

UPC-5 only has a left guard and centre guard (which is places after the third digit), which are encoded as 1011 and 01 respectively.

The 5 digits are then encoded using either odd or even encoding, which is determined by the parity string.

0 00111
1 01011
2 01101
3 01110
4 10011
5 11001
6 11100
7 10101
8 10110
9 11010

The odd and even encodings are the same as the ones for the UPC-E format

Digit Odd Even
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

continue reading…

Share

The UPC-E barcode format is a compressed form of the UPC-A format and is used where space is at a premium. The UPC-E formatalso require that there are at least 5 0′s in a group in the barcode, so that it can be compressed.

UPC-E Barcode

UPC-E Barcode


Before we shorten the barcode, we need to enter a full 11 digit UPC-A barcode (excluding the parity digit), and then calculate the parity digit as per the UPC-A barcode.

We first need add up the 11 digits of the barcode with the weighting applied. The weighting is the same as the EAN-13 and UPC-A weighting, where the weighting of each digit which is in an odd-numbered position is 1 and for even-numbered positions, the weighting is 3. To find the sum, we need to multiply each digit by its weighting before adding it together.

Once we have the weighted sum, we apply a modulo 10 to the weighted sum, which gets the remainder after applying a modulo of 10 to the weighted sum.

The parity is then 10 – (modulo 10 of the weighted sum).

Now that we have an 12 digit number, we need to shorten it to an 8 digit number.

The rules for this are quite simple.

The manufacturer portion of the number is the first 5 digits excluding the first digit of the barcode. The product portion is the subsequent 5 digits.
If the last 3 manufacturer digits are 100, 200 or 000, then the shortened for is made up of the first digit, the first two digits of the manufacturer, the last 3 digits of the product, the third digit of the manufacturer and finally the parity.

Otherwise, if the last two digits of the manufacturer is 00, then the barcode is made up of first digit, the first three digits of the manufacturer, the last 2 digits of the product, the number 3, and finally the parity.

Then, if the last digit of the manufacturer is 0, the barcode is made up of first digit, the first four digits of the manufacturer, the last digit of the product, the number 4, and finally the parity.

We can now use this number for the rest of the calculation

We do not split up this format, and only have with a guard bar at the beginning and end of the barcode. The left guard bars are encoded as 101, while the right guard bar is 010101.

The first digit of the barcode determines the parity set to use. The encodings are split up by odd and even encodings, which is determined by the parity bit. This is found by choosing the correct parity set encodings, and then finding the parity bit string for the parity we calculated earlier, and then returning the bit value at the position in the string for the digit we wish to encode.

Digit Set 0 Set 1
0 000111 111000
1 001011 110100
2 001101 110010
3 001110 110001
4 010011 101100
5 011001 100110
6 011100 100011
7 010101 101010
8 010110 101001
9 011010 100101

Once we have the parity bit, we then choose the odd or even encoding accordingly, for each digit. Only 6 digits are explicitly encoded, since the first and last digits are used to calculate the parity bit, so are not needed to be encoded directly.

Digit Odd Even
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

continue reading…

Share

The UPC-A barcode format is very similar to the EAN-13 barcode and is mostly used in America, although in recent years, the US is moving towards the EAN-13 format too. The UPC-A format is 12 digits long, with the last digit being the checksum (or parity) digit.

UPC-A Barcode

UPC-A Barcode


To calculate the parity for UPC-A, we use the same process as with the EAN-13 barcode. We first need add up the 11 digits of the barcode with the weighting applied. The weighting is the same as the EAN-13 weighting, where the weighting of each digit which is in an odd-numbered position is 1 and for even-numbered positions, the weighting is 3. To find the sum, we need to multiply each digit by its weighting before adding it together.

Once we have the weighted sum, we apply a modulo 10 to the weighted sum, which gets the remainder after applying a modulo of 10 to the weighted sum.

The parity is then 10 – (modulo 10 of the weighted sum).

Now that we have an 12 digit number, we can encode it.

We split the UPC-A barcode into 2 blocks of 6 digits each, with a guard bar at the beginning and end of the barcode and one in the middle of the barcode too. The end guard bars are encoded as 101, while the middle guard bar is 01010.

In the EAN-13 barcode format, the parity digit was not encoded directly, with only the first 12 digits being encoded, whereas with UPC-A, all 12 digits are encoded, including the parity. This simplifies the encoding process, since we do not have to worry about odd and even parity encodings.

The left hand side encodings are identical to the left hand odd parity encodings from EAN-13.

0 0001101
1 0011001
2 0010011
3 0111101
4 0100011
5 0110001
6 0101111
7 0111011
8 0110111
9 0001011

These encodings ensure that UPC-A forms a subset of the EAN-13 barcode.

The right hand side encodings (the last 6 digits) are the same as the right hand codings of EAN-13.
The encodings are as follows:

0 1110010
1 1100110
2 1101100
3 1000010
4 1011100
5 1001110
6 1010000
7 1000100
8 1001000
9 1110100

continue reading…

Share