0% found this document useful (0 votes)
32 views22 pages

CI Barcode

The checksum digit is 5.

Uploaded by

Faisal 420
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views22 pages

CI Barcode

The checksum digit is 5.

Uploaded by

Faisal 420
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

CSE 405

(Computer Interfacing)
Barcode
(Computer Peripherals by Cook & White)

Iyolita Islam

Department of Computer Science and Engineering


Military Institute of Science and Technology

Last Updated: May 16, 2023

Iyolita Islam CSE 405 (Computer Interfacing) 1 / 22


Unintentional Mistakes
Best efforts have been exercised in order to keep the slides error-free, the
preparer does not assume any responsibility for any unintentional mistakes.
The text books must be consulted by the user to check veracity of the
information presented.

Iyolita Islam CSE 405 (Computer Interfacing) 2 / 22


Outline

1 Barcode

2 Codes

3 Error Handling

Iyolita Islam CSE 405 (Computer Interfacing) 3 / 22


Introduction

Giving every item that you want to classify its own, unique
number and then simply print the number on the item so an
electronic scanning device can read it.
Trouble with decimal numbers:
• a misprinted number can show different one
• For example, eight could look like a three to a computer or a
six is identical to nine if you turn it upside down—which could
cause all sorts of chaos at the checkout if you scanned the
wrong way up

Iyolita Islam CSE 405 (Computer Interfacing) 4 / 22


Representation

Looking at a barcode, can’t make head or tail of it- where one


number ends and another one begins.
But it’s simple really.
Each digit in the product number is given the same amount of
horizontal space: exactly 7 units.
Then, to represent any of the numbers from zero through nine,
we simply color those seven units with a different pattern of black
and white stripes.

Iyolita Islam CSE 405 (Computer Interfacing) 5 / 22


Representation

The number one is represented by


coloring in two white stripes, two
black stripes, two white stripes, and
one black stripe
The first part of a barcode tells you
the country where it was issued.
The next part reveals the
manufacturer of the product.
The final part of the barcode
identifies the product itself.
Most products carry a simple
barcode known as the UPC
(universal product code)

Iyolita Islam CSE 405 (Computer Interfacing) 6 / 22


Barcode Scanner

Reading barcode involves determining the widths of the dark and


light bars across the pattern.
Elements of bar code may be only fractions of a millimeter wide
the reader has to focus to at least this resolution if a clean output
is to be produced

Iyolita Islam CSE 405 (Computer Interfacing) 7 / 22


Barcode Scanner

Iyolita Islam CSE 405 (Computer Interfacing) 8 / 22


Barcode Scanner

Barcode scanners have to be able to read the black-and-white


zebra lines on products extremely quickly and feed that
information to a computer or checkout terminal, which can
identify them immediately using a product database.
Lets’ assume, each black line corresponding to a one and each
white line a zero.

Iyolita Islam CSE 405 (Computer Interfacing) 9 / 22


Barcode Scanner

Scanning head shines LED or laser light onto barcode.


Light reflects back off barcode into a light-detecting electronic
component called a photoelectric cell
White areas of the barcode reflect most light; black areas reflect
least.
As the scanner moves past the barcode, the cell generates a
pattern of on-off pulses that correspond to the black and white
stripes.
An electronic circuit attached to the scanner converts these on-off
pulses into binary digits (zeros and ones).
The binary digits are sent to a computer attached to the scanner,
which detects the code as 11101011.

Iyolita Islam CSE 405 (Computer Interfacing) 10 / 22


Types of Barcode Scanner

In some scanners, there’s a single photoelectric cell and, as you


move the scanner head past the product, the cell detects each
part of the black-white barcode in turn.
In more sophisticated scanners, there’s a whole line of
photoelectric cells and the entire code is detected in one go.

Iyolita Islam CSE 405 (Computer Interfacing) 11 / 22


Types of Barcode Scanner

Pen Scanner: Need to run it across the barcode so it can reach


