Barcode Technology

Barcode History

Barcode Label Paper

Barcode Printer

Barcode Application

Inventory Management

AI Barcode QRCode

Barcode Scanner

Barcode Software

Barcode Software B

Barcode Software C

Barcode Software D

Barcode Software E

New Technology A

New Technology B

Robot Technology

Barcode Types

Barcode Types B

Barcode Types C

Barcode Types D

Barcode Types E

Barcode Types F

Electronic Technology

Psychology at Work

Barcode Technology and Barcode Software Related   <<< Back to Directory <<<

The Hidden Eye: How Barcode Recognition Circuits Work (P13)

The Digitised Waveform - Now a Time Series: How the Comparator's Output Becomes a Stream of Pulses

Subtitle: A Deep Dive into the Digital Domain, Edge Timing, and the Birth of the Barcode's Digital Representation - with Real-World Designs from Symbol, Zebra, Honeywell, Datalogic, Microchip, and NXP

Opening Summary

At the end of the analogue signal chain, the comparator performs its final, decisive act. It turns the continuously varying voltage of the amplified and conditioned barcode signal into a clean, two-level digital waveform. This waveform is a time series - a sequence of high and low states that correspond to the white spaces and black bars of the barcode. This digital waveform is the input to the decoder. It is the raw material from which the bar widths are measured, the characters are decoded, and the final data is extracted.

This article is dedicated to the digitised waveform - the square wave that emerges from the comparator. We will explore the nature of this waveform, its key characteristics, and how it represents the barcode's pattern. We will examine the timing parameters: the pulse widths, the edge separations, and the duty cycle. We will look at how major companies have captured and processed this waveform in their products. We will see how Symbol (now Zebra) used a timer/capture module in the LS2208's microcontroller to measure the pulse widths. We will explore Honeywell's use of a direct memory access (DMA) engine to offload the edge capture from the CPU. We will examine Datalogic's use of a high-speed counter to measure the pulse widths with high precision. We will also look at Microchip's and NXP's reference designs, which include detailed examples of edge capture and decoding.

By the end of this journey, you will understand that the digitised waveform is not just a simple square wave but a rich source of timing information. You will see how the pulse widths encode the barcode's data, and how the decoder extracts that data by measuring the time between edges.

Full Article

Section 1: The Digitised Waveform - The Final Analogue Product

The comparator's output is a digital square wave. It has two states: high (logic '1') and low (logic '0'). The high state represents a white space; the low state represents a black bar. The waveform is a time series - a sequence of high and low pulses, each with a specific duration.

The waveform is a faithful representation of the barcode's pattern. A narrow black bar produces a short low pulse. A wide black bar produces a long low pulse. A narrow white space produces a short high pulse. A wide white space produces a long high pulse. The sequence of pulse widths contains all the information about the barcode.

The waveform is the input to the decoder. The decoder measures the pulse widths and uses them to determine the bar and space widths. The decoder then interprets the pattern to produce the barcode's data.

Section 2: The Pulse Widths - The Barcode's Language

The pulse widths are the language of the barcode. The barcode is a series of bars and spaces of varying widths. Each bar or space has a width that is an integer multiple of a base unit, called the 'module.' The narrowest bar or space is one module wide. The wider bars and spaces are two, three, or four modules wide.

The comparator's output represents these widths as pulse durations. A one-module bar is a short pulse. A two-module bar is a longer pulse. A three-module bar is an even longer pulse. The decoder measures these pulse durations and converts them back into module widths.

The pulse widths are measured relative to a time reference. The time reference is usually the scanner's clock or a timer. The decoder measures the duration of each pulse in clock cycles.

Section 3: The Edges - The Information Carriers

The edges of the digitised waveform are the transitions between high and low states. The rising edges (low to high) occur at the boundaries between black bars and white spaces. The falling edges (high to low) occur at the boundaries between white spaces and black bars.

The edges are the information carriers. The timing of the edges - the time between successive edges - determines the pulse widths. The decoder measures the time between edges to determine the bar and space widths.

