Binary representation of one-dimensional barcode
The barcode encoding method is relatively common. That is, it is compiled by combining templates. So what is template width? Template width is a basic unit of barcode width. As mentioned above, EAN-13 consists of 10 Arabic numerals from 0 to 9. Each numeral is composed of two bars and two spaces. It occupies 7 template widths in total. The width of each bar ranges from 1 to 4 template widths. And they are all integer multiples of the template length. 1 and 0 represent the bar and space parts of the barcode respectively.
The barcode character set is a collection of all one-dimensional barcode characters. It is composed of three subsets. They are A subset, B subset, and C subset. Its partial binary representation is shown in Figure 9. There are 30 encoding forms in total, that is, each character has 3 representation forms. As for the representation of odd and even forms, it is determined by the number of binary 1s. However, there are three fixed characters, namely the start character, the middle separator, and the terminator of the barcode. The corresponding binary forms are 101, 01010, and 101. Therefore, the three of them will not be included in the binary encoding table. It can also be seen from the corresponding table shown in Figure 9 that the elements of the odd subset A and the even subset C of each digital character set are opposite, and the even subset B and the even subset C are in reverse order.
Related algorithms for identification
The automatic recognition technology of barcodes can be divided into two structures. That is, scanning and decoding. As the name implies, the scanning structure is to read out the information carried by the barcode itself with some special equipment and technology. For example, using lasers, optical signals are converted into electrical signals. The final result of the scan is to obtain the width of the template, that is, the width of the waveform of the bar or space. The method is to read according to the different reflection effects of the bar and space. As mentioned in the previous article, the bar reflects back a weak signal, while the space reflects back a strong signal. The principle of decoding is to follow the scanning operation. That is, some electrical signals obtained by scanning are translated in some specific ways to obtain the final data information and input it into the customer terminal computer. Then the obtained information is rectified by a relatively regular rectifier circuit, and finally the barcode graphics that we can always see in life are obtained.
The basis of this paper's design is that the system recognizes the corresponding barcode image and displays it on the corresponding LCD display. The system's operation process is the process of reading the image to recognizing the image, so when analyzing its functions, the modules are divided according to the operation process.
The portable commodity barcode reader, as mentioned above, is mainly composed of four modules. Laser scanning, single-chip microcomputer, 12864 LCD display, power supply module. The general principle of its work is that the laser scans the barcode and stores it. At the same time, the buzzer starts to sound, and then the scanner transmits the data information to the single-chip microcomputer through serial communication. After receiving the information, the single-chip microcomputer will compare it with the pre-set program and transmit the compared information to the 12864 LCD display. The display will also display the corresponding format according to the pre-designed program and complete the work.
System overall design
The system consists of five modules:
1. Considering the overall acquisition speed of the system, the scanner uses a laser barcode scanner.
2. Key module: Since there are not too many function options, this device uses an independent keyboard.
3. The processor of this device is STC89C52 microcontroller.
4. Since this device displays more content first, the 12864 LCD display module is selected.
5. The power supply first uses a switching power supply to convert the AC power into a 12V DC power supply, and then the 78 series chip converts it to the voltage required by the system.
Solutions to the above problems:
1. The power module uses a switching power module to convert the mains 220V into the 5V, 3.3V, etc. required by the system.
2. The reset circuit uses the classic reset circuit of the microcontroller.
3. The display module uses liquid crystal display.
4. The key module uses an independent keyboard for keyboard input.
5. The scanner module uses a laser scanning module.
6. The clock module uses a quartz crystal oscillator and the internal oscillation circuit of the microcontroller.
The hardware of the portable commodity barcode product identifier designed in this design can be mainly divided into four modules. It consists of a laser scanning module, a 52 single-chip control module, a power module, and a display module. Its functions in this design system are introduced as follows:
Barcode recognition circuit design
The laser scanning module is responsible for collecting barcode information in this design, and performs fast reading and recognition functions. It is the main input port in this design. Since it cannot be directly connected to the microcontroller, an RS232 level conversion module is connected. After the barcode information is read by the laser scanner, it is transmitted to the corresponding buzzer for notification. For the principle and structural composition of laser scanning, please refer to Section 2.3 of this article. Note that the specified voltage of the laser scanning module is 5V. The laser scanning circuit design is shown in the figure.
Power circuit design
The power module is mainly responsible for supplying power to the entire design system. This design uses a 5V online charging plug that is more common in the market for power supply. The city power here is 220V, and some circuit structures of this power supply will generate a 12V voltage, but this is not what we need, because the specified voltage of the microcontroller is 5V, and the specified voltage of the laser scanning is 3.3V. So when we pass in the 12V voltage, we need to connect a 7805 model voltage regulator chip to convert the voltage into 5V, and power the 52 microcontroller and other modules that require 5V. Then, through the 1117 voltage regulator chip, the 5V voltage is converted to 3.3V voltage, and the laser scanning module continues to be powered. The power supply circuit design is shown in the figure.
Display circuit design
The display selected this time is a more suitable 12864 LCD display. Its most obvious advantage is that it can display more characters, including Chinese characters. And it uses serial communication. This just meets the characteristics of the single-chip microcomputer. Through the serial transmission interface of the single-chip microcomputer, the information results after comparison from the program are presented. Its hardware circuit diagram in this design system is shown in the figure.
Key circuit design
The most practical independent keyboard is used in portable commodity barcode recognition devices composed of single-chip microcomputers. This keyboard has the characteristics of relatively simple hardware and software. Its disadvantage is that when there are many keys, it will occupy a lot of port lines. The independent key circuit design is shown in the figure.
Clock circuit design
The clock circuit of the single-chip microcomputer is divided into two forms: using an external clock signal and using an internal oscillation circuit. When the former is working, the clock signal needs to be input from pin 1, and pin 2 is in a floating state, because the CPU internal clock signal is taken from one input end of the two-input NAND gate as a feedback amplifier element; when the latter is working, the clock signal is input from pin 1 and output from pin 2. At this time, the crystal oscillator, capacitor and internal NAND gate (an element that plays a feedback and amplification role, similar to the transistor in the capacitor three-point oscillation circuit) constitute a capacitor three-point oscillator. Since the static capacitance and external oscillation capacitance in the quartz crystal oscillator are much larger than the crystal elastic equivalent series capacitance, for this reason, the frequency generated by the crystal oscillator and the resonance in parallel determines the frequency of the oscillation. In this system, an external clock signal is used as the crystal oscillator circuit. If there is no crystal oscillator inside the single-chip microcomputer, there will be no clock cycle. Without a clock cycle, the program code cannot be executed, and the entire circuit cannot be realized. The system clock circuit design is shown in the figure.
System overall programming
The design process is roughly as follows: initialize LCD, initialize serial port, then use laser scanning to read barcode information and identify barcode. Send the result to MCU, compare with database, send the comparison result to LCD and display it. The whole program design is shown in the figure.
Barcode recognition program design
In the circuit design of reading and scanning barcodes, I adopted the process design of laser scanner. Its advantages are fast speed and high accuracy. Its process is shown in the figure.
Previous article:Design of Simple Electronic Piano Based on Single Chip Microcomputer
Next article:Design of smart bracelet system based on single chip microcomputer
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- The transformer in the power supply has no output after loading
- Compile imx6-ek200 with buildroot
- Using MSP430 to implement PWM signal
- Get the MPM54304 evaluation board for the first quad-output module with digital power management
- Dead time problem of IGBT drive waveform
- The difference between single-phase carrier and type 2 collector
- CLF5356
- Why does the chip of the board heat up when the msp432 is powered on and compiled and downloaded under KEIL5 conditions? What is turned on?
- How to solve the thermal challenges of Wi-Fi front-end?
- Getting Started with Smart Home Audio Design