each block of black or white in turn
Wand Scanner: A wand scanner, the CCD or photocells read the
entire code at once.
Laser Scanner: The laser beam being bounced around at
high-speed by a spinning wheel so it reads products (literally) in a
flash
The best barcode scanners are so accurate that they make only one mistake
in something like 70 million pieces of scanned information!

Iyolita Islam CSE 405 (Computer Interfacing) 12 / 22


Coding of Barcode

UPC- Universal Product Coding


EAN-European Article Number
Numbers to be coded consist of
• Prefix(1 digit for UPC, 2 for EAN)
• Manufacturer number (5 digits)
• Item reference(5 digits)
• Check digit (1 digit)

Iyolita Islam CSE 405 (Computer Interfacing) 13 / 22


UPC-A

12 digit number
UPC prefix denotes the product category, 0 for grocery, 3 for
pharmaceuticals etc
The scan able area of every UPC-A barcode follows the pattern
SLLLLLLMRRRRRRE,
where S (start), M (middle), and E (end) guard patterns are
represented the same way on every UPC-A barcode and the L
(left) and R (right) sections collectively represent the 12
numerical digits that make each UPC-A unique.
The total width for a digit is always 7 modules; consequently,
UPC-A 12-digit number requires a total of 7×12 = 84 modules.
A complete UPC-A is 95 modules wide: 84 modules for the digits,
combined with 11 modules for the S (start), M (middle), and E
(end) guard patterns.

Iyolita Islam CSE 405 (Computer Interfacing) 14 / 22


UPC-A

Codes used on either side of the center line are different so that
the direction of scan can be determined
A scanner can determine whether it is scanning a symbol from
left-to-right or from right-to-left (the symbol is upside-down).
After seeing a S (start) or E (end) guard pattern (they are the
same, bar-space-bar, whichever direction they are read), the
scanner will first see odd parity digits, if scanning left-to-right, or
even parity digits, if scanning right-to-left.
With the parity/direction information, an upside-down symbol will
not confuse the scanner.
When confronted with an upside-down symbol, the scanner may
simply ignore it or recognize the digits and put them in the right
order.

Iyolita Islam CSE 405 (Computer Interfacing) 15 / 22


Codes

For UPC: left hand digits are encoded using ‘Left Hand A’
For EAN:
• The EAN scheme is encoded so that a UPC can be read and
so from 00 to 09 is not used in EPC.
• This helps to reduce the confusion between the UPC and EAN
labelled products.
• left hand digits are encoded using mixture of ‘Left Hand A’
and ‘Left Hand B’
• The first digit determines which coding to use for each of the
remaining six digits.

Iyolita Islam CSE 405 (Computer Interfacing) 16 / 22


Character Set for Coding

Iyolita Islam CSE 405 (Computer Interfacing) 17 / 22


EAN13 prefix

Iyolita Islam CSE 405 (Computer Interfacing) 18 / 22


Calculating the Checksum

1 Add the values of the digits in odd positions


2 Multiply this result by 3.
3 Add the values of the digits in even positions
4 Sum the results of steps 2 and 3.
5 The check character is the smallest number which, when added to
the result in step 4, produces a multiple of 10.

Iyolita Islam CSE 405 (Computer Interfacing) 19 / 22


Calculating the Checksum

1 Procedure is same for both UPC and EAN.


2 Just UPC does not have the first digit (as UPC is 12-digit code)
3 So it finds a first digit value of zero
4 This does not affect the calculation of check digit

Iyolita Islam CSE 405 (Computer Interfacing) 20 / 22


Checksum

Example
Assume the barcode data = 01234567890X and it is UPC code. Calculate
the checksum.

Since it consists of 12 digits,first digit will be considered as ‘0’


[0-012345-67890-X]
0 + 2 + 4 + 6 + 8 + 0 = 20
20 X 3 = 60
0+1 + 3 + 5 + 7 + 9 = 25
60 + 25 = 85
85 + X = 90 (next highest multiple of 10), therefore X = 5
(checksum)

Iyolita Islam CSE 405 (Computer Interfacing) 21 / 22


Iyolita Islam CSE 405 (Computer Interfacing) 22 / 22

You might also like