
|
This code is part of 2 dimentional code family, it can encode up to 2335 characters on a very small surface. The encoding is done in two stages : first the datas are converted to 8 bits "codeword" (High level encoding) then those are converted to small black and white squares. (Low level encoding) Moreover an error correction system is included, it allows to reconstitute badly printed, erased, fuzzy or torn off datas. In the continuation of this talk, the word "codeword" will be shortened into CW.
A 2 x 2 regions code : 
|
Symbol size |
Number of |
Number of Reed |
Number of |
|
Square symbols |
|||
|
10x10 |
1 |
5 |
1 |
|
12x12 |
1 |
7 |
1 |
|
14x14 |
1 |
10 |
1 |
|
16x16 |
1 |
12 |
1 |
|
18x18 |
1 |
14 |
1 |
|
20x20 |
1 |
18 |
1 |
|
22x22 |
1 |
20 |
1 |
|
24x24 |
1 |
24 |
1 |
|
26x26 |
1 |
28 |
1 |
|
32x32 |
2x2 |
36 |
1 |
|
36x36 |
2x2 |
42 |
1 |
|
40x40 |
2x2 |
48 |
1 |
|
44x44 |
2x2 |
56 |
1 |
|
48x48 |
2x2 |
68 |
1 |
|
52x52 |
2x2 |
2 x 42 |
2 |
|
64x64 |
4x4 |
2 x 56 |
2 |
|
72x72 |
4x4 |
4 x 36 |
4 |
|
80x80 |
4x4 |
4 x 48 |
4 |
|
88x88 |
4x4 |
4 x 56 |
4 |
|
96x96 |
4x4 |
4 x 68 |
4 |
|
104x104 |
4x4 |
6 x 56 |
6 |
|
120x120 |
6x6 |
6 x 68 |
6 |
|
132x132 |
6x6 |
8 x 62 |
8 |
|
144x144 |
6x6 |
10 x 62 |
8 |
|
Rectangular symbols |
|||
|
8x18 |
1 |
7 |
1 |
|
8x32 |
2 |
11 |
1 |
|
12x26 |
1 |
14 |
1 |
|
12x36 |
1x2 |
18 |
1 |
|
16x36 |
1x2 |
24 |
1 |
|
16x48 |
1x2 |
28 |
1 |



