introduction
Tax control cash register refers to an electronic cash register with specific tax control functions. It is an embedded system integrating hardware and software. The hardware design considers high cost performance and high reliability, and the software design considers the stability and reliability of the system. Based on this principle, this paper introduces a design scheme of a tax control cash register based on the ARM controller LPC2214.
Design and implementation of the hardware system of the tax control cash register
The hardware block diagram of the tax control cash register is shown in Figure 1. Its hardware system consists of a central processing module, a display module, a printing module, a power module, a clock module, an IC card interface, an external communication interface (including RS232 serial interface, network interface, USB interface, etc.), a buzzer, as well as an input keyboard, an electronic lock, a barcode scanner and a handwriting board.
Figure 1 Hardware block diagram of tax control cash register
Central processing module
The central processing module uses Philips' low-power ARM processor LPC2214 based on the 32-bit ARM7TDMI-S core. This processor is a cost-effective microcontroller solution provided by Philips for embedded applications. By expanding a series of general peripheral devices based on the ARM7TDMI-S content, the system cost is reduced to a minimum and the system's support for external devices is enhanced. Since LPC2114 integrates rich on-chip resources, the expansion of the system itself is greatly reduced, which not only reduces the size of the product, but also facilitates maintenance.
Display Module
The display module for human-computer interaction includes an LCD main display screen and a 9-bit VFD user display screen. The LCD uses a graphic dot matrix liquid crystal with a built-in KS0107/KS0108 controller. The display resolution is 192×64 and can display 16×5 11×12 dot matrix Chinese characters. The VFD is driven by the chip HT16512 with an SPI interface.
Print module
The system uses EPSON's MU110II printer head, with a power supply voltage of DC24V. The motor driver uses MTD2003F, the needle driver uses MTA001M, and is controlled by the general I/O port of LPC2214.
Power Management Module
The system uses a switching power supply to provide 5V power for LPC2214. Since the tax control cash register has strict requirements for power-off protection, a power-off protection circuit is designed in the power management module, which can maintain the normal operation of the system for a certain period of time when the power is off. When the power is off, the circuit will send an interrupt to the processor, so that the system enters the power-off interrupt handler and performs the corresponding power-off protection work.
Clock module
The clock module uses the I2C bus clock chip P8563AP, which, with the support of a backup battery, can ensure that the on-chip clock continues to run after the system loses power.
Tax control storage
The tax control cash register needs to record a large amount of data information. This system uses the Flash memory AT45DB321 with SPI interface from ATMEL. Since the LPC2214 microcontroller has an SPI interface, it can be easily connected to it. The design uses a pluggable module to separate the data storage module from the system motherboard. The feature of this design is that when the system fails, important data can be transferred in time, which reduces the probability of data errors and improves the integrity and reliability of the data. With the cooperation of the tax control card, the relevant data information can be transferred to another normally working machine to continue working, ensuring the timeliness of data storage. In addition, the replacement method can also be used during maintenance and repair, which reflects strong practicality and operability.
IC card interface
In common designs, dedicated IC card reader/writer chips are used to provide the ISO7816 interface for the system, such as CTS56I01, WatchCore, TDA8020, etc. This system does not perform hardware expansion, but fully utilizes the performance characteristics of LPC2214 to implement the IC card interface function that complies with the ISO7816 standard.
The interface signals of the smart card chip include: power supply voltage (VCC), ground (GND), reset (RST), clock (CLK), programming voltage (VPP), input and output (I/O). As shown in Figure 2, I/O and RST are controlled by the general I/O port (GPIO) of the LPC2214 microcontroller. The data read and write operation timing is simulated by software to realize data exchange. The transmission of signals on I/O is bidirectional, so the software should be used to continuously convert the input and output states according to the timing. This method has the characteristics of low cost, convenience and flexibility.
[page]
Power Management Module
The system uses a switching power supply to provide 5V power for LPC2214. Since the tax control cash register has strict requirements for power-off protection, a power-off protection circuit is designed in the power management module, which can maintain the normal operation of the system for a certain period of time when the power is off. When the power is off, the circuit will send an interrupt to the processor, so that the system enters the power-off interrupt handler and performs the corresponding power-off protection work.
Clock module
The clock module uses the I2C bus clock chip P8563AP, which, with the support of a backup battery, can ensure that the on-chip clock continues to run after the system loses power.
Tax control storage
The tax control cash register needs to record a large amount of data information. This system uses the Flash memory AT45DB321 with SPI interface from ATMEL. Since the LPC2214 microcontroller has an SPI interface, it can be easily connected to it. The design uses a pluggable module to separate the data storage module from the system motherboard. The feature of this design is that when the system fails, important data can be transferred in time, which reduces the probability of data errors and improves the integrity and reliability of the data. With the cooperation of the tax control card, the relevant data information can be transferred to another normally working machine to continue working, ensuring the timeliness of data storage. In addition, the replacement method can also be used during maintenance and repair, which reflects strong practicality and operability.
IC card interface
In common designs, dedicated IC card reader/writer chips are used to provide the ISO7816 interface for the system, such as CTS56I01, WatchCore, TDA8020, etc. This system does not perform hardware expansion, but fully utilizes the performance characteristics of LPC2214 to implement the IC card interface function that complies with the ISO7816 standard.
The interface signals of the smart card chip include: power supply voltage (VCC), ground (GND), reset (RST), clock (CLK), programming voltage (VPP), input and output (I/O). As shown in Figure 2, I/O and RST are controlled by the general I/O port (GPIO) of the LPC2214 microcontroller. The data read and write operation timing is simulated by software to realize data exchange. The transmission of signals on I/O is bidirectional, so the software should be used to continuously convert the input and output states according to the timing. This method has the characteristics of low cost, convenience and flexibility.
Figure 2 IC card interface of tax control cash register
Business processing layer design
The business processing layer is the top layer in the tax control cash register software architecture. It is independent of the specific hardware platform and can be easily ported to different hardware platforms as an application software. This layer is used to implement the two main functions of business and tax control and consists of 4 modules.
The main program (main control module) performs system self-check, software and hardware initialization, schedules and runs other modules of the business processing layer, handles power-off data recovery and data organization, and controls the entire software process; the tax control function module implements the tax control function in the national standard GB18240-2003, and is responsible for machine initialization and registration, purchase and distribution of invoices, invoicing (including return and invalid invoice processing), tax control data declaration, monitoring data feedback, tax audit, etc.; the business function module consists of a sales sub-module, a statistical analysis (report) sub-module, a setting management sub-module and some other functional sub-modules; the communication module is responsible for data communication with the tax control cash register management system running on the host computer (PC).
Interface layer design
As an abstract layer, the interface layer only provides application program interfaces, does not operate specific hardware, and does not handle specific business. It is a management program designed for complex equipment, mainly including IC card management, memory management, USB communication management, etc. The following is a detailed introduction to the invoice storage management module in memory management.
The tax control cash register requires the ability to reliably store a large amount of invoice data, so the invoice storage management module is a key module of this system. In order to save storage space, the invoice storage system in this system adopts a variable-length rolling storage method.
Variable length means that the length of the invoice varies depending on the invoice header and the details it contains. In this system, the invoice header may occupy 32, 64, or 96 bytes, and the maximum number of invoice details is 8, each of which occupies 32 bytes. In this way, each invoice occupies 1 to 11 32-byte storage spaces. The storage location of the invoice in the memory is also aligned in units of 32 bytes, and the positions of two invoices are connected end to end, with no redundant space.
Rolling storage means that when the storage space is fixed, this part of the storage space is recycled. When the stored invoices occupy a large enough space, the new invoices may overwrite the earliest stored invoices. [page]
Since invoices are stored in variable lengths and occupy different amounts of space, in order to achieve random access, a location index table needs to be established. Each item in the table indicates the actual storage location of the invoice. For example, the nth item in the location index table is the location of the nth invoice in the memory. At the same time, in order to speed up the search for detailed information on invoices by invoice number, the number of accesses to the memory should be minimized as much as possible, which is the key to improving the search speed. This system uses a Hash index table to quickly locate the invoice to be found. In order to resolve the Hash value calculation conflict of the algorithm, a Hash link table is also established. The length of this table is the same as that of the location index table. Each value in the table represents the location of the next invoice with a Hash value conflict.
Device driver layer design
The device driver layer includes drivers for directly operating peripherals, such as IC card, Flash, LCD, VFD, printer, USB, keyboard, clock and other peripheral drivers; it also includes LPC2214 internal configuration drivers, such as internal register configuration, UART configuration, GPIO settings, RTC read and write, TIMER settings, etc. Among them, ISO7816 standard IC card driver is a key part, which includes functions such as card insertion detection, card power on and off, card reset and card command.
The data transmission mode between IC card and LPC2214 microcontroller is asynchronous half-duplex character transmission mode, and this system uses software to implement this function. LPC2214's GPIO is used to simulate the IC card's read and write operation timing to exchange data: when receiving data, LPC2214's GPIO is set to input mode, and the I/O data line is sampled using the interrupt program; when sending data, LPC2214's GPIO is set to output mode, and the data bits to be sent are directly output in the interrupt program.
Abnormal situation handling
When abnormal situations (such as power failure, card removal, etc.) occur, the tax control cash register should ensure that data is not lost and error-free. This system ensures data reliability from two aspects. On the one hand, before initialization, invoice distribution, invoice entry, invoicing, tax reporting and tax payment and other key steps, first check whether the power supply is normal. If power failure has occurred, the system stops working; otherwise, set a flag and start normal step operation. After the step is completed, clear the flag. If a power failure or IC card is accidentally pulled out before the step is completed, the system will detect the flag when the power is turned on next time or the step is re-operated, and the software will automatically call the recovery mechanism to complete the remaining operations and restore the lost data.
On the other hand, if a power outage occurs during the invoice printing process, it is necessary to perform power-off continuation processing. Before the invoice starts printing, save the invoice details and set the "printing not completed" flag; if a power outage occurs during the printing of a line of data, the power-off protection circuit issues an interrupt, calls the interrupt routine, and uses the working time maintained by the power-off protection circuit to save the current printing position, and the system stops working; after the power is turned on again, the "printing not completed" flag is detected, and the last invoice details are read out, and a complete invoice is printed from the position recorded when the power was off, and the flag is cleared.
Data security processing
The tax control cash register integrates business, tax control, management and other functions. It has very high requirements for data transmission and storage. It needs to be able to correctly transmit, store, generate and feedback data. Therefore, the security requirements are also very high. The security design of this system is reflected in the following aspects.
The system adopts a hierarchical management method for user rights, and sets three roles with different operating rights: system administrator, cashier, and tax auditor. Users are associated with roles, and user passwords are 6 to 8 digits long, and the passwords are stored in the Flash in ciphertext form. To enter the corresponding user mode, you must pass the corresponding password verification before you can log in to the tax control cash register and perform the corresponding operations of this user level.
The system will perform read verification on the data writing operation of Flash, compare and save the checksum when reading and writing key data in the memory; and perform data integrity verification on the tax control data during power-on self-test and when using tax control data.
In addition, before performing key operations, external communications, code maintenance, etc., the system must authenticate the user's identity and generate audit records for the events corresponding to the operations.
Conclusion
This system makes full use of the hardware resources of LPC2214 itself, and realizes the intelligent IC card interface that complies with the ISO7816 standard through software. The system design complies with the national standard GB18240-2003 for tax control cash registers. The whole system design structure is simple, which is convenient for improving performance and connecting and expanding with various peripherals. It has great competitive advantages and the product has been recognized by the market.
Previous article:Design and implementation of network control system based on ARM+uCLinux
Next article:Implementing the Rijndael encryption algorithm on ARM microprocessor
Recommended ReadingLatest update time:2024-11-16 22:57
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- N32WB452 asked: Does N32WB452 have a basically complete ported RT-Thread development kit?
- IoT Gateways – A Simple Guide to the Internet of Things
- [Bluesun AB32VG1 RISC-V evaluation board] IDE installation and use
- It's New Year's Eve soon. I wish you all a happy New Year.
- Using Ginkgo USB-ADC and heart rate sensor to implement a heart rate tester with Android APP source code
- 【DIY Creative LED】Add touch button and install it on LED lamp
- [RISC-V MCU CH32V103 Review] - 2: Making an LED flash is not easy
- SensorTile.box uses air pressure sensors to analyze environmental changes
- When using an oscilloscope probe to measure the AC waveform between the two ends of a component, how should the probe ground wire be connected?
- 【ST NUCLEO-H743ZI Review】(2)Ethernet Test