Codabar
From Wikipedia, the free encyclopedia
Codabar (sometimes called Code 2 of 7) is an older symbology, still in use in some libraries and blood banks, as well as air parcel express applications. It was developed in 1972 by Pitney Bowes Corp. Codabar has lost favor because newer symbologies hold more information in a smaller space.
Unlike the other width-modulated codes, Codabar does not use common wide and narrow element widths to encode the logic 1s and 0s in the characters. Instead, there are a total of 18 different sets of bar and space widths specified by the symbology. This structure was designed to account for the printing errors characteristic of certain early printers, leading to printed symbols which could be easily read. Note that it also provided a constant character length regardless of whether two or three wide elements were used in the character.
[edit] Encoding
Codabar can encode the digits 0 through 9, six symbols (-:.$/+), and the start/stop characters A, B, C, D, E, *, N, or T. The start/stop characters must be used in matching pairs and may not appear elsewhere in the barcode.
The 18 different codes can be thought of as being made up of 7 binary identifiers (4 bars and 3 spaces) where 0 is a short element and 1 is a long element.
Char. | Pattern | Bars | Spaces |
---|---|---|---|
0 | lll l | 0001 | 001 |
1 | lll l | 0010 | 001 |
2 | ll ll | 0001 | 010 |
3 | l lll | 1000 | 100 |
4 | lll l | 0100 | 001 |
5 | lll l | 1000 | 001 |
6 | l lll | 0001 | 100 |
7 | l lll | 0010 | 100 |
8 | l lll | 0100 | 100 |
9 | ll ll | 1000 | 010 |
- | ll ll | 0010 | 010 |
$ | ll ll | 0100 | 010 |
: | ll l l | 1011 | 000 |
/ | l l l l | 1101 | 000 |
. | l l ll | 1110 | 000 |
+ | ll l l | 0111 | 000 |
A | ll l l | 0100 | 011 |
B | l l ll | 0001 | 110 |
C | ll l l | 0001 | 011 |
D | ll l l | 0010 | 011 |
T | ll l l | 0100 | 011 |
N | l l ll | 0001 | 110 |
* | ll l l | 0001 | 011 |
E | ll l l | 0010 | 011 |
There is no checksum defined as part of the Codabar standard, but some industries (libraries, for example) have adopted their own checksum standards. Many libraries use the following system which includes 8–13 digits plus a checksum;.
The number 2 1223 0270 2948 0 would be deciphered as:
- Digit 1 indicates the type of barcode (usually 2 = patron, 3 = item)
- Digits 2-5 identify the institution
- The next 8 digits (0270 2948) identify the individual patron or item
- Digit 14 is the checksum
To calculate the checksum, start with the total set to zero and scan the 13 digits from left to right:
- If the digit is in an even-numbered position (2, 4, 6...) add it to the total.
- If the digit is in an odd-numbered position (1, 3, 5...) multiply the digit by 2. If the product is equal to or greater than 10, subtract 9 from the product. Then add the product to the total.
- After all digits have been processed, divide the total by 10 and take the remainder.
- If the remainder = 0, that is the check digit. If the remainder is not zero, the check digit is 10 minus the remainder.
Example: if the barcode is 1118438018177. The last digit (7) is the checksum so ignore it when doing the equation (leaving 111843801817). Starting by adding the even numbered places together: 1+8+3+0+8+7=20. Then multiply the odd number places by 2: 2, 2, 8, 16, 2, 2. Subtract 9 from any number equal or greater than 10: 16-9=7. Add these numbers to the previous total: 20+2+2+8+7+2+2=43. Divide this total by 10: 43/10=4.3. If the remainder (number to the right of the decimal) is 0 (zero) then the checksum is 0 otherwise the checksum is 10 minus the remainder: 10-3=7.