The edge timing must be measured accurately. A small error in the edge timing can cause a decoding error. The edge timing is measured by the microcontroller's timer/capture module.

Section 4: Symbol's LS2208 - Edge Capture with a Timer

Symbol's LS2208 uses a microcontroller with a timer/capture module. The comparator's output is connected to a capture input pin. The capture module records the timer's value when an edge occurs. The timer runs at a fixed frequency (e.g., 1 MHz). The recorded timer values are used to calculate the pulse widths.

The LS2208's firmware uses an interrupt service routine (ISR) to read the capture values. The ISR is triggered on every edge. The ISR reads the timer value, calculates the pulse width (by subtracting the previous value), and stores the pulse width in a buffer. The buffer is then processed by the decoder.

The LS2208's edge capture is a classic, proven technique. It is simple, robust, and efficient.

Section 5: The Capture Timer - The Heart of the Measurement

The capture timer is the heart of the edge measurement. The timer is a free-running counter that increments at a fixed frequency. The capture module records the counter's value when an edge occurs. The timer's frequency determines the resolution of the measurement.

A higher timer frequency gives a higher resolution. A 1-MHz timer gives a resolution of 1 microsecond. A 10-MHz timer gives a resolution of 0.1 microsecond. The timer frequency is chosen to provide sufficient resolution for the barcode's smallest features.

The timer is usually a 16-bit or 32-bit counter. A 16-bit counter can count up to 65535. With a 1-MHz clock, the counter rolls over every 65.5 milliseconds. This is long enough for a typical barcode scan. For longer scans, a 32-bit counter is used.

Section 6: The Interrupt Service Routine - The Edge Handler

The interrupt service routine (ISR) is the firmware that handles the edges. The ISR is triggered on every edge of the comparator's output. The ISR reads the timer value, calculates the pulse width, and stores the result.

The ISR must be fast. It must execute quickly to avoid missing the next edge. The ISR is typically written in assembly language or in a highly optimized high-level language. The ISR must also be interrupt-driven, meaning it is triggered by the hardware, not by a polling loop.

The LS2208's ISR is a classic example of an efficient interrupt handler. It reads the timer, calculates the pulse width, and stores the result in a circular buffer. The ISR then returns, allowing the CPU to process other tasks.

Section 7: The Circular Buffer - A Data Store

The circular buffer is a data store for the pulse widths. The buffer is a fixed-size array in memory. The ISR writes the pulse widths to the buffer. The decoder reads the pulse widths from the buffer. The buffer is circular, meaning that when the buffer is full, the new data overwrites the oldest data.

The circular buffer is a standard technique for handling real-time data. It decouples the ISR (which produces the data) from the decoder (which consumes the data). The ISR can write data as fast as it arrives, and the decoder can read the data when it is ready.

The buffer's size is chosen to hold enough data for a complete barcode. A typical barcode has 30-50 elements. The buffer is sized to hold 100-200 pulse widths.

Section 8: Honeywell's DMA - Offloading the CPU

Honeywell's imagers use a direct memory access (DMA) engine to offload the edge capture from the CPU. The DMA engine is a hardware block that can transfer data from a peripheral (e.g., the capture timer) to memory without CPU intervention. The DMA engine is configured to read the capture values and write them to a buffer.

The DMA engine reduces the CPU's workload. The CPU does not have to handle every edge. The DMA engine handles the edge capture, and the CPU is free to perform other tasks, such as decoding or communication.

The DMA engine is a standard feature of many modern microcontrollers. It is used in Honeywell's high-end imagers to achieve high performance.

Section 9: Datalogic's High-Speed Counter

Datalogic's industrial scanners use a high-speed counter to measure the pulse widths. The high-speed counter is a dedicated hardware block that can count pulses at very high frequencies (e.g., up to 100 MHz). The counter provides a very high resolution for the pulse width measurement.

