How to read Code128 barcode

Source: Internet
Author: User
Tags control characters

Barcodes are the vertical strips that we see on the merchandise.

I wouldn't have been interested in that if I hadn't used this on the project. Barcodes actually fall into many categories, though they all look the same ... The common barcode code system is called 39 yards, 128 yards, 417 yards and so on. What I'm talking about today is 128 yards, or CODE128.  code128 code In fact also divided into three categories, namely 128A, 128B, 128C. The difference is that the corresponding character map is not the same. So how do you read Code128 yards? Take a look at the following picture: From left to right is a black and white bar code, black called "Bar" (B), White is called "Empty" (S). If you look closely, both the bar and the empty have 4 different widths. We give it a few values of 1, 2, 3, 4, from thin to coarse. Then we begin to read the bar code according to the value of the thickness, the result is as follows: 211232231131221213131222212222221224121213121211321132331112 Note the result is black and white. Don't just read the "article" and forget it's empty. There's a total of 61 people here. Code128 code has a first and a tail. The tail is always 2331112, which represents the end of Code128. The rest of the section is 6 bits for a block, including the head. There are 3 kinds of head: a) 211412 B) 211214 C) 211232. This indicates, respectively, what type this Code128 is. (ABC one of them) we will read out the code, remove the head and tail, re-split the block:231131 | 221213 | 131222 | 212222 |  221224 | 121213 | 121211 | 32113 is exactly 6 bits for a piece. The last block (except the trailing segment) is a check digit that checks whether the barcode is correctly encoded. Then, we have a character descriptor. (It should be said that I have this table) this character corresponds to what each number represents. This is the code128c type. C-Codes are purely numeric, and each block corresponds to a 2-digit number. Check the table can be 50 09 05 00 01 91 91.   With this knowledge, we can try to write a program to generate barcodes and identify barcodes. In fact, the generation is relatively simple, and the identification is more troublesome. Usually supermarkets use barcode guns, which are recognized by optical principles, because the reflective characteristics of black and white stripes are different. If you use software to identify images, it can be a bit of a hassle. But that's exactly what we're going to do.  : Code128 character list: You can see that Class A and Class B are the same from the first 64 characters of 0-63. Some of these control characters, such as Codea, indicate that this field is nextA block temporarily uses characters from the code128a character table. There are some other, not very common, interested friends who can refer to the GBT 15425-2002 EAN UCC System 128 code standard. NOTE: ABC is a 128A class, 128B class, 128C class character descriptor. Some class B characters are empty and the same as Class A.b,s,b,s,b,s//A B C2,1,2,2,2,2,//sp XX2,2,2,1,2,2,//! on2,2,2,2,2,1,//"1,2,1,2,2,3,//#1,2,1,3,2,2,//$1,3,1,2,2,2,//%1,2,2,2,1,3,//&1,2,2,3,1,2,//... -1,3,2,2,1,2,//(Geneva2,2,1,2,1,3,//)2,2,1,3,1,2,//* Ten2,3,1,2,1,2,//+ One1,1,2,2,3,2,//,1,2,2,1,3,2,//-1,2,2,2,3,1,//. -1,1,3,2,2,2,///1,2,3,1,2,2,//01,2,3,2,2,1,//12,2,3,2,1,1,//22,2,1,1,3,2,//32,2,1,2,3,1,//42,1,3,2,1,2,//52,2,3,1,1,2,//63,1,2,1,3,1,//73,1,1,2,2,2,//83,2,1,1,2,2,//93,2,1,2,2,1,//:3,1,2,2,1,2,//; -3,2,2,1,1,2,//<3,2,2,2,1,1,//=2,1,2,1,2,3,//>2,1,2,3,2,1,//? to2,3,2,1,2,1,//@1,1,1,3,2,3,//A1,3,1,1,2,3,//B1,3,1,3,2,1,//C1,1,2,3,1,3,//D-approx .1,3,2,1,1,3,//E Notoginseng1,3,2,3,1,1,//F2,1,1,3,1,3,//G2,3,1,1,1,3,//H2,3,1,3,1,1,//I1,1,2,1,3,3,//J1,1,2,3,3,1,//K1,3,2,1,3,1,//L1,1,3,1,2,3,//M1,1,3,3,2,1,//N1,3,3,1,2,1,//O3,1,3,1,2,1,//P2,1,1,3,3,1,//Q2,3,1,1,3,1,//R2,1,3,1,1,3,//S Wuyi2,1,3,3,1,1,//T2,1,3,1,3,1,//U3,1,1,1,2,3,//V3,1,1,3,2,1,//W3,3,1,1,2,1,//X3,1,2,1,1,3,//Y3,1,2,3,1,1,//Z3,3,2,1,1,1,//[3,1,3,1,1,1,//\2,2,1,4,1,1,//]4,3,1,1,1,1,//^1,1,1,2,2,4,//_1,1,1,4,2,2,//NUL '1,2,1,1,2,4,//SOH a1,2,1,4,2,1,//STX b1,4,1,1,2,2,//ETX C1,4,1,2,2,1,//EOT D1,1,2,2,1,4,//ENQ e1,1,2,4,1,2,//ACK F1,2,2,1,1,4,//BEL G1,2,2,4,1,1,//BS H1,4,2,1,1,2,//HT i1,4,2,2,1,1,//LF J2,4,1,2,1,1,//VT k2,2,1,1,1,4,//FF L4,1,3,1,1,1,//CR m2,4,1,1,1,2,//so n1,3,4,1,1,1,//SI o -1,1,1,2,4,2,//DLE P1,2,1,1,4,2,//DC1 Q Bayi1,2,1,2,4,1,//DC2 R1,1,4,2,1,2,//DC3 S1,2,4,1,1,2,//DC4 T1,2,4,2,1,1,//NAK u4,1,1,2,1,2,//SYN v4,2,1,1,1,2,//ETB W4,2,1,2,1,1,//CAN x2,1,2,1,3,1,//EM y2,1,4,1,2,1,//SUB z4,1,2,1,2,1,//ESC {1,1,1,1,4,3,//FS | the1,1,1,3,4,1,//GS}1,3,1,1,4,1,//RS ~ 941,1,4,1,1,3,//US DEL1,1,4,3,1,1,//FNC3 FNC34,1,1,1,1,3,//FNC2 FNC24,1,1,3,1,1,//shift Shift 981,1,3,1,4,1,//CodeC CodeC1,1,4,1,3,1,//codeb FNC4 codeb3,1,1,1,4,1,//FNC4 Codea Codea4,1,1,1,3,1,//FNC1 FNC1 FNC12,1,1,4,1,2,//Starta2,1,1,2,1,4,//STARTB2,1,1,2,3,2,//STARTC2,3,3,1,1,1,2,//Stop

How to read Code128 barcode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.