Many times the key to understanding a technology is to understand why it came about. One of the first publications concerning barcodes was one written by someone at NCR (National Cash Register) titled: "Keyless Data Entry". This was around 1973. The publication described a method of entering data into a Point of Sale System without having to use the keys. Cash Registers had become data terminals attached to a main computer in large retail and grocery stores. This is why they were no longer even called Cash Registers. When the clerk "rang up" items this new Cash Register did a lot more than total up your bill and calculate your change. Actually, the clerk didn't even enter the price of the items any more; but rather a series of numbers that described what the item was. This number was sent to the computer. The computer looked up the price and sent it back to the Point of Sale System and also subtracted the product from the store inventory. When the inventory got low enough the computer could process the paperwork to order more products. The computer also compiled various reports for the store management so they knew all about their inventory; what the fast moving products were; the slow moving ones and a lot of other things about how their store was running. Of course the key to accurate transactions and accurate information for management all relied on the clerk entering those numbers accurately.
It didn't take long to realize that human beings are not very good at reading a series of numbers from an object and entering them correctly on a keyboard. A lot of mistakes are made, especially when the clerk is expected to do this hundreds or even thousands of times a day. Somehow, a method had to be devised to mark the necessary information on each product in a manner that some type of "machine" could read the information accurately provided that the clerk just held the item so the machine could see this special marking. It would also be necessary that this special marking be added to the product at very little or no cost. This requirement, of course led to the development of barcodes.
The types of barcodes in use today can be roughly divided into two categories; Retail and Industrial. The example discussed above of why barcodes came about, covers their usage in retail applications. But barcodes are used everywhere these days. You've seen the TV ads for UPS and Federal Express saying that they know where your package is at all times. You can even use your PC to find out the status of your shipment. None of this would be possible without barcodes. So, let's look at the main barcode symbologies in use today.
The retail sales business in the United States mainly uses the UPC or Uniform Product Code. If you're a manufacturer of retail products you must apply for a UPC barcode for that product by contacting the Uniform Code Council. A normal UPC code contains 12 digits. The first digit tells what type of product the code is on (retail, pharmaceutical, etc.). The next five digits identify the manufacturer of that product. The next five digits identify a specific product produced by that manufacturer. The last digit is a check digit used to tell if the barcode scanner read the first eleven digits correctly. In Europe the EAN or European Article Numbering code is used. It's similar to UPC, but contains an extra digit as part of the identification of the country where the product originated. EAN is also used in some applications in the US, such as Booklan code.
In industrial applications many different types of barcodes are used because the type of information that is contained in the barcode varies considerably. Retail applications just require the product and manufacturer. In industrial applications the barcode can contain part numbers, serial numbers, lot identification or just about any other piece of information about an object. The characters in the barcode might be numbers, letters or other punctuation marks, in any combination. There might be a limited area to mark the code, requiring the highest density of information possible.
The three most common codes used in industrial applications are Interleaved 2 of 5, Code 39 and Code 128.
Interleaved 2 of 5 code is designed to encode numbers only. It is a two level code, meaning that the bars and spaces have only two widths. The code is interleaved in that one digit is represented by a series of five bars, two of which are always wide. The next digit is represented by five spaces, two of which are always wide. For this reason an Interleaved 2 of 5 code always contains an even number of digits. A leading zero is usually added if an odd number of characters are to be encoded. All codes have unique patterns at the start and end of the code. This tells the barcode reader which direction it is reading the code. Most all codes can be scanned front to back or back to front, as long as the scanner knows which way it's going. Because of the simple start/stop pattern it is possible for a decoder, looking for an Interleaved 2 of 5 code, to mistake printing for the code and try and decode it. Many times the decoder will be successful in decoding a two digit code. To avoid potential problems with Interleaved 2 of 5 code, always use four digits or more. In addition, always try to use the same number of digits and program your decoder to only accept a code with only that number of digits.
Code 39 is a two level code that is designed to encode both letters and numbers. The standard version encodes upper case letters A-Z, numbers and a few punctuation marks. The asterisk (*) character is always used as a start and a stop character. Extended Code 39 encodes all 128 ASCII characters. Code 39 is the code most often used in industrial applications. Even where only numbers are involved, because it is not subject to the problems outlined above. It is called Code 39 because each character is made up of nine elements, five bars and four spaces, and three of the nine are wide, while the remaining six are narrow. Extended Code 39 uses certain character pairs to represent characters not normally present in Code 39. This works fine but the added characters take the space that would normally yield two characters, so the resulting code is longer than normal Code 39 for a given number of characters.
Code 128 is the best code to use when all 128 ASCII characters are needed. It is a four level code, meaning that bars and spaces can have four different widths. There are actually three versions of Code 128. The A version encodes all upper case alphanumeric characters plus all of the ASCII control characters. The B version encodes all upper and lower case alphanumeric characters. The C version encodes numbers only. It is possible to switch between character sets within the code by using shift characters. The advantage of Code 128 is that it can encode all ASCII characters in the shortest possible code length. The disadvantage is, because it has four different bar and space widths rather than two, more demands are put on printing and decoding technologies.