Code128條形碼是一個非常高密的字母數(shù)字條碼,能夠存儲需要的編碼數(shù)據(jù),它可以編碼所有128個ASCII碼字符,它使用最少的空間。
在Code128符號體系中,每個數(shù)據(jù)字符編碼都是由11個黑或白模塊組成,這11個模塊由三個條和三個空來形成,條和空可以由1-4個模塊的寬度來組成。停止字符由13個模塊組成。
code128碼符號包括一個靜止區(qū)(10倍X-尺寸 )、一個開始字符、編碼數(shù)據(jù)、一個檢測字符、停止字符和一個尾部的靜止區(qū)(10倍X-尺寸),為了獲得最佳的掃描效果(使用接觸式掃描器),靜止區(qū)至少要在6.35mm以上。
為了保證條形碼的可讀性(絕大都數(shù)條碼掃描器都可以識度),最小的X-尺寸為7.5mil,最小的條形碼高度是條形碼寬度的15%或者6.35mm以上。
有106個不同的3條/3空組合,106個組合中的任何一個都可以被分配為三個不同字符集含義之一,code128的字符設(shè)置參見下面附錄。通過三個不同的開始字符來進行標識,START CodeA允許所有的鍵盤字符+控制字符和特殊字符進行編碼,START CodeB包括所有標準字母數(shù)字鍵盤字符+小寫字母和特殊字符,START CodeC包括一個100位數(shù)字(00-99),可用于編碼數(shù)字數(shù)據(jù)的密度壓縮。
在Code128條形碼內(nèi),可以通過特殊的字符代碼和SHIFT進行代碼集之間的轉(zhuǎn)移,轉(zhuǎn)移到指定的字符集。
FNC代碼定義為條碼掃描器的指示。 FNC1是保留供將來使用。 FNC2告訴讀取器去存儲讀取的數(shù)據(jù)和傳輸它。FNC3是保留讀碼器初始化和其他讀碼器功能。 FNC4是保留為未來的應用。
每個字符都有一個值,范圍從0到105,這個值被用來計算code128條形碼的校驗字符。
校驗字符通過MOD103算法,下面舉例說明:
例子:BarCode 1
信息:StartB B a r C o d e 1
值:104 34 65 82 35 79 68 69 0 17
位置:- 1 2 3 4 5 6 7 8 9
計算:104+(34 *1)+(65 *2)+(82 *3)+ (35 *4) + (79 *5) +(68 *6) + (69 *7) + (0 *8) + (17 *9) = 2093
2093/103=20余 33
33=A
完整的條形碼信息: (Start B)BarCode 1(A)(STOP)
注意:當你打印校驗字符“A”時,你需打印ASCII字符數(shù)65(而不是33),你必須增加32到校驗數(shù)上,然后找出打印的ASCII字符。比如說,你使用START A打印codeA條碼,計算出的校驗數(shù)字是64,你可能會認為打印一個NULL字符,那你就錯了,你必須增加32得到一個96,你能夠打印出ASCII字符96( `字符)。
Code128條形碼的高度必須至少是條形碼寬度的0.15倍或者6.35mm,以兩個數(shù)值的較大者為準,Code128條形碼的總寬度由下面的公式得出:
L = (11C + 35)X (字母數(shù)字) ; L = (5.5C + 35)X(數(shù)字僅使用codeC)
這里:
L = code128條形碼的寬度(不包括靜止區(qū))(英寸為單位)
C = 數(shù)據(jù)字符、代碼字符和轉(zhuǎn)移字符的數(shù)量(不包括開始、停止、校驗字符,他們將被自動添加)
X = X-尺寸(英寸為單位,比如,7mil條形碼的X-尺寸為0.007英寸)
下面使用三個例子,分別說明code128條形碼長度的計算:
1、下圖條形碼通過Bartender軟件編輯,采用code128A字符集,條形碼密度為16.39mil,字符數(shù)為7。
根據(jù)公式進行計算L=(11*7+35)*0.01639=1.83568英寸=46.6mm
根據(jù)公式計算的code128條形碼寬度與軟件實際生成的條形碼寬度是一致的。
2、下圖條形碼通過Bartender軟件編輯,采用code128C字符集,條形碼密度為16.39mil,字符數(shù)為10。
根據(jù)公式(全部為codeC時的公式)進行計算L=(5.5*10+35)*0.01639=1.4751英寸=37.5mm
根據(jù)公式計算的code128條形碼寬度與軟件實際生成的條形碼寬度是一致的。
采用code128C時也可以采用2位解碼的方式,如上圖所示的1256742345,可以解碼為“12”“56”“74”“23”“45”總共5個字符。
根據(jù)公式進行計算L=(11*5+35)*0.01639=1.4751英寸=37.5mm,與使用另外一個公式的結(jié)果是一致的。
3、下圖條形碼通過Bartender軟件編輯,前面的小寫字母采用code128B字符集,后面的數(shù)字采用code128C字符集,中間使用了shift轉(zhuǎn)換字符,條形碼密度為16.39mil,字符數(shù)為10。
下面進行字符數(shù)統(tǒng)計:“abc”采用code128B字符集,計算為3個字符,“6742345”采用code128C字符集,計算為4個字符,中間轉(zhuǎn)換字符Shift計算為1個字符,總共為8個字符。
根據(jù)公式進行計算L=(11*8+35)*0.01639=2.01597英寸=51.2mm
根據(jù)公式計算的code128條形碼寬度與軟件實際生成的條形碼寬度是一致的。
附錄:Code128條形碼字符表
下表顯示了三個不同的字符集,每個字符的十進制值是用來計算校驗字符。最后一列顯示的字符模式的條和空。數(shù)字顯示模塊的數(shù)量范圍內(nèi)給定的空間或酒吧。為了得到擴展ASCII十進制,添加32在第一列的十進制值。這里有一個很好的擴展ASCII表。請注意,code128只能編碼英文字母。
值 |
Code A |
Code B |
Code C |
圖案 |
想要打印的ASCII字符 |
條 |
空 |
條 |
空 |
條 |
空 |
0 |
SP |
SP |
00 |
2 |
1 |
2 |
2 |
2 |
2 |
SP(ASCII 32) |
1 |
! |
! |
01 |
2 |
2 |
2 |
1 |
2 |
2 |
!(ASCII 33) |
2 |
" |
" |
02 |
2 |
2 |
2 |
2 |
2 |
1 |
"(ASCII 34) |
3 |
# |
# |
03 |
1 |
2 |
1 |
2 |
2 |
3 |
#(ASCII 35) |
4 |
$ |
$ |
04 |
1 |
2 |
1 |
3 |
2 |
2 |
$ (ASCII 36) |
5 |
% |
% |
05 |
1 |
3 |
1 |
2 |
2 |
2 |
% (ASCII 37) |
6 |
& |
& |
06 |
1 |
2 |
2 |
2 |
1 |
3 |
& (ASCII 38) |
7 |
' |
' |
07 |
1 |
2 |
2 |
3 |
1 |
2 |
' (ASCII 39) |
8 |
( |
( |
08 |
1 |
3 |
2 |
2 |
1 |
2 |
( (ASCII 40) |
9 |
) |
) |
09 |
2 |
2 |
1 |
2 |
1 |
3 |
) (ASCII 41) |
10 |
* |
* |
10 |
2 |
2 |
1 |
3 |
1 |
2 |
* (ASCII 42) |
11 |
+ |
+ |
11 |
2 |
3 |
1 |
2 |
1 |
2 |
+ (ASCII 43) |
12 |
, |
, |
12 |
1 |
1 |
2 |
2 |
3 |
2 |
, (ASCII 44) |
13 |
- |
- |
13 |
1 |
2 |
2 |
1 |
3 |
2 |
- (ASCII 45) |
14 |
. |
. |
14 |
1 |
2 |
2 |
2 |
3 |
1 |
. (ASCII 46) |
15 |
/ |
/ |
15 |
1 |
1 |
3 |
2 |
2 |
2 |
/ (ASCII 47) |
16 |
0 |
0 |
16 |
1 |
2 |
3 |
1 |
2 |
2 |
0 (ASCII 48) |
17 |
1 |
1 |
17 |
1 |
2 |
3 |
2 |
2 |
1 |
1(ASCII 49) |
18 |
2 |
2 |
18 |
2 |
2 |
3 |
2 |
1 |
1 |
2 (ASCII 50) |
19 |
3 |
3 |
19 |
2 |
2 |
1 |
1 |
3 |
2 |
3 (ASCII 51) |
20 |
4 |
4 |
20 |
2 |
2 |
1 |
2 |
3 |
1 |
4 (ASCII 52) |
21 |
5 |
5 |
21 |
2 |
1 |
3 |
2 |
1 |
2 |
5 (ASCII 53) |
22 |
6 |
6 |
22 |
2 |
2 |
3 |
1 |
1 |
2 |
6 (ASCII 54) |
23 |
7 |
7 |
23 |
3 |
1 |
2 |
1 |
3 |
1 |
7 (ASCII 55) |
24 |
8 |
8 |
24 |
3 |
1 |
1 |
2 |
2 |
2 |
8 (ASCII 56) |
25 |
9 |
9 |
25 |
3 |
2 |
1 |
1 |
2 |
2 |
9 (ASCII 57) |
26 |
: |
: |
26 |
3 |
2 |
1 |
2 |
2 |
1 |
: (ASCII 57) |
27 |
; |
; |
27 |
3 |
1 |
2 |
2 |
1 |
2 |
; (ASCII 59) |
28 |
< |
< |
28 |
3 |
2 |
2 |
1 |
1 |
2 |
< (ASCII 60) |
29 |
= |
= |
29 |
3 |
2 |
2 |
2 |
1 |
1 |
= (ASCII 61) |
30 |
> |
> |
30 |
2 |
1 |
2 |
1 |
2 |
3 |
> (ASCII 62) |
31 |
? |
? |
31 |
2 |
1 |
2 |
3 |
2 |
1 |
? (ASCII 63) |
32 |
@ |
@ |
32 |
2 |
3 |
2 |
1 |
2 |
1 |
@ (ASCII 64) |
33 |
A |
A |
33 |
1 |
1 |
1 |
3 |
2 |
3 |
A (ASCII 65) |
34 |
B |
B |
34 |
1 |
3 |
1 |
1 |
2 |
3 |
B (ASCII 66) |
35 |
C |
C |
35 |
1 |
3 |
1 |
3 |
2 |
1 |
C (ASCII 67) |
36 |
D |
D |
36 |
1 |
1 |
2 |
3 |
1 |
3 |
D (ASCII 68) |
37 |
E |
E |
37 |
1 |
3 |
2 |
1 |
1 |
3 |
E (ASCII 69) |
38 |
F |
F |
38 |
1 |
3 |
2 |
3 |
1 |
1 |
F (ASCII 70) |
39 |
G |
G |
39 |
2 |
1 |
1 |
3 |
1 |
3 |
G (ASCII 71) |
40 |
H |
H |
40 |
2 |
3 |
1 |
1 |
1 |
3 |
H (ASCII 72) |
41 |
I |
I |
41 |
2 |
3 |
1 |
3 |
1 |
1 |
I (ASCII 73) |
42 |
J |
J |
42 |
1 |
1 |
2 |
1 |
3 |
3 |
J (ASCII 74) |
43 |
K |
K |
43 |
1 |
1 |
2 |
3 |
3 |
1 |
K (ASCII 75) |
44 |
L |
L |
44 |
1 |
3 |
2 |
1 |
3 |
1 |
L (ASCII 76) |
45 |
M |
M |
45 |
1 |
1 |
3 |
1 |
2 |
3 |
M (ASCII 77) |
46 |
N |
N |
46 |
1 |
1 |
3 |
3 |
2 |
1 |
N (ASCII 78) |
47 |
O |
O |
47 |
1 |
3 |
3 |
1 |
2 |
1 |
O (ASCII 79) |
48 |
P |
P |
48 |
3 |
1 |
3 |
1 |
2 |
1 |
P (ASCII 80) |
49 |
Q |
Q |
49 |
2 |
1 |
1 |
3 |
3 |
1 |
Q (ASCII 81) |
50 |
R |
R |
50 |
2 |
3 |
1 |
1 |
3 |
1 |
R (ASCII 82) |
51 |
S |
S |
51 |
2 |
1 |
3 |
1 |
1 |
3 |
S (ASCII 83) |
52 |
T |
T |
52 |
2 |
1 |
3 |
3 |
1 |
1 |
T (ASCII 84) |
53 |
U |
U |
53 |
2 |
1 |
3 |
1 |
3 |
1 |
U (ASCII 85) |
54 |
V |
V |
54 |
3 |
1 |
1 |
1 |
2 |
3 |
V (ASCII 86) |
55 |
W |
W |
55 |
3 |
1 |
1 |
3 |
2 |
1 |
W (ASCII 87) |
56 |
X |
X |
56 |
3 |
3 |
1 |
1 |
2 |
1 |
X (ASCII 88) |
57 |
Y |
Y |
57 |
3 |
1 |
2 |
1 |
1 |
3 |
Y (ASCII 89) |
58 |
Z |
Z |
58 |
3 |
1 |
2 |
3 |
1 |
1 |
Z (ASCII 90) |
59 |
[ |
[ |
59 |
3 |
3 |
2 |
1 |
1 |
1 |
[ (ASCII 91) |
60 |
\ |
\ |
60 |
3 |
1 |
4 |
1 |
1 |
1 |
\ (ASCII 92) |
61 |
] |
] |
61 |
2 |
2 |
1 |
4 |
1 |
1 |
] (ASCII 93) |
62 |
^ |
^ |
62 |
4 |
3 |
1 |
1 |
1 |
1 |
^ (ASCII 94) |
63 |
_ |
_ |
63 |
1 |
1 |
1 |
2 |
2 |
4 |
_ (ASCII 95) |
64 |
NUL |
` |
64 |
1 |
1 |
1 |
4 |
2 |
2 |
` (ASCII 96) |
65 |
SOH |
a |
65 |
1 |
2 |
1 |
1 |
2 |
4 |
a (ASCII 97) |
66 |
STX |
b |
66 |
1 |
2 |
1 |
4 |
2 |
1 |
b (ASCII 98) |
67 |
ETX |
c |
67 |
1 |
4 |
1 |
1 |
2 |
2 |
c (ASCII 99) |
68 |
EOT |
d |
68 |
1 |
4 |
1 |
2 |
2 |
1 |
d (ASCII 100) |
69 |
ENQ |
e |
69 |
1 |
1 |
2 |
2 |
1 |
4 |
e (ASCII 101) |
70 |
ACK |
f |
70 |
1 |
1 |
2 |
4 |
1 |
2 |
f (ASCII 102) |
71 |
BEL |
g |
71 |
1 |
2 |
2 |
1 |
1 |
4 |
g (ASCII 103) |
72 |
BS |
h |
72 |
1 |
2 |
2 |
4 |
1 |
1 |
h (ASCII 104) |
73 |
HT |
i |
73 |
1 |
4 |
2 |
1 |
1 |
2 |
i (ASCII 105) |
74 |
LF |
j |
74 |
1 |
4 |
2 |
2 |
1 |
1 |
j (ASCII 106) |
75 |
VT |
k |
75 |
2 |
4 |
1 |
2 |
1 |
1 |
k (ASCII 107) |
76 |
FF |
l |
76 |
2 |
2 |
1 |
1 |
1 |
4 |
l (ASCII 108) |
77 |
CR |
m |
77 |
4 |
1 |
3 |
1 |
1 |
1 |
m (ASCII 109) |
78 |
SO |
n |
78 |
2 |
4 |
1 |
1 |
1 |
2 |
n (ASCII 110) |
79 |
SI |
o |
79 |
1 |
3 |
4 |
1 |
1 |
1 |
o (ASCII 111) |
80 |
DLE |
p |
80 |
1 |
1 |
1 |
2 |
4 |
2 |
p (ASCII 112) |
81 |
DC1 |
q |
81 |
1 |
2 |
1 |
1 |
4 |
2 |
q (ASCII 113) |
82 |
DC2 |
r |
82 |
1 |
2 |
1 |
2 |
4 |
1 |
r (ASCII 114) |
83 |
DC3 |
s |
83 |
1 |
1 |
4 |
2 |
1 |
2 |
s (ASCII 115) |
84 |
DC4 |
t |
84 |
1 |
2 |
4 |
1 |
1 |
2 |
t (ASCII 116) |
85 |
NAK |
u |
85 |
1 |
2 |
4 |
2 |
1 |
1 |
u (ASCII 117) |
86 |
SYN |
v |
86 |
4 |
1 |
1 |
2 |
1 |
2 |
v (ASCII 118) |
87 |
ETB |
w |
87 |
4 |
2 |
1 |
1 |
1 |
2 |
w (ASCII 119) |
88 |
CAN |
x |
88 |
4 |
2 |
1 |
2 |
1 |
1 |
x (ASCII 120) |
89 |
EM |
y |
89 |
2 |
1 |
2 |
1 |
4 |
1 |
y (ASCII 121) |
90 |
SUB |
z |
90 |
2 |
1 |
4 |
1 |
2 |
1 |
z (ASCII 122) |
91 |
ESC |
{ |
91 |
4 |
1 |
2 |
1 |
2 |
1 |
{ (ASCII 123) |
92 |
FS |
| |
92 |
1 |
1 |
1 |
1 |
4 |
3 |
| (ASCII 124) |
93 |
GS |
} |
93 |
1 |
1 |
1 |
3 |
4 |
1 |
} (ASCII 125) |
94 |
RS |
~ |
94 |
1 |
3 |
1 |
1 |
4 |
1 |
~ (ASCII 126) |
95 (Hex 7F) |
US |
DEL |
95 |
1 |
1 |
4 |
1 |
1 |
3 |
DEL (ASCII 127) |
96 (Hex 80) |
FNC 3 |
FNC 3 |
96 |
1 |
1 |
4 |
3 |
1 |
1 |
? (ASCII 128) |
97 (Hex 81) |
FNC 2 |
FNC 2 |
97 |
4 |
1 |
1 |
1 |
1 |
3 |
ü (ASCII 129) |
98 (Hex 82) |
SHIFT |
SHIFT |
98 |
4 |
1 |
1 |
3 |
1 |
1 |
é (ASCII 130) |
99 (Hex 83) |
CODE C |
CODE C |
99 |
1 |
1 |
3 |
1 |
4 |
1 |
a (ASCII 131) |
100 (Hex 84) |
CODE B |
FNC 4 |
CODE B |
1 |
1 |
4 |
1 |
3 |
1 |
? (ASCII 132) |
101 (Hex 85) |
FNC 4 |
CODE A |
CODE A |
3 |
1 |
1 |
1 |
4 |
1 |
à (ASCII 133) |
102 (Hex 86) |
FNC 1 |
FNC 1 |
FNC 1 |
4 |
1 |
1 |
1 |
3 |
1 |
? (ASCII 134) |
值 |
開始符號 |
圖案 |
想要打印的ASCII字符 |
條 |
空 |
條 |
空 |
條 |
空 |
103 (Hex 87) |
START (Code A) |
2 |
1 |
1 |
4 |
1 |
2 |
? (ASCII 135) |
104 (Hex 88) |
START (Code B) |
2 |
1 |
1 |
2 |
1 |
4 |
? (ASCII 136) |
105 (Hex 89) |
START (Code C) |
2 |
1 |
1 |
2 |
3 |
2 |
‰ (ASCII 137) |
106 (Hex 6A) |
STOP (All Codes) |
2 |
3 |
3 |
1 |
1,1 |
2 |
? (ASCII 138) |
閱讀本文的人還閱讀:
◆條碼掃描器選型
◆條碼掃描器價格和條碼掃描器報價
◆條形碼符號選型
◆條碼掃描器維修
◆上海條碼掃描器金牌服務體系
|