Code 39 Barcode FAQ & Tutorial
Code 39 is a common barcode type used for various labels such
as name badges, inventory and industrial applications. The symbology
of the Code 39 character set consists of barcode symbols representing
numbers 0-9, upper-case letters A-Z, the space character and the following
symbols: - . $ / + %. Lower-case characters may also be easily encoded
with the
extended
fonts provided in the
IDAutomation Code-39
Font Package.
The Code 39 barcode is the easiest of the alpha-numeric barcodes
to use and is designed for character self-checking, thus eliminating
the need for check character calculations. Code 39 is also known as
the 3 of 9 Barcode, Code 3 of 9 and Barcode39. Several standards exist
that dictate how Code 39 barcodes should be printed for certain implementations.
Although a checksum character is optional, many standards require it.
The checksum character is a type of MOD43 calculation
provided in many of the IDAutomation
font tools
for the Code
39 Barcode Fonts. Enabling the check digit option in IDAutomation
Barcode Components
and Applications
allows the component to automatically generate and include the
MOD43 checksum.
The following standards based on the 3 of 9 barcode require MOD43
check digits:
- LOGMARS (Logistics Applications of Automated Marking
and Reading Symbols) is a standard based on Code 39 used by the
United States Department of Defense. LOGMARS is defined by Military
Standard MIL-STD-1189B and others such as MIL-STD-129, MIL-STD-2073-1C
and MIL-STD-129N.
- HIBC (Health
Industry Barcode) is a barcode label used in the health care
product industry. Several implementations of HIBC also use
Code 128.
The complete Code 39 barcode consists of a start character, data
digits, an optional check character and a stop character.
| Start Character |
Data Digits |
Optional Check Character |
Stop Character |
| * |
CODE-39 |
P |
* |
 |
