display | more...

### Code 39 barcode encoding

Code 39 is an alpha-numeric barcode, that is also known under the names LOGMARS (Logistics Applications of Automated Marking and Reading Symbols), Code 3 of 9 or the 3 of 9 Code1.
It is commonly used for various barcoding labels, such as name badges, inventory and industrial applications. The code is easy to use and is designed for character self-checking. The asterisk character is used as the start and stop character and therefore should not be included in the sequence to be encoded.

#### LOGMARS

LOGMARS is an application of Code 39 used by the United States Department of Defense. It is defined under Military Standard MIL-STD-1189B.

#### How to read Code 3 of 9

Code 3 of 9 is readable by humans, if you know how. A number of things to remember are:
• The code is in binary format, see the code table below for the last step of conversion.
• Stripe or no stripe (further referred to as black and white) has no relation to the character at that position being a or a 1, the width of the stripe determines this (narrow = 0, broad = 1).
• The stripes are alternated, i.e. first stripe is black, then white, then black, then white, then black, etcetera.
• Each character consists of 9 binary digits, and therefore also of 9 consecutive stripes.
• The code starts and ends with an asterisk ("*"), which has code 010010100.
So here's the deal:
1. Start at left.
2. First stripe is black (duh!).
3. Width is narrow (or at least it should be), so jot down a 0.
4. Next stripe is white and wide, so 1.
5. Next black and narrow, 0.
6. Repeat this until you're done with all the stripes.
7. If correct, you should come up with a number of digits divisible by 9, so group them together in groups of 9.
8. The first and last group of digits should be 010010100 (="*", start and stop character).
9. Next, look up the groups of binary digits in the table below and you've got your original sequence of digits and characters.

#### Lookup table for characters

• 011000100 = space
• 010101000 = \$
• 000101010 = %
• 010010100 = * (Start/Stop)
• 010001010 = +
• 010000101 = |
• 110000100 = .
• 010100010 = /
• 000110100 = 0
• 100100001 = 1
• 001100001 = 2
• 101100000 = 3
• 000110001 = 4
• 100110000 = 5
• 001110000 = 6
• 000100101 = 7
• 100100100 = 8
• 001100100 = 9
• 100001001 = A
• 001001001 = B
• 101001000 = C
• 000011001 = D
• 100011000 = E
• 001011000 = F
• 000001101 = G
• 100001100 = H
• 001001100 = I
• 000011100 = J
• 100000011 = K
• 001000011 = L
• 101000010 = M
• 000010011 = N
• 100010010 = O
• 001010010 = P
• 000000111 = Q
• 100000110 = R
• 001000110 = S
• 000010110 = T
• 110000001 = U
• 011000001 = V
• 111000000 = W
• 010010001 = X
• 110010000 = Y
• 011010000 = Z

Sources:
http://www.idautomation.com/code39faq.html
The barcode generator demonstration program by J.I. Mercanti:
```	barcode39.mdb

Barcode Generator for Code 3 of 9, Code 39, and Mil-spec Logmars.

version 2.0 (updated for MsAccess 97)

(c) 1993 - 1999 James Isle Mercanti, Cocoa Beach, FL  32931.  USA

Permission granted for public use and royalty-free distribution.