Design of Embedded POS System Based on Cortex M3

In view of the shortcomings of the current embedded cash register system in terms of function and cost performance, an embedded cash register system based on Cortex M3 chip is introduced. The system has comprehensive functions, good performance, perfect interface, fault analysis and machine self-test function. The results of the operation show that the system achieves the expected goals.

This paper introduces a small-scale sales system for POS machines, data acquisition and data output with STM32F107 microcontroller as the core. The current embedded cash register system has no effective control in terms of hardware and software, and is not fully developed in function. The POS system platform has the advantages of low cost, easy operation, and easy self-test maintenance.

The basic operation principle of the POS machine is to first input the commodity data into the SPIFlash for storage. The barcode on the commodity can be directly read through the optical reading device on the scanner, and the product is found according to the barcode in the commodity database in the cash register memory. Related content, of course, you can also enter the barcode directly using the keyboard. The sales details of each item can also be automatically counted, and up to 10,000 transaction records can be saved.

1 system design

1.1 Hardware Structure

This system adopts ARM Cortex M3 as the core 32-bit microprocessor STM32F107VC, its main frequency is 72 Hz. The chip adopts Harvard architecture internally, and integrates the maximum storage space of 256K Flash and 64K SRAM, and a large number of I. The /O port and peripherals (2 I2 C buses, 3 SPIs, 2 I2 S, 5 USARTs, 2 CANs, etc.) are connected to the 2 APB buses.

The system hardware mainly includes: a receipt data processing module, a collection program storage module, a receipt data storage module, a serial port debugging module, a receipt display module, a report printing module, and a USB module. The system hardware block diagram is shown in Figure 1.

Figure 1 system hardware block diagram

The physical map of the system is shown in Figure 2.

Figure 2 The physical map of the system

In the initialization, in order to facilitate the user or maintenance personnel to keep abreast of the operation of the equipment and data storage, the debugging information must be displayed on the LCD screen. Input the Chinese and English input information to the device through the CH452 keyboard, read the barcode in the product into the device through the scanner, and finally output the transaction record to the ticket printer, and record up to 10,000 transaction information at a time. . Transaction information, users and other data are stored in the SPI Flash, and the clock information is placed in the RTC standby.

1.2 Peripheral equipment

1.2.1 Input/output interface chip and digital tube display chip

CH452 is a digital tube display driver and keyboard scanning control chip. It can perform 64-key keyboard scanning and 8-bit digital tube operation at the same time. It has functions such as BCD decoding, flickering, shifting, segment addressing, etc. Electrical reset signal.

The CH452's LCD exchange data function in this study was completed through a cascaded 4-wire serial interface. During the keyboard scan, the DIG7~DIG0 pins are used for the column scan output, and the high level can be output from DIG0 ~ DIG7 in turn, while the remaining pins are set to 0. The SEG7 ~ SEG0 pins have internal pull-down resistors for Line scan input, output is disabled during keyboard scan.

When the keyboard scan function is enabled, the function of the DOUT pin in the 4-wire serial interface is changed from the data output of the serial interface to the keyboard interrupt output and the button data output. If there are DIGm (m = 0, 1, 2 ... 7) and SEGn (n = 0, 1, 2 ... 7) keys are pressed, then when DIGm outputs a high level, SEGn can detect a high level; When the button is valid, the code generated by the button can generate an interrupt through the DOUT pin, and the CPU uses the serial interface to read the code.

In addition, the CH452 only supports pressing one button at a time. If there are multiple key values ​​pressed, the button with the smaller button code is taken.

Table 1 and Table 2 are the key addressing of the 8×8 matrix between DIG7~DIG0 and SEG7~SEG0. When the button is pressed, the status code bit 6 is always set to 1, and the button code has 7 bits, so when the button is pressed When it is down, the actual key code provided by CH452 is offset by 40H based on the key addressing in the table below. That is to say, the value of the key code set in this paper should be between 40H and 7FH.

The CH452 can also control 8 digital tubes and 64 LED lights. In this project, different interfaces can be used to display parameters such as time and product price that can be represented by numbers.

The connection between CH452 and STM32 as CPU is shown in Figure 3.

Figure 3 CH452 connection to STM32F107VC

1.2.2 Storage Device

W25X16 is a FLASH memory product with a larger capacity after W25X10/20/40/80, which has the advantages of small footprint, long service life and low power consumption. The W25X16 can hold 2 MB and is distributed over 8 192 programming pages. It is divided into 32 blocks, each block consisting of 16 sectors, and the minimum erase unit of W25X16 is one sector (4 KB). The connection between W25X16 and STM32F107VC is shown in Figure 4.

Figure 4 W25X16 connection to STM32F107VC

1.2.3 Printer

This project uses a thermal printer to output information for each transaction. Shangbao thermal printer supports parallel port, serial port, USB, LAN network and other channels to transmit data, with 384 square dots fixed dot with heated dot matrix. The printer logically controls the dot matrix through the data transmitted by the CPU, and controls the paper feed, thereby printing the font on the thermal paper, and printing the small ticket containing the transaction information required by the customer.

1.2.4 Scan input device

