
EAN 8 consists of 7 characters
of data.
| How
do I calculate the check digit? |
This is easy, lets look at some data. Our
Data 5070929
All odd numbers are multiplied by 3 and the even number by 1.
Example.
| Char. Pos |
O |
E |
O |
E |
O |
E |
O |
Total = 92 |
| Data |
5 |
0 |
7 |
0 |
9 |
2 |
9 |
Modula 10 of 92 = 100 |
| Multiply |
3 |
1 |
3 |
1 |
3 |
1 |
3 |
|
| Results |
15 |
0 |
21 |
0 |
27 |
2 |
27 |
Check Digit = 8 |
The total minus the Modula 10
value of the total give you the check digit number.
| What
is the Layout of the Barcode? |
Below is a simple layout of the barcode.
| Start Character |
Left Hand Digits |
Center Bar |
Right Hand Data |
Check Digit |
Stop Character |
| 1 Digit |
4 Digits |
1 Digits |
3 Digit |
1 Digits |
1 Digit |
| How
do I encode the Barcode? |
Ok, to start with we have the first 4
characters, which are simply kept as they are, for example 5070.
The remaining 3 and the check digits are encoded with parity set C, shown below.
Parity Set C
| Font Character |
A |
B |
C |
D |
E |
F |
G |
H |
I |
J |
| Numeric Pos |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
Below is a table giving showing
our data encoded as EAN 8.
| Data |
Left
Data |
|
Right
Data |
Check Digit |
| Data |
5 |
0 |
7 |
0 |
|
9 |
2 |
9 |
|
8 |
| Index |
1 |
2 |
3 |
4 |
|
5 |
6 |
7 |
|
8 |
| Parity Set |
N |
O |
N |
E |
|
C |
C |
C |
|
C |
| Result |
5 |
0 |
7 |
0 |
|
J |
C |
J |
|
I |
| How
do I put it all together? |
Simple, we have our final encoded data,
now all we need to do is to add our additional control characters.
Result taken from above 5 0 7 0 J C J I
Start & Stop Characters is ( or ASCII code 40 Center Bar Character is - or ASCII code
45
Our Final Barcode looks like this (5070-JCJI(
To add "<" and ">" to the barcode simply add "<" in
front and ">" at the end of the final barcode string.
e.g. <(5070-JCJI(>
