The encoding of “CSE370”
How would the string
CSE370 be represented at the physical level in a barcode?
There are many
different formats that barcodes can be encoded into. Most, however, are
very limited in what characters they can encode, and would not be capable of
encoding the requested string because of this. Some, such as Code 3 of 9
and Code 128 are capable of representing most or all possible ANSI characters
and could encode the string "CSE370". The specific question that we will
be answering is: How would the string "CSE370" be represented in a barcode using
Code 128 Code Set B?
Why Code 128?
Code 128 is a versatile and commonly used barcode. It has the ability to encode
the entire 128 ASCII characters, which include letters, numbers, and symbols.
The biggest benefit of Code 128 is its condensed format. Unlike other barcodes
like Code 39, Code 128 uses four different bar and space widths. Most other
barcodes use only two or three widths. These additional widths let Code 128 use
the least amount of space for any code containing six or more characters.
This report will explore the intricacies of encoding the string “CSE370” by
the following step by step process.
The Specifications:
Code 128 includes 3 character sets defined as Code Set A, Code Set B, and Code
Set C. Code A includes all standard alphanumeric keyboard characters as well as
special characters. Code B is most commonly used and can encode all standard
alphanumeric keyboard characters in upper and lower case in addition to special
characters. Code C is used for numeric only encoding, but can double the density
of the barcode, thus reducing its size. For the purpose of this report, we will
focus on how to encode the string “CSE370” using Code B.
The structure of every Code 128 barcode consists of the following:
1. Quiet Zone
The quiet zone, or blank space, must be at least 10 times the width of the
smallest unit.
2. Start Character
The start character varies with each character set to identify what code should
be used. Code B’s start character is ”2 1 1 2 1 4”.
3. Encoded Characters
Each character is represented by three bars and three spaces. The bars and
spaces or each character add up to 11 units. The bars and spaces can be up to
four units wide. For example, in Code B, the letter “C” is represented by the
bar/space pattern “1 3 1 3 2 1”. This is encoded as a bar of width one, followed
by a space of width three, followed by another bar of width 1, and so on.
4. Check Digit
The check digit is calculated by summing the start code value with the product
of each character value and its position. This sum is then divided by 103 and
the remainder is used as the check digit value. For example, this is how the
check digit for the string “CSE370” would be calculated.
Position | Character | Value | Calculation | Product |
Start | Code B Start | 104 | 104 | 104 |
1 | C | 35 | 35*1 | 35 |
2 | S | 51 | 51*2 | 102 |
3 | E | 37 | 37*3 | 111 |
4 | 3 | 19 | 19*4 | 76 |
5 | 7 | 23 | 23*5 | 115 |
6 | 0 | 16 | 16*6 | 96 |
Total: 639 |
643 mod 103 = 21
Thus, the check digit is the
character with the value 21, “5”.
5. Stop Character
The stop character is the same
for all three codes, and is represented by the bar/space configuration “2 3 3 1
1 1 2”. You might notice that this has an extra value and this is because the
stop character needs to add an additional bar to the end so that is won’t end
with a space.
6. Quiet Zone
A second quiet zone must be
placed at the end of the barcode and must be at least 10 times the width of the
smallest unit.
In addition, every barcode must have
a height of at least 0.15 times the length or 0.25 inches, whichever is larger.
Following these procedures results in the following barcode.
This newly formed barcode could then
be printed on a physical substrate such as paper or plastic, to be used for some
means of identification such as a product identification label, or id badge.
Thus, the string "CSE370" has been represented in a form that, while difficult
for a human to read, is easy for a machine to read when scanned by a barcode
reader such as those used in your local supermarket.
References
Adams, Russ. “Code 128 Specification Page.”
http://www.adams1.com/pub/russadam/128code.html.
(October 28, 2001).
“Code 128 Specification.” http://www.barcodeman.com/info/c128.php3. (October 27,
2001).
“Code 128 / USS Code-128 / UCC128 & EAN128 Barcode FAQ & Tutorial.”
http://www.idautomation.com/code128faq.html. (October 27, 2001).