The scanning gun utilizes the reflected light of different intensity on the collected barcode, and the optical signal is converted into an electrical signal through the photoelectric converter through the optical system imaging, and the decoder discriminates the strip and the empty according to the measured pulse signal 0, 1. The number, the data obtained is also converted into the barcode serial number by the corresponding coding rules (such as the scanner used in this project using EAN 13 code).

1.2.5 Display device

TFT LCD has become the mainstream of the current display field due to its large capacity, high speed and high contrast display. The LCD utilizes the electro-optical effect of the liquid crystal to control the transmittance and reflectivity of the liquid crystal cell through the circuit, thereby producing brilliant images of different gray levels and up to 16.7 million colors, and displaying the required English and Chinese information through the lattice principle. Completed.

This project uses SSD1289 LCD screen to output the interface of the cash register. SSD1289 is a controller with 262 144 colors of thin film FET LCD. Its screen size is 57 mm × 79 mm, effective display area. It is 51 mm × 65 mm. It has a resolution of 240 × 320. The SSD1289 has four interface modes: i8080's MPU interface, VSINC interface, SPI interface and 18-bit RGB interface. The STM32F107VC controls the LCD driver via the FCMS bus. The connection between the LCD and the STM32F107VC is shown in Figure 5.

Figure 5 SSD1289 connection to STM32F107VC as CPU

The following is the initialization operation of the liquid crystal section.

1 Turn on the crystal:

LCD_WriteReg(0x0000,0x0001);

2 drive output control (240 × 320 resolution):

LCD_WriteReg(0x0001, 0x6B3F);

3 Scan start address:

LCD_WriteReg(0x000F, 0x0000);

If the LCD screen needs to display colorful images or texts, it needs software to control it. This is a certain complexity. The following are some of the advanced functions of the liquid crystal part.

(1) setting the cursor function

Set_LCD_Cursor(u8 x, u16 y, u8 CursFlag, u32 CursCycleTime, u8 high, u8 width);

Where x, y is the position where the cursor is blinking; CursFlag=1 means the cursor is displayed; CursFlag=0 means the cursor is not displayed; CursCycleTime is the period in which the cursor is blinking; high and width are the height and width of the cursor, respectively.

(2) line drawing function

LCD_DrawLine(u8 x, u16 y, uint16_t Length, uint8_t Direction, u16 LineColor);

Where x, y is the position coordinate, Length is the length of the line, Direction is the orientation of the line, and LineColor is the color of the line.

(3) Display Chinese characters

LCD_Disp_HZ_CharString(u8 x, u16 y, u8 *str, u16fontcolor, u16 backcolor);

Where x, y is the position coordinate, the str pointer points to the Chinese character or the English character encoding fontcolor, and the backcolor displays the character display color and the background color, respectively.

2 software block diagram

According to the overall planning of the project, the system block diagrams of the administrator and cashier software are shown in Figure 6 and Figure 7, respectively.

Figure 6 Manager system software structure block diagram

3 system operation

3.1 Machine Self Test

The set of electronic devices has a machine self-checking function. The user enters the “setup” by entering the administrator password, and then enters the “machine test and its result display” to know whether the machine is running normally, as shown in Figure 8.

Figure 7 Block diagram of the cashier system software

Figure 8 Machine test and its result display

3.2 Operation results

After performing “Login” → enter “Cash Register” password → “Receipt”, then the payment interface will appear. At this time, regardless of the number entered with the scanner and the item number, the item number can be entered in the box, and the quantity box can also enter the number of each item by itself, and then press the Enter key to settle the account. Finally, the print ticket can be displayed on the printer and the payment interface collection interface is displayed on the LCD - editor's note.

If you want to enter product information, you can perform "Login" → enter "Administrator" password → "Enter product information", and then you can enter the product information interface - editor's note. At this time, you can switch between the input language and English case by pressing the Chinese and English input switch keys and the case switch.

Conclusion

Using the STM32F107VC as the hardware platform of the portable POS machine, the cost can be greatly reduced, the operation is more convenient, and the basic functions of the POS machine are not weakened. The development of the POS function on the STM32F107VC can be more sufficient, such as using the USB interface to store more important data in the host computer.

0 times
Window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": " 0", "bdSize": "24" }, "share": {}, "image": { "viewList": ["qzone", "tsina", "tqq", "renren", "weixin"], "viewText": "Share to:", "viewSize": "16" }, "selectShare": { "bdContainerClass": null, "bdSelectMiniList": ["qzone", "tsina", "tqq", "renren" , "weixin"] } }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share. Baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];

LED Linear Light series is a high-end line of flexible decorative lamp, which is characterized by low power consumption, long life, high brightness, flexible, maintenance-free. Particularly suitable for indoor and outdoor entertainment, the outline of the building and billboard production. Depending on the needs of the products are 12V, 24V, etc., length 30CM, 60CM, 90CM, 120CM the like. Demand may also be customized with different specifications according to customer lines lamp.

Led Linear Light

Led Linear Light,Cabinet Light,Ceiling Installation Linear Light,Suspended Installation Linear Light

Shenzhen Mingxue Optoelectronics CO.,Ltd , https://www.led-lamp-china.com