The Code 39 asterisk character is usually used as a start/stop character,
and should not be part of the data in the barcode. The asterisk may
be used as the start/stop character with fonts; however, this may cause
problems in some applications such as MS Word, because they may treat
text surrounded with asterisks as bold text. In IDAutomation
Code 39 barcode
fonts, the exclamation and parentheses characters are also used
as start/stop characters to avoid these problems and provide additional
functionality.
Printing & Generating Code 39 Barcodes
Printing of the Code 39 barcode as a font is an easy process if checksum
characters are not required for the implementation. If the checksum
is needed, IDAutomation provides several
Font Tools,
Components
and Applications
for this purpose.
IDAutomation Code 39 Barcode Fonts may be created directly from the
keyboard or
used in a calculated field to dynamically produce multiple symbols
in almost any application, including
Microsoft
Word,
Excel,
FileMaker,
QuickBooks
and OpenOffice.
To create a 3 of 9 barcode manually that encodes the data "BAR-CODE-39",
the following may be performed:
1. Select the IDAutomation Code 39 Barcode Font from the list
of installed fonts;
2. Type the start character of "*";
3. Enter the data to be encoded, which is "BAR-CODE-39";
4. Type the stop character of "*"
When the IDAutomation
Code 39 Barcode Font is used, the parenthesis may be used as the
start and stop characters to keep the asterisks from appearing in the
text interpretation. For example, (BAR-CODE-39).
Several
Barcode
Integration Guides are also available that suggest one or more barcode
39 printing options. These integration options should be examined to
determine whether to use barcode components, applications or fonts for
the printing of barcodes. A few of the
Barcode
Integration Guides offered include the following:
Reading Code 39 Barcodes
The most common
method of reading barcodes is with a
barcode scanner.
Most barcode scanners recommended by IDAutomation perform keyboard emulation
and receive power from the USB port, so that no external power supply
is required. When a barcode is scanned using keyboard emulation, the
data scanned appears at the cursor as if it had been typed in from the
keyboard.
Most barcode scanners have the ability to read Code 39 barcodes by
default, such as the
IDAutomation
USB Barcode Scanner. This scanner dependably reads the IDAutomation
Code 39 Barcode
Font and
Universal Barcode Font when printed as small as 6 points, which
is an X dimension of 4 mils.
The manual calculations described below are rarely necessary. IDAutomation
provides several
barcode font tools, plug-ins and source code samples that are free
to use with IDAutomation fonts, which
automatically format the start, stop and check characters to
the barcode fonts. Additionally, the check digit option in all
Components
and Applications
calculates and includes the checksum automatically.
Perform the following to calculate the optional modulus 43 check
character manually:
- Using the table below, obtain the number value of each data
character.
- Add all of these values together.
- Divide the total by 43 and obtain the remainder.
- The check character is the value of the remainder.
For example, perform the following calculations to determine the
check character using the data characters "CODE39":
- The values are 12, 24, 13, 14, 3 and 9.
- When added together, these total 75.
- Now divide 75 by 43 and the remainder is 32.
- The check character is W
Code 39 Character Values:
| Character |
Value |
Character |
Value |
| 0 |
0 |
M |
22 |
| 1 |
1 |
N |
23 |
| 2 |
2 |
O |
24 |
| 3 |
3 |
P |
25 |
| 4 |
4 |
Q |
26 |
| 5 |
5 |
R |
27 |
| 6 |
6 |
S |
28 |
| 7 |
7 |
T |
29 |
| 8 |
8 |
U |
30 |
| 9 |
9 |
V |
31 |
| A |
10 |
W |
32 |
| B |
11 |
X |
33 |
| C |
12 |
Y |
34 |
| D |
13 |
Z |
35 |
| E |
14 |
- |
36 |
| F |
15 |
. |
37 |
| G |
16 |
space |
38 |
| H |
17 |
$ |
39 |
| I |
18 |
/ |
40 |
| J |
19 |
+ |
41 |
| K |
20 |
% |
42 |
| L |
21 |
|
|
Within the IDAutomation
Code-39 Font Package,
extended
fonts are provided to easily encode lower-case characters in addition
to upper-case letters and numbers. When these fonts are not being used,
or when it is necessary to encode additional characters, shift functions
may be used to extend the character set according to ISO 646. In
order for Extended Code 39 to be decoded properly, the scanner must
first be programmed to read it. Otherwise, the scanner will simply scan
the existing data, for example "+C" instead
of "c."
When extended Code 39 is enabled, functions may be directly encoded
by using the format $? to specify
the function where ? equals the
character that represents the appropriate function in the chart below.
For example, Code$I3of9$M
will encode Code[TAB]3of9[RETURN].
The Extended Code 39 ASCII Character Table
|
The
Extended Code 39
ASCII Character Table |
| ASCII |
Code39 |
ASCII |
Code39 |
ASCII |
Code39 |
ASCII |
Code39 |
ASCII (Functions) |
Code39 |
| A |
A |
a |
+A |
0 |
0 |
ESC (Escape) |
%A |
SH (Start of Heading) |
$A |
| B |
B |
b |
+B |
1 |
1 |
FS (File Separator) |
%B |
SX (Start of Text) |
$B |
| C |
C |
c |
+C |
2 |
2 |
GS (Group Separator) |
%C |
EX (End of Text) |
$C |
| D |
D |
d |
+D |
3 |
3 |
RS (Record Separator) |
%D |
ET (End of Transmission) |
$D |
| E |
E |
e |
+E |
4 |
4 |
US (Unit Separator) |
%E |
EQ (Enquiry) |
$E |
| F |
F |
f |
+F |
5 |
5 |
; |
%F |
AK (Acknowledge) |
$F |
| G |
G |
g |
+G |
6 |
6 |
< |
%G |
BL (Bell-Audible of Attention
Signal) |
$G |
| H |
H |
h |
+H |
7 |
7 |
= |
%H |
BS (Backspace) |
$H |
| I |
I |
i |
+I |
8 |
8 |
> |
%I |
HT (Horizontal Tabulation) |
$I |
| J |
J |
j |
+J |
9 |
9 |
? |
%J |
LF (Line Feed) |
$J |
| K |
K |
k |
+K |
! |
/A |
[ |
%K |
VT (Vertical Tabulation) |
$K |
| L |
L |
l |
+L |
" |
/B |
\ |
%L |
FF (Form Feed) |
$L |
| M |
M |
m |
+M |
# |
/C |
] |
%M |
CR (Carriage Return) |
$M |
| N |
N |
n |
+N |
$ |
/D |
^ |
%N |
SO (Shift Out) |
$N |
| O |
O |
o |
+O |
% |
/E |
_ |
%O |
SI (Shift In) |
$O |
| P |
P |
p |
+P |
& |
/F |
{ |
%P |
DL (Data Link Escape) |
$P |
| Q |
Q |
q |
+Q |
' |
/G |
| |
%Q |
D1 (Device Control 1-XON) |
$Q |
| R |
R |
r |
+R |
( |
/H |
} |
%R |
D2 (Device Control
2) |
$R |
| S |
S |
s |
+S |
) |
/I |
~ |
%S |
D3 (Device Control 3-XOFF) |
$S |
| T |
T |
t |
+T |
* |
/J |
DEL |
%T |
D4 (Device Control 4) |
$T |
| U |
U |
u |
+U |
+ |
/K |
NU (Null) |
%U |
NK (Negative Acknowledge) |
$U |
| V |
V |
v |
+V |
, |
/L |
@ |
%V |
SY (Synchronous Idle) |
$V |
| W |
W |
w |
+W |
- |
/M |
` |
%W |
EB (End of Transmission Block) |
$W |
| X |
X |
x |
+X |
. |
/N |
SP
(= or ~ in the fonts) |
SP |
CN (Cancel) |
$X |
| Y |
Y |
y |
+Y |
/ |
/O |
EM (End of Medium) |
$Y |
| Z |
Z |
z |
+Z |
: |
/Z |
|
|
SB (Substitute) |
$Z |
Note:
A space symbol cannot usually be represented from a font
with ASCII 32. To overcome this problem in
the Code
39 barcode fonts, replace the symbol representing
a space with the "=" character. In IDAutomation
Extended
Code 39 barcode fonts, the "~" (tilde) character is used
for a space. New 2011
Version includes a special set of TrueType fonts to
encode the space character without a substitution character. |
Back to Top
|