- Code 39
-
Code 39 (also known as Alpha39, Code 3 of 9, Code 3/9, Type 39, USS Code 39, or USD-3) is a variable length, discrete barcode symbology.
The Code 39 specification defines 43 characters, consisting of uppercase letters (A through Z), numeric digits (0 through 9) and a number of special characters (-, ., $, /, +, %, and space). An additional character (denoted '*') is used for both start and stop delimiters. Each character is composed of nine elements: five bars and four spaces. Three of the nine elements in each character are wide (binary value 1), and six elements are narrow (binary value 0). The width ratio between narrow and wide can be chosen between 1:2 and 1:3.
The barcode itself does not contain a check digit (in contrast to—for instance—Code 128), but it can be considered self-checking on the grounds that a single erroneously interpreted bar cannot generate another valid character. Possibly the most serious drawback of Code 39 is its low data density: It requires more space to encode data in Code 39 than, for example, in Code 128. This means that very small goods cannot be labeled with a Code 39 based barcode. However, Code 39 is still widely used and can be decoded with virtually any barcode reader. One advantage of Code 39 is that since there is no need to generate a check digit, it can easily be integrated into existing printing system by adding a barcode font to the system or printer and then printing the raw data in that font.
Code 39 was developed by Dr. David Allais and Ray Stevens of Intermec in 1974. Their original design included two wide bars and one wide space in each character, resulting in 40 possible characters. Setting aside one of these characters as a start and stop pattern left 39 characters, which was the origin of the name Code 39.[1] Punctuation characters were later added that deviated from this pattern, expanding the character set to 43 characters. Code 39 was later standardised as ANSI MH 10.8 M-1983 and MIL-STD-1189.[2] MIL-STD-1189 has been cancelled and replaced by ANSI/AIM BC1/1995, Uniform Symbology Specification - Code 39.[3]
Contents
Encoding
The * character presented below is not a true encodable character, but is the start and stop symbol for Code 39. The asymmetry of the symbol allows the reader to determine the direction of the barcode being scanned. This code is traditionally mapped to the * character in barcode fonts and will often appear with the human-readable representation alongside the barcode.
These tables outline the Code 39 specification:
Legend Format1 Format2 Desc W B Wide - Black N b Narrow - Black w W Wide - White n w Narrow - White
(Note, Format1 and Format2 are just two different ways of describing the same underlying encoding, not two variants of Code 39.)><
Code Details Char nr for checksum Char Format1 Format2 0 0 NnNwWnWnN bwbWBwBwb 1 1 WnNwNnNnW BwbWbwbwB 2 2 NnWwNnNnW bwBWbwbwB 3 3 WnWwNnNnN BwBWbwbwb 4 4 NnNwWnNnW bwbWBwbwB 5 5 WnNwWnNnN BwbWBwbwb 6 6 NnWwWnNnN bwBWBwbwb 7 7 NnNwNnWnW bwbWbwBwB 8 8 WnNwNnWnN BwbWbwBwb 9 9 NnWwNnWnN bwBWbwBwb 10 A WnNnNwNnW BwbwbWbwB 11 B NnWnNwNnW bwBwbWbwB 12 C WnWnNwNnN BwBwbWbwb 13 D NnNnWwNnW bwbwBWbwB 14 E WnNnWwNnN BwbwBWbwb 15 F NnWnWwNnN bwBwBWbwb 16 G NnNnNwWnW bwbwbWBwB 17 H WnNnNwWnN BwbwbWBwb 18 I NnWnNwWnN bwBwbWBwb 19 J NnNnWwWnN bwbwBWBwb 20 K WnNnNnNwW BwbwbwbWB 21 L NnWnNnNwW bwBwbwbWB 22 M WnWnNnNwN BwBwbwbWb 23 N NnNnWnNwW bwbwBwbWB 24 O WnNnWnNwN BwbwBwbWb 25 P NnWnWnNwN bwBwBwbWb 26 Q NnNnNnWwW bwbwbwBWB 27 R WnNnNnWwN BwbwbwBWb 28 S NnWnNnWwN bwBwbwBWb 29 T NnNnWnWwN bwbwBwBWb 30 U WwNnNnNnW BWbwbwbwB 31 V NwWnNnNnW bWBwbwbwB 32 W WwWnNnNnN BWBwbwbwb 33 X NwNnWnNnW bWbwBwbwB 34 Y WwNnWnNnN BWbwBwbwb 35 Z NwWnWnNnN bWBwBwbwb 36 - NwNnNnWnW bWbwbwBwB 37 . WwNnNnWnN BWbwbwBwb 38 (space) NwWnNnWnN bWBwbwBwb 39 $ NwNwNwNnN bWbWbWbwb 40 / NwNwNnNwN bWbWbwbWb 41 + NwNnNwNwN bWbwbWbWb 42 % NnNwNwNwN bwbWbWbWb * NwNnWnWnN bWbwBwBwb
Please Note: In between each character (the start and stop characters included) there is a thin space (shown as w below). For example, if you wanted a Code 39 barcode composed of the letter "A", you would need the following to be encoded (using Format 2 as described above): "*A*". [bWbwBwBwb]w[BwbwbWbwB]w[bWbwBwBwb]
The code will not be read without these spaces. Barcode fonts invariably include this space within the glyph for the character.Code 39 mod 43
Code 39 is sometimes used with an optional modulo 43 check digit. Using it requires this feature to be enabled in the barcode reader. The code with check digit is referred to as Code 39 mod 43.
Here is how to do the checksum calculation:
- Take the value (0 through 42) of each character in the barcode excluding start and stop codes.
- Sum the values.
- Divide the result by 43.
- The remainder is the value of the checksum character to be appended.
Full ASCII Code 39
Code 39 is restricted to 43 characters. In Full ASCII Code 39 Symbols 0-9, A-Z, "." ,and "-" are the same as their representations in Code 39. Lower case letters, additional punctuation characters and control characters are represented by sequences of two characters of Code 39.
Code Details Nr Character Encoding Nr Character Encoding Nr Character Encoding Nr Character Encoding 0 NUL %U 32 [space] [space] 64 @ %V 96 ` %W 1 SOH $A 33 ! /A 65 A A 97 a +A 2 STX $B 34 " /B 66 B B 98 b +B 3 ETX $C 35 # /C 67 C C 99 c +C 4 EOT $D 36 $ /D 68 D D 100 d +D 5 ENQ $E 37 % /E 69 E E 101 e +E 6 ACK $F 38 & /F 70 F F 102 f +F 7 BEL $G 39 ' /G 71 G G 103 g +G 8 BS $H 40 ( /H 72 H H 104 h +H 9 HT $I 41 ) /I 73 I I 105 i +I 10 LF $J 42 * /J 74 J J 106 j +J 11 VT $K 43 + /K 75 K K 107 k +K 12 FF $L 44 , /L 76 L L 108 l +L 13 CR $M 45 - - 77 M M 109 m +M 14 SO $N 46 . . 78 N N 110 n +N 15 SI $O 47 / /O 79 O O 111 o +O 16 DLE $P 48 0 0 80 P P 112 p +P 17 DC1 $Q 49 1 1 81 Q Q 113 q +Q 18 DC2 $R 50 2 2 82 R R 114 r +R 19 DC3 $S 51 3 3 83 S S 115 s +S 20 DC4 $T 52 4 4 84 T T 116 t +T 21 NAK $U 53 5 5 85 U U 117 u +U 22 SYN $V 54 6 6 86 V V 118 v +V 23 ETB $W 55 7 7 87 W W 119 w +W 24 CAN $X 56 8 8 88 X X 120 x +X 25 EM $Y 57 9 9 89 Y Y 121 y +Y 26 SUB $Z 58 : /Z 90 Z Z 122 z +Z 27 ESC %A 59 ; %F 91 [ %K 123 { %P 28 FS %B 60 < %G 92 \ %L 124 | %Q 29 GS %C 61 = %H 93 ] %M 125 } %R 30 RS %D 62 > %I 94 ^ %N 126 ~ %S 31 US %E 63 ? %J 95 _ %O 127 DEL %T, %X, %Y, %Z References
- ^ Allais, D. C. (2006) (PDF). AIDC Memoirs. http://aidc100.org/files/Allais-_David_Memoirs.pdf.
- ^ "MIL-STD-1189 Standard Department of Defense Barcode Symbology". 1989-08-10. https://assist.daps.dla.mil/quicksearch/basic_profile.cfm?ident_number=36123. Retrieved 2010-07-22.
- ^ "AIM/BC1 Uniform Symbology Specification". 1997-06-19. http://www.dscp.dla.mil/subs/support/specs/crds/milstan.asp. Retrieved 2011-04-06.
Barcodes Linear barcodes Automatic Car Identification - Code 39 - Code 93 - Code 128 - Codabar - European Article Number - GS1 DataBar - ITF-14 - MSI Barcode - Plessey - Telepen - UPC - PharmacodeUPC-A MaxiCode Post office barcodes 2D barcodes (stacked) 2D barcodes (matrix) Polar coordinate barcodes Other Technological issues Other data tags RFID - BokodeRelated topics Categories:- Barcodes
Wikimedia Foundation. 2010.