The high-speed counter is used in Datalogic's PowerScan series, which is designed for high-speed conveyor-belt applications. The counter's high resolution allows the scanner to accurately measure the very narrow bars of a fast-moving barcode.

Section 10: The Pulse Widths - From Timer Counts to Microseconds

The pulse widths are measured in timer counts. The timer counts are converted to microseconds by multiplying by the timer's period. For example, if the timer frequency is 1 MHz, each count is 1 microsecond. A count of 100 corresponds to a 100-microsecond pulse.

The conversion from counts to microseconds is done in the decoder. The decoder uses the timer's period to convert the counts to time values. The time values are then used to calculate the bar and space widths.

Section 11: The Decoder - From Pulse Widths to Data

The decoder is the firmware that interprets the pulse widths. The decoder's first step is to determine the module width. The module width is the width of the narrowest bar or space. The decoder estimates the module width by finding the smallest pulse width in the sequence.

The decoder then classifies each pulse as narrow, medium, or wide. A narrow pulse is one module wide. A medium pulse is two modules wide. A wide pulse is three or four modules wide. The classification is done by comparing each pulse width to the module width.

The decoder then looks up the pattern of narrow, medium, and wide pulses in a table. The table contains the known patterns for each character. The decoder finds the matching pattern and outputs the corresponding character.

Section 12: The Module Width - The Fundamental Unit

The module width is the fundamental unit of the barcode. It is the width of the narrowest bar or space. The module width is determined by the print quality and the scanning speed.

The decoder must estimate the module width from the measured pulse widths. The estimation is done by finding the smallest pulse width in the sequence. The smallest pulse width is assumed to be one module wide.

The module width estimation is critical. If the module width is estimated incorrectly, all the subsequent classifications will be wrong.

Section 13: The Classification of Pulse Widths

The classification of pulse widths is done by comparing each pulse width to the module width. A pulse that is close to the module width is classified as narrow. A pulse that is about twice the module width is classified as medium. A pulse that is about three or four times the module width is classified as wide.

The classification uses a margin of error. A pulse that is within +/- 25% of the module width is classified as narrow. A pulse that is within +/- 25% of twice the module width is classified as medium. A pulse that is within +/- 25% of three or four times the module width is classified as wide.

The margin of error accounts for variations in the print quality and the scanning speed.

Section 14: The Lookup Table - From Patterns to Characters

The lookup table is a table that maps patterns of narrow, medium, and wide pulses to characters. The table is specific to the barcode symbology. For Code 39, the table maps a 9-element pattern (5 bars and 4 spaces) to a character.

The decoder finds the matching pattern in the table. The pattern is a sequence of narrow, medium, and wide elements. The decoder compares the measured pattern to the patterns in the table. If a match is found, the decoder outputs the corresponding character.

The lookup table is stored in the microcontroller's program memory.

Section 15: The Checksum - Validating the Data

The decoder calculates a checksum from the decoded data. The checksum is a mathematical function of the data. The checksum is compared to a checksum that is encoded in the barcode. If the two checksums match, the data is valid. If they do not match, the scan is rejected.

The checksum is an essential error-checking mechanism. It prevents the decoder from outputting incorrect data.

Section 16: The Symbology - The Barcode's Grammar

The symbology is the barcode's grammar. It defines the rules for encoding characters into bars and spaces. Different symbologies have different rules. Code 39, UPC, Code 128, and EAN are all different symbologies.

The decoder must know the symbology to decode the barcode. The symbology is usually determined by the barcode's start and stop characters. The start and stop characters are special patterns that indicate the symbology.

Section 17: Code 39 - A Variable-Length Symbology

Code 39 is a variable-length symbology. It can encode any number of characters. Each character is represented by a 9-element pattern (5 bars and 4 spaces). The pattern has 3 wide elements and 6 narrow elements.

Code 39 is a popular symbology for industrial and logistics applications. It is simple and robust. The decoder must identify the start and stop characters, which are usually an asterisk (*).

Section 18: UPC - A Fixed-Length Symbology

