Design of Tax Control Cash Register System Based on ARM Controller LPC2214

Publisher:as233632621Latest update time:2011-07-14 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Design of Tax Control Cash Register System Based on ARM Controller LPC2214

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.

Reference address:Design of Tax Control Cash Register System Based on ARM Controller LPC2214

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

Design of vehicle navigation terminal based on microprocessor LPC2214 and GPS receiver
GPS has been developed in China for more than ten years, but it has always made major breakthroughs in the civilian field. In recent years, the prospect of GPS for civilian use has become increasingly clear, and user demand is rising. There are currently two applications that are promising: one is civilian navigation
[Microcontroller]
Design of vehicle navigation terminal based on microprocessor LPC2214 and GPS receiver
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号