|
Compaction mode |
Datas to encode |
Rate compaction |
|
ASCII |
ASCII character 0 to 127 |
1 byte per CW |
|
ASCII extended |
ASCII character 128 to 255 |
0.5 byte per CW |
|
ASCII numeric |
ASCII digits |
2 byte per CW |
|
C40 |
Upper-case alphanumeric |
1.5 byte per CW |
|
TEXT |
Lower-case alphanumeric |
1.5 byte per CW |
|
X12 |
ANSI X12 |
1.5 byte per CW |
|
EDIFACT |
ASCII character 32 to 94 |
1.33 bytet per CW |
|
BASE 256 |
ASCII character 0 to 255 |
1 byte per CW |
|
Codeword |
Data or function |
|
1 to 128 |
ASCII datas |
|
129 |
Padding |
|
130 to 229 |
Pair of digits : 00 to 999 |
|
230 |
Switch to C40 method |
|
231 |
Switch to Base 256 method |
|
232 |
FNC1 character |
|
233 |
Structure of several symbols |
|
234 |
Reader programming |
|
235 |
Shift to extended ASCII for one character |
|
236 |
Macro |
|
237 |
Macro |
|
238 |
Switch to ANSI X12 method |
|
239 |
Switch to TEXT method |
|
240 |
Switch to EDIFACT method |
|
241 |
Extended Channel Interpretation character |
|
254 |
If ASCII method is in force : |
|
The 253-state algorithm. |
|
Value |
Basic set for C40 |
Basic set for TEXT |
Shift 1 set |
Shift 2 set |
Shift 3 set for C40 |
Shift 3 for TEXT |
Set for X12 |
|
0 |
Shift 1 |
Shift 1 |
NUL (0) |
! (33) |
‘ (96) |
‘ (96) |
CR (13) |
|
1 |
Shift 2 |
Shift 2 |
SOH (1) |
" (34) |
a (97) |
A (65) |
* (42) |
|
2 |
Shift 3 |
Shift 3 |
STX (2) |
# (35) |
b (98) |
B (66) |
> (62) |
|
3 |
Space (32) |
Space (32) |
ETX (3) |
$ (36) |
c (99) |
C (67) |
Space (32) |
|
4 |
0 (48) |
0 (48) |
EOT (4) |
% (37) |
d (100) |
D (68) |
0 (48) |
|
5 |
1 (49) |
1 (49) |
ENQ (5) |
& (38) |
e (101) |
E (69) |
1 (49) |
|
6 |
2 (50) |
2 (50) |
ACK (6) |
' (39) |
f (102) |
F (70) |
2 (50) |
|
7 |
3 (51) |
3 (51) |
BEL (7) |
( (40) |
g (103) |
G (71) |
3 (51) |
|
8 |
4 (52) |
4 (52) |
BS (8) |
) (41) |
h (104) |
H (72) |
4 (52) |
|
9 |
5 (53) |
5 (53) |
HT (9) |
* (42) |
I (105) |
I (73) |
5 (53) |
|
10 |
6 (54) |
6 (54) |
LF (10) |
+ (43) |
j (106) |
J (74) |
6 (54) |
|
11 |
7 (55) |
7 (55) |
VT (11) |
, (44) |
k (107) |
K (75) |
7 (55) |
|
12 |
8 (56) |
8 (56) |
FF (12) |
- (45) |
l (108) |
L (76) |
8 (56) |
|
13 |
9 (57) |
9 (57) |
CR (13) |
. (46) |
m (109) |
M (77) |
9 (57) |
|
14 |
A (65) |
a (97) |
SO (14) |
/ (47) |
n (110) |
N (78) |
A (65) |
|
15 |
B (66) |
b (98) |
SI (15) |
: (58) |
o (111) |
O (79) |
B (66) |
|
16 |
C (67) |
c (99) |
DLE (16) |
; (59) |
p (112) |
P (80) |
C (67) |
|
17 |
D (68) |
d (100) |
DC1 (17) |
< (60) |
q (113) |
Q (81) |
D (68) |
|
18 |
E (69) |
e (101) |
DC2 (18) |
= (61) |
r (114) |
R (82) |
E (69) |
|
19 |
F (70) |
f (102) |
DC3 (19) |
> (62) |
s (115) |
S (83) |
F (70) |
|
20 |
G (71) |
g (103) |
DC4 (20) |
? (63) |
t (116) |
T (84) |
G (71) |
|
21 |
H (72) |
h (104) |
NAK (21) |
@ (64) |
u (117) |
U (85) |
H (72) |
|
22 |
I (73) |
I (105) |
SYN (22) |
[ (91) |
v (118) |
V (86) |
I (73) |
|
23 |
J (74) |
j (106) |
ETB (23) |
\ (92) |
w (119) |
W (87) |
J (74) |
|
24 |
K (75) |
k (107) |
CAN (24) |
] (93) |
x 120) |
X (88) |
K (75) |
|
25 |
L (76) |
l (108) |
EM (25) |
^ (94) |
y (121) |
Y (89) |
L (76) |
|
26 |
M (77) |
m (109) |
SUB (26) |
_ (95) |
z (122) |
Z (90) |
M (77) |
|
27 |
N (78) |
n (110) |
ESC (27) |
FNC1 |
{ (123) |
{ (123) |
N (78) |
|
28 |
O (79) |
o (111) |
FS (28) |
|
| (124) |
| (124) |
O (79) |
|
29 |
P (80) |
p (112) |
GS (29) |
|
}(125) |
}(125) |
P (80) |
|
30 |
Q (81) |
q (113) |
RS (30) |
Upper Shift |
~ (126) |
~ (126) |
Q (81) |
|
31 |
R (82) |
r (114) |
US (31) |
|
DEL (127) |
DEL (127) |
R (82) |
|
32 |
S (83) |
s (115) |
|
|
|
|
S (83) |
|
33 |
T (84) |
t (116) |
|
|
|
|
T (84) |
|
34 |
U (85) |
u (117) |
|
|
|
|
U (85) |
|
35 |
V (86) |
v (118) |
|
|
|
|
V (86) |
|
36 |
W (87) |
w (119) |
|
|
|
|
W (87) |
|
37 |
X (88) |
x 120) |
|
|
|
|
X (88) |
|
38 |
Y (89) |
y (121) |
|
|
|
|
Y (89) |
|
39 |
Z (90) |
z (122) |
|
|
|
|
Z (90) |
|
Sample, sequence to encode with C40 method : Ab The 3 characters are : 14, 02, 02 |
Extended characters are encoded as follows :
|
Example in C40: |
|
EDIFACT value |
ASCII value character |
Comment |
|
0 to 30 |
64 to 94 |
EDIFACT value = ASCII value - 64 |
|
31 |
|
End of datas, return to ASCII mode |
|
32 to 63 |
32 to 63 |
EDIFACT value = ASCII value |
|
Sample, sequence to encode with EDIFACT method : ABC! The 4 EDIFACT character values are : 1, 2, 3, 33 |
|
The 255-state algorithm. |
For i = 0 To m - 1
t = (d(i) Xor c(k - 1))
For j = k - 1 To 0 Step -1
If t = 0 Then
c(j) = 0
Else
c(j) = Mult(t, a(j))
End If
If j > 0 Then c(j) = c(j - 1) Xor c(j)
Next
Next
|
The power-of two Galois field arithmetic
operations.
Now we can calculate Mult = Alog((Log(a) + Log(b)) Mod 255) |
Since we can create the bar code pattern it remains us to draw it on the screen and to print it on a paper sheet. Two approaches are possible :
It seems that there's no free datamatrix barcode font on the net. I've decided
consequently to draw this font and to propose it for download. Since each symbol
have an even row number and an even column number, I put in each character of
the font 4 modules (2 rows and 2 columns). In this manner we have 16 combinations
assigned to the 16 first capital letters.
If we give a value at each dot
of this 2 x 2 matrix like this :
|
1 |
2 |
|
4 |
8 |
This font contains the 16 character A (ASCII : 65) to P (ASCII : 80)
|
Copy this file |
The software will evolve with 4 steps :
Because of the interaction between the different compaction modes it's difficult to make a 100% optimization. Thus the software will split the string into "parts" having the type "numeric", "text" or "byte" afterwards it will change some parts for an other mode if the overload due to switch CWs is greater than the compaction gain. We'll can't make allowance for all the parameters like paddings, ...

|
Click here ! |