UPC (Universal Product Code) is a fixed-length symbology. It is used in retail. The UPC code is 12 digits long. The first 6 digits are the manufacturer code, and the next 5 digits are the product code. The last digit is a checksum.

UPC is a numeric-only symbology. It uses a 7-element pattern for each digit. The pattern has 2 bars and 2 spaces. The decoder must identify the left and right halves of the barcode, and it must decode the digits.

Section 19: Code 128 - A High-Density Symbology

Code 128 is a high-density symbology. It can encode all 128 ASCII characters. It uses a 6-element pattern for each character. The pattern has 3 bars and 3 spaces.

Code 128 is a more complex symbology than Code 39 or UPC. The decoder must handle the start, stop, and checksum characters. Code 128 is used in logistics and shipping.

Section 20: The Start and Stop Characters - The Barcode's Boundaries

The start and stop characters are special patterns that mark the beginning and end of the barcode. They are essential for the decoder. The decoder uses the start and stop characters to locate the barcode and to determine the symbology.

The start and stop characters are unique patterns that are not used for data. They are always at the beginning and end of the barcode.

Section 21: The Quiet Zone - The White Margin

The quiet zone is a white margin that surrounds the barcode. The quiet zone is typically at least 10 times the module width. The decoder uses the quiet zone to detect the barcode's presence. The quiet zone is the area where the signal is at a high level (white space).

The decoder looks for a quiet zone before and after the barcode. The quiet zone is essential for reliable decoding.

Section 22: The Scanning Speed - The Time-to-Distance Conversion

The scanning speed is the speed at which the scanner moves across the barcode. The scanning speed is not constant. It varies from scan to scan. The decoder must account for the scanning speed.

The scanning speed is determined by the pulse widths. A faster scanning speed produces narrower pulses. A slower scanning speed produces wider pulses. The decoder estimates the scanning speed from the module width.

Section 23: The Distortion - The Non-Ideal Barcode

The barcode signal is often distorted. The distortion can be caused by print quality, scanning speed variations, or noise. The decoder must be robust to distortion. The decoder uses error correction and redundancy to handle distortion.

The checksum is a primary error correction mechanism. The decoder can also use multiple scans to improve the reliability.

Section 24: The Multiple Scans - Averaging and Voting

The decoder can use multiple scans of the same barcode. The multiple scans are averaged or voted to produce a more reliable result. This is often used in hand-held scanners, where the user may scan the barcode multiple times.

The averaging or voting is done by the firmware. The decoder combines the results from multiple scans and produces a single, reliable result.

Section 25: The Edge Measurement - The Source of Errors

The edge measurement is the source of many errors. The edge measurement can be affected by noise, jitter, and quantization errors. The decoder must minimize the impact of these errors.

The use of hysteresis reduces the jitter. The use of a high-frequency timer reduces the quantization error. The decoder's algorithms are designed to be robust to the remaining errors.

Section 26: The Quantization Error - The Timer's Resolution

The quantization error is the error caused by the timer's finite resolution. The timer counts in discrete steps. The pulse width is measured to the nearest timer count. The quantization error is one timer count.

The quantization error can be reduced by using a higher-frequency timer. A 1-MHz timer gives a 1-microsecond error. A 10-MHz timer gives a 0.1-microsecond error.

Section 27: The Jitter - The Edge's Uncertainty

The jitter is the uncertainty in the edge timing. The jitter is caused by noise on the comparator's input. The hysteresis reduces the jitter, but it does not eliminate it.

The jitter is typically a few nanoseconds to a few microseconds. The jitter is small compared to the pulse widths, so it is usually not a problem.

Section 28: The Noise - The Comparator's Nemesis

The noise is the comparator's nemesis. The noise causes the comparator's output to jitter. The hysteresis is the primary defense against noise. The adaptive threshold also helps to reduce the noise.

The noise is minimized by careful circuit design and PCB layout.

Section 29: The Pulse Width Buffer - A Memory for the Waveform

The pulse width buffer is a memory that stores the pulse widths. The buffer is a circular buffer, as discussed earlier. The buffer is sized to hold a complete barcode.

The buffer is an essential part of the decoder. The decoder reads the pulse widths from the buffer and processes them.

Section 30: The Decoder's State Machine - A Sequential Processor

The decoder is a state machine. It processes the pulse widths sequentially. The state machine has states for the quiet zone, the start character, the data characters, the checksum, and the stop character.

The state machine is implemented in the microcontroller's firmware.

Section 31: The Decoder's Algorithm - A Pattern Matcher

The decoder's algorithm is a pattern matcher. It compares the measured pattern to the patterns in the lookup table. The algorithm is specific to the symbology.

The algorithm is efficient and robust. It must be able to handle the variations in the pulse widths.

Section 32: The Decoder's Output - The Barcode's Data

The decoder's output is the barcode's data. The data is the sequence of characters that were encoded in the barcode. The data is outputted as a string of ASCII characters. The decoder's output is sent to the host system (e.g., a cash register or a computer).

Section 33: Microchip's Reference Design - A Complete Example

Microchip provides a complete reference design for a barcode decoder. The design uses a PIC microcontroller. The comparator's output is connected to a capture pin. The firmware includes an ISR for edge capture, a circular buffer, and a decoder for Code 39, UPC, and Code 128.

Microchip's reference design is a useful starting point for engineers developing barcode scanners.

Section 34: NXP's Reference Design - A High-Performance Example

NXP provides a reference design for a high-performance barcode decoder. The design uses an LPC microcontroller with a DMA engine. The DMA engine offloads the edge capture from the CPU. The firmware includes a decoder for Code 39, UPC, and Code 128.

NXP's reference design demonstrates the use of a DMA engine for high-performance decoding.

Section 35: The Digitised Waveform as a Time Series - A Summary

The digitised waveform is a time series - a sequence of high and low pulses. Each pulse has a specific duration, which corresponds to a bar or space width. The decoder measures the pulse durations and uses them to reconstruct the barcode's data.

The digitised waveform is the final product of the analogue signal chain. It is the input to the digital decoder. The waveform's quality determines the decoder's accuracy.

Section 36: The Digitised Waveform - A Summary of Best Practices

Based on our exploration, let us summarize the best practices for handling the digitised waveform in a barcode scanner:

1. Use a Timer/Capture Module: The timer/capture module is the standard method for measuring the pulse widths. Use a high-frequency timer to achieve good resolution.

2. Use an Interrupt Service Routine (ISR): The ISR handles the edges. The ISR must be fast and efficient.

3. Use a Circular Buffer: The circular buffer decouples the ISR from the decoder. The buffer stores the pulse widths.

4. Use a DMA Engine (Optional): For high-performance applications, use a DMA engine to offload the edge capture from the CPU.

5. Implement a Decoder: The decoder interprets the pulse widths and produces the barcode's data. The decoder must handle the symbology, the checksum, and the start/stop characters.

6. Test the Decoder: The decoder must be tested with a variety of barcodes, under a variety of conditions, to ensure it is working correctly.

Final Summary

The digitised waveform is the bridge between the analogue and digital domains. It is the comparator's output - a clean, two-level square wave that represents the barcode's pattern. The waveform is a time series of high and low pulses, each with a specific duration. The decoder measures these durations to determine the bar and space widths.

We have seen how major companies have captured and processed the digitised waveform. Symbol's LS2208 uses a timer/capture module with an ISR. Honeywell uses a DMA engine to offload the edge capture. Datalogic uses a high-speed counter for precision. Microchip and NXP provide reference designs that include complete decoding examples.

The digitised waveform is the foundation of the barcode decoder. The decoder's accuracy depends on the quality of the waveform and the precision of the edge measurement. The waveform is the final product of the analogue signal chain. It is the raw material from which the barcode's data is extracted.

 

EasierSoft Barcode Label Design & Bulk Printing Software

---- Use Excel Data to Batch Print Barcodes on Label Sheets or Roll Labels  

---- How to use this barcode software

Download:  Free Barcode Software + Barcode Label Designer

Download Free Barcode Software at Softonic

     Download at CNET

Once you obtain a GS1/UPC/EAN barcode, or other barcode type and QR code, you can use our free software to batch print barcode labels onto Roll label paper using a professional label printer, or to batch print barcodes onto Avery 5160 label sheets using a regular laser or inkjet printer. Our software has free and paid versions.

The free version fully meets your needs for batch printing GS1/UPC/EAN barcodes. The paid version can import data from Excel and databases to batch print barcode labels with different values.

How to Start

Input Data

Import Excel Data

Print Barcode

Barcode Format

Label Designer

All Screen Shot

Export Barcode Image

Save Template

Output Word Excel

How to Use & FAQ:

Print barcodes to Avery 5160 label

How to bulk Barcode Printing

Sample - Avery 5162 (2x7) Label Sheet

Example: Print barcodes to 5*3cm roll

Example: Print barcodes to 5161 label

Example: Print barcodes to 5162 label

Example: Print barcodes to 5163 label

Example: Print barcodes to 5164 label

Example: Print portrait orientation 5164

Example: Print barcodes to 5167 label

Example: Print barcodes to 5168 label

Example: Print portrait orientation 5168

Example: Print barcodes to 5169 label

Example: Print barcodes to 5660 label

Example: Print barcodes to 5661 label

Example: Print barcodes to 5662 label

Example: Print barcodes to 5663 label

Example: Print barcodes to 5664 label

Example: Print portrait orientation 5664

Example: Print barcodes to 5873 label

Example: Print barcodes to 5874 label

Two ways to import Excel data

Import Excel Data - Pro Edition

Import Excel Data - Std Edition

Import Data from Excel - Detail

Load Data From Excel File

Data Editing Table

Copy Data From Excel

Four ways to input barcode data

Add ASCII Key E

Input Multiple Lines of Text for Barcodes

Generates Sequential Serial Numbers

Import or copy data from Excel sheets

Special sequence number generation

Std Details: Simple Input Form

Std Details: Multiple Line Text Input

Details: Sequence Barcode Generator

Examples: Sequence Barcode Generator

Import Data From Excel Spreadsheet

Barcode Data Correspondence Diagram

Data Editor

Editing a Single Row Data in Form

Batch Editing Multiple Rows of Data

Batch Data Editing - Example 2

Design & print complex barcode labels

Configuring Text Elements on Label

Configuring Barcode Elements on Label

Configuring Image Elements on Label

Setting Line Elements on Label

Designing Labels for 5164 Sheet

Highlights

Excel integration: Import data directly from Excel to generate and print barcodes in bulk.

Label designer: Create complex labels with multiple barcodes, text, logos, and shapes.

Batch printing: Print thousands of barcodes at once using standard inkjet/laser printers or professional barcode printers.


Flexible editions:

Standard Edition: Simple batch printing with Excel data.

Professional Edition: Adds command-line automation for workflow integration.

Label Designer Edition: Advanced design features for complex labels.


Why Choose Our Barcode Solutions?

Cost-effective: Free online generator and permanent free desktop version available.

Easy to use: No technical expertise required—just input data and print.

Versatile: Supports nearly all 1D and 2D barcode types, including QR codes.

Trusted: Recommended by CNET and widely downloaded by users worldwide.


Suitable Use Cases

Small businesses and startups needing quick barcode labels for products.

Retailers and online sellers managing inventory with batch barcode printing.

Manufacturers requiring sequential or custom barcode labels for packaging.

Educational and testing environments where barcodes are used for tracking.

 

 

CONTACT

cs@easiersoft.com

If you have any question, please feel free to email us.

 

https://free-barcode.com

 

<<< Back to Directory <<<     Barcode Generator     Barcode Freeware     Privacy Policy