Code 39 Introduction
Code 39 is an alphanumeric bar code. It is a discrete, variable-length symbology. It is still widely used-especially in inventory and industrial applications. It is the standard bar code used by the United States Department of Defense, and is also used by the Health Industry Bar Code Council (HIBCC). It is designed to encode 26 uppercase letters, 10 digits and 8 special characters(-, ., *, $, /, +, %, SPACE). It can be extended to code all 128 ASCII characters by using a two character coding scheme. Each data character encoded in a Code 39 symbol is made up of 5 bars and 4 spaces for a total of 9 elements. Each bar or space is either “wide” or “narrow” and 3 out of the 9 elements are always wide. That’s what gave the code its other name – Code 3 of 9.
Code 39 Check Digits Calculation
Code 39 does not normally include a check character, however there is an established check character for applications that need it. The value of each data character is summed up and divided by 43. The remainder is the value of the character to use as the check character. you can find the value of each character in the following table.
To calculate the optional checksum digit example :”EASESOFT1234″.
String
|
E
|
A
|
S
|
E
|
S
|
O
|
F
|
T
|
1
|
2
|
3
|
4
|
Value
|
14
|
10
|
28
|
14
|
28
|
24
|
15
|
29
|
1
|
2
|
3
|
4
|
- Sum the value of each of the values of each of the characters ,The sum is 14+10+28+14+28+24+15+29+1+2+3+4=172.
- Divide 172 by 43,the remainder is 0,so the checksum digit is 0.
Code 39 Encoding Table
Code 39 starts with ‘*’ and stops with ‘*’. The table below shows the Code 39 character set.The barcode pattern means the first character is Bar,the second is Space,the Third is Bar, The “w” indicates a wide element and the “n” indicated a narrow element. Please note that every character starts and ends with a bar .We set the wide-to-narrow ratio as 3, the intercharacter gap width as 1 space.
VALUE
|
CHAR
|
PATTERN
|
VALUE
|
CHAR
|
PATTERN
|
0 | 0 | NNNWWNWNN | 22 | M | WNWNNNNWN |
1 | 1 | WNNWNNNNW | 23 | N | NNNNWNNWW |
2 | 2 | NNWWNNNNW | 24 | O | WNNNWNNWN |
3 | 3 | WNWWNNNNN | 25 | P | NNWNWNNWN |
4 | 4 | NNNWWNNNW | 26 | Q | NNNNNNWWW |
5 | 5 | WNNWWNNNN | 27 | R | WNNNNNWWN |
6 | 6 | NNWWWNNNN | 28 | S | NNWNNNWWN |
7 | 7 | NNNWNNWNW | 29 | T | NNNNWNWWN |
8 | 8 | WNNWNNWNN | 30 | U | WWNNNNNNW |
9 | 9 | NNWWNNWNN | 31 | V | NWWNNNNNW |
10 | A | NNWWNNWNN | 32 | W | WWWNNNNNN |
11 | B | NNWNNWNNW | 33 | X | NWNNWNNNW |
12 | C | WNWNNWNNN | 34 | Y | WWNNWNNNN |
13 | D | NNNNWWNNW | 35 | Z | NWWNWNNNN |
14 | E | WNNNWWNNN | 36 | – | NWNNNNWNW |
15 | F | NNWNWWNNN | 37 | . | WWNNNNWNN |
16 | G | NNNNNWWNW | 38 | SPACE | NWWNNNWNN |
17 | H | WNNNNWWNN | 39 | $ | NWNWNWNNN |
18 | I | NNWNNWWNN | 40 | / | NWNWNNNWN |
19 | J | NNNNWWWNN | 41 | + | NWNNNWNWN |
20 | K | WNNNNNNWW | 42 | % | NNNWNWNWN |
21 | L | NNWNNNNWW | n/a | * | NWNNWNWNN |
The Extended Code 39 Encoding Table
Value | ASCII | Code 39 | Value | ASCII | Code 39 | Value | ASCII | Code 39 | Value | ASCII | Code 39 |
0 | NUL | %U | 32 | SP | Space | 64 | @ | %V | 96 | ` | %W |
1 | SOH(Start of Heading) | $A | 33 | ! | /A | 65 | A | A | 97 | a | +A |
2 | STX(Start of Text) | $B | 34 | “ | /B | 66 | B | B | 98 | b | +B |
3 | ETX(End of Text) | $C | 35 | # | /C | 67 | C | C | 99 | c | +C |
4 | EOT(End of Transmission) | $D | 36 | $ | /D | 68 | D | D | 100 | d | +D |
5 | ENQ (Enquiry) | $E | 37 | % | /E | 69 | E | E | 101 | e | +E |
6 | ACK (Acknowledge) | $F | 38 | & | /F | 70 | F | F | 102 | f | +F |
7 | BEL(Bell-Audible of Attention Signal) | $G | 39 | ‘ | /G | 71 | G | G | 103 | g | +G |
8 | BS(Backspace) | $H | 40 | ( | /H | 72 | H | H | 104 | H | H |
9 | HT(Horizontal Tabulation) | $I | 41 | ) | /I | 73 | I | I | 105 | i | +I |
10 | LF(Line Feed) | $J | 42 | * | /J | 74 | J | J | 106 | j | +J |
11 | VT(Vertical Tabulation) | $K | 43 | + | /K | 75 | K | K | 107 | k | +K |
12 | FF(Form Feed) | $L | 44 | , | /L | 76 | L | L | 108 | l | +L |
13 | CR (Carriage Return) | $M | 45 | – | – | 77 | M | M | 109 | m | +M |
14 | SO (Shift Out) | $N | 46 | . | . | 78 | N | N | 110 | n | +N |
15 | SI(Shift In) | $O | 47 | / | /O | 79 | O | O | 111 | o | +O |
16 | DLE (Data Link Escape) | $P | 48 | 0 | 0 | 80 | P | P | 112 | p | +P |
17 | DC1(Device Control 1-XON) | $Q | 49 | 1 | 1 | 81 | Q | Q | 113 | q | +Q |
18 | DC2 (Device Control 2) | $R | 50 | 2 | 2 | 82 | R | R | 114 | r | +R |
19 | DC3(Device Control 3-XOFF) | $S | 51 | 3 | 3 | 83 | S | S | 115 | s | +S |
20 | DC4 (Device Control 4) | $T | 52 | 4 | 4 | 84 | T | T | 116 | t | +T |
21 | NAK(Negative Acknowledge) | $U | 53 | 5 | 5 | 85 | U | U | 117 | u | +U |
22 | SYN(Synchronous Idle) | $V | 54 | 6 | 6 | 86 | V | V | 118 | v | +V |
23 | ETB (End of Transmission Block) | $W | 55 | 7 | 7 | 87 | W | W | 119 | w | +W |
24 | CAN (Cancel) | $X | 56 | 8 | 8 | 88 | X | X | 120 | x | +X |
25 | EM (End of Medium) | $Y | 57 | 9 | 9 | 89 | Y | Y | 121 | y | +Y |
26 | SUB (Substitute) | $Z | 58 | : | /Z | 90 | Z | Z | 122 | z | +Z |
27 | ESC(Escape) | %A | 59 | ; | %F | 91 | [ | %K | 123 | { | %P |
28 | FS(File separator) | %B | 60 | << | %G | 92 | \ | %L | 124 | | | %Q |
29 | GS(Group Separator) | %C | 61 | = | %H | 93 | ] | %M | 125 | } | %R |
30 | RS(Record Separator) | %D | 62 | > | %I | 94 | ^ | %N | 126 | ~ | %S |
31 | YS(Unit Separator) | %E | 63 | ? | %J | 95 | _ | %O | 127 | DEL | %T |
CODE 93 SYMBOLOGY
CODE 93 INTRODUCTION
Code 93 is an alphanumeric, continuous, variable-length symbology,it can encode the full ASCII character set. Code93 is used primarily by Canadian postal office to encode supplementary delivery information. Every symbol includes two check characters.Code 93 is similar to Code 39. It encodes 47 characters.Every code 93 symbol must include two check characters.
CODE 93 ENCODING TABLE
VALUE | CHARACTER | VALUE | CHARACTER |
0 | 0 | 24 | O |
1 | 1 | 25 | P |
2 | 2 | 26 | Q |
3 | 3 | 27 | R |
4 | 4 | 28 | S |
5 | 5 | 29 | T |
6 | 6 | 30 | U |
7 | 7 | 31 | V |
8 | 8 | 32 | W |
9 | 9 | 33 | X |
10 | A | 34 | Y |
11 | B | 35 | Z |
12 | C | 36 | – |
13 | D | 37 | . |
14 | E | 38 | SPACE |
15 | F | 39 | $ |
16 | G | 40 | / |
17 | H | 41 | + |
18 | I | 42 | % |
19 | J | 43 | $ Replace |
20 | K | 44 | % Replace |
21 | L | 45 | / Replace |
22 | M | 46 | + Replace |
23 | N | – | * Start/Stop |
Code 93 can encode 128 Full ASCII character, if the character is not included in the above table, then you need to encode it using the $, /, %, and + symbols as “shift” characters in the Extended Encoding Table.It is the same with the Code 39 Extended Encoding Table. Note that the characters $ ,% , / , and + in Code 93 Extended Encoding Table should use the replace one in above table.
Code 93 Check Digits Calculation
Code 93 always includes two check characters which are referred to as “C” and “K”.
- Take the value (0 through 47) of each character in the barcode (see the table to the left). The start and stop characters are not included in the checksum calculation.
- Assign the weight for each character. The right-most character has a weight value of 1, the second to last 2 and so on. After 20, the sequence goes back to 1.
- Multiply the character value with weight. Sum all the results.
- Divide the result by 47 and get the remainder. Reverse look up the remainder to get the character. This is check character “C”.
- Append the “C” character at the end of the data, and repeat the step1 through step 4. This time the weight ranges from 1 to 15. The result is the character “K”.
Example: “EaseSoft”, the “C” checksum would be calculated as follows:
Thus the sum of the individual weighted sums is 3168. Modulo 47 gives a value of 67 with remainder 19. The value 19is associated with the J, so the “C” check character is ‘J’..
The “K” checksum character is calculated in basically the same way except that the weighting goes from 1 to 15. Also, the right-most character is now the “C” checksum character which was calculated in the step above.
STRING | E | +Replace | A | +Replace | S | +Replace | E | S | +Replace | O | +Replace | F | +Replace | T | J |
VALUE | 14 | 46 | 10 | 46 | 28 | 46 | 14 | 28 | 46 | 24 | 46 | 15 | 46 | 29 | 19 |
WEIGHT | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
WEIGHTED SUM | 210 | 644 | 130 | 552 | 308 | 460 | 126 | 224 | 322 | 144 | 230 | 60 | 138 | 58 | 19 |
Thus the sum of the individual weighted sums is 3625. Modulo 47 gives us a value of 77 with a remainder of 6. The value 6 is associated with the ASCII character “6”, so the “K” check character would be encoded using the “6” symbol encodation from the table above.
STRUCTURE OF A CODE 93 BARCODE
- Start and Stop with asterisk (*) character.
- Any number of characters encoded from the table above.
- The “C” and “K” checksum digits calculated as described above.