Code128條形碼是一個(gè)非常高密的字母數(shù)字條碼,能夠存儲(chǔ)需要的編碼數(shù)據(jù),它可以編碼所有128個(gè)ASCII碼字符,它使用最少的空間。
在Code128符號(hào)體系中,每個(gè)數(shù)據(jù)字符編碼都是由11個(gè)黑或白模塊組成,這11個(gè)模塊由三個(gè)條和三個(gè)空來(lái)形成,條和空可以由1-4個(gè)模塊的寬度來(lái)組成。停止字符由13個(gè)模塊組成。
code128碼符號(hào)包括一個(gè)靜止區(qū)(10倍X-尺寸 )、一個(gè)開(kāi)始字符、編碼數(shù)據(jù)、一個(gè)檢測(cè)字符、停止字符和一個(gè)尾部的靜止區(qū)(10倍X-尺寸),為了獲得最佳的掃描效果(使用接觸式掃描器),靜止區(qū)至少要在6.35mm以上。
為了保證條形碼的可讀性(絕大都數(shù)條碼掃描器都可以識(shí)度),最小的X-尺寸為7.5mil,最小的條形碼高度是條形碼寬度的15%或者6.35mm以上。
有106個(gè)不同的3條/3空組合,106個(gè)組合中的任何一個(gè)都可以被分配為三個(gè)不同字符集含義之一,code128的字符設(shè)置參見(jiàn)下面附錄。通過(guò)三個(gè)不同的開(kāi)始字符來(lái)進(jìn)行標(biāo)識(shí),START CodeA允許所有的鍵盤字符+控制字符和特殊字符進(jìn)行編碼,START CodeB包括所有標(biāo)準(zhǔn)字母數(shù)字鍵盤字符+小寫字母和特殊字符,START CodeC包括一個(gè)100位數(shù)字(00-99),可用于編碼數(shù)字?jǐn)?shù)據(jù)的密度壓縮。
在Code128條形碼內(nèi),可以通過(guò)特殊的字符代碼和SHIFT進(jìn)行代碼集之間的轉(zhuǎn)移,轉(zhuǎn)移到指定的字符集。
FNC代碼定義為條碼掃描器的指示。 FNC1是保留供將來(lái)使用。 FNC2告訴讀取器去存儲(chǔ)讀取的數(shù)據(jù)和傳輸它。FNC3是保留讀碼器初始化和其他讀碼器功能。 FNC4是保留為未來(lái)的應(yīng)用。
每個(gè)字符都有一個(gè)值,范圍從0到105,這個(gè)值被用來(lái)計(jì)算code128條形碼的校驗(yàn)字符。
校驗(yàn)字符通過(guò)MOD103算法,下面舉例說(shuō)明:
例子: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
計(jì)算: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)
注意:當(dāng)你打印校驗(yàn)字符“A”時(shí),你需打印ASCII字符數(shù)65(而不是33),你必須增加32到校驗(yàn)數(shù)上,然后找出打印的ASCII字符。比如說(shuō),你使用START A打印codeA條碼,計(jì)算出的校驗(yàn)數(shù)字是64,你可能會(huì)認(rèn)為打印一個(gè)NULL字符,那你就錯(cuò)了,你必須增加32得到一個(gè)96,你能夠打印出ASCII字符96( `字符)。
Code128條形碼的高度必須至少是條形碼寬度的0.15倍或者6.35mm,以兩個(gè)數(shù)值的較大者為準(zhǔn),Code128條形碼的總寬度由下面的公式得出:
L = (11C + 35)X (字母數(shù)字) ; L = (5.5C + 35)X(數(shù)字僅使用codeC)
這里:
L = code128條形碼的寬度(不包括靜止區(qū))(英寸為單位)
C = 數(shù)據(jù)字符、代碼字符和轉(zhuǎn)移字符的數(shù)量(不包括開(kāi)始、停止、校驗(yàn)字符,他們將被自動(dòng)添加)
X = X-尺寸(英寸為單位,比如,7mil條形碼的X-尺寸為0.007英寸)
下面使用三個(gè)例子,分別說(shuō)明code128條形碼長(zhǎng)度的計(jì)算:
1、下圖條形碼通過(guò)Bartender軟件編輯,采用code128A字符集,條形碼密度為16.39mil,字符數(shù)為7。
根據(jù)公式進(jìn)行計(jì)算L=(11*7+35)*0.01639=1.83568英寸=46.6mm
根據(jù)公式計(jì)算的code128條形碼寬度與軟件實(shí)際生成的條形碼寬度是一致的。
2、下圖條形碼通過(guò)Bartender軟件編輯,采用code128C字符集,條形碼密度為16.39mil,字符數(shù)為10。
根據(jù)公式(全部為codeC時(shí)的公式)進(jìn)行計(jì)算L=(5.5*10+35)*0.01639=1.4751英寸=37.5mm
根據(jù)公式計(jì)算的code128條形碼寬度與軟件實(shí)際生成的條形碼寬度是一致的。
采用code128C時(shí)也可以采用2位解碼的方式,如上圖所示的1256742345,可以解碼為“12”“56”“74”“23”“45”總共5個(gè)字符。
根據(jù)公式進(jìn)行計(jì)算L=(11*5+35)*0.01639=1.4751英寸=37.5mm,與使用另外一個(gè)公式的結(jié)果是一致的。
3、下圖條形碼通過(guò)Bartender軟件編輯,前面的小寫字母采用code128B字符集,后面的數(shù)字采用code128C字符集,中間使用了shift轉(zhuǎn)換字符,條形碼密度為16.39mil,字符數(shù)為10。
下面進(jìn)行字符數(shù)統(tǒng)計(jì):“abc”采用code128B字符集,計(jì)算為3個(gè)字符,“6742345”采用code128C字符集,計(jì)算為4個(gè)字符,中間轉(zhuǎn)換字符Shift計(jì)算為1個(gè)字符,總共為8個(gè)字符。
根據(jù)公式進(jìn)行計(jì)算L=(11*8+35)*0.01639=2.01597英寸=51.2mm
根據(jù)公式計(jì)算的code128條形碼寬度與軟件實(shí)際生成的條形碼寬度是一致的。
附錄:Code128條形碼字符表
下表顯示了三個(gè)不同的字符集,每個(gè)字符的十進(jìn)制值是用來(lái)計(jì)算校驗(yàn)字符。最后一列顯示的字符模式的條和空。數(shù)字顯示模塊的數(shù)量范圍內(nèi)給定的空間或酒吧。為了得到擴(kuò)展ASCII十進(jìn)制,添加32在第一列的十進(jìn)制值。這里有一個(gè)很好的擴(kuò)展ASCII表。請(qǐng)注意,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) |
值 |
開(kāi)始符號(hào) |
圖案 |
想要打印的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) |
閱讀本文的人還閱讀:
◆條碼掃描器選型
◆條碼掃描器價(jià)格和條碼掃描器報(bào)價(jià)
◆條形碼符號(hào)選型
◆條碼掃描器維修
◆上海條碼掃描器金牌服務(wù)體系
|