This paper introduces the high-performance 8-bit single-chip C8051F120 as the core processor, receives and processes the operation information of the PC keyboard and touch screen, and converts it into dot matrix data that can be displayed by liquid crystal display (TFT); using SRAM as video memory, The FPGA receives the display data transmitted by the single-chip microcomputer, controls the read and write operations of the memory, and generates the working timing of the liquid crystal display, and finally completes the embedded design scheme of displaying characters and 65 536 color graphics on the liquid crystal display. The software design of the core processing unit C8051F120 is described in detail.
With its affinity with users and natural human-computer interaction interface, embedded devices have developed rapidly and penetrated into every corner of life. The design method introduced in this paper is based on high-performance 8-bit single-chip C8051F120 as the core processor, SRAM as the system's memory, FPGA to achieve timing conversion, and low-temperature (-10 °C) embedded display system. The interface operation is realized by the PC keyboard and the touch screen, and finally the national standard one/two-level Chinese characters, ASCII characters and 65 536 color graphics and pictures are displayed on the liquid crystal display, and a simple operation interface is created.
1 system working principleThe process of displaying Chinese characters, English characters, and color graphics is to convert character and graphic information into dot matrix information that can be displayed on a liquid crystal display. In order to display characters, the ASCII code dot matrix font and the Chinese character dot matrix word arranged by the location code are stored in the external Flash ROM of the single chip (constituting the dot matrix data area), and the characters used in the program are taken as the internal code. The form is stored in the Flash ROM (constituting the text data area). When displayed, the MCU reads the Chinese character machine internal code from the text data area, converts it into the font address of the dot matrix data area in the Flash ROM, and reads the dot matrix data of the character through the address, and further converts it into the data that the liquid crystal display can display. Send to subsequent circuit processing and display. In this way, various characters including the national standard one/two-level Chinese characters, uppercase and lowercase English characters, punctuation and numbers can be displayed during the operation. When displaying color graphics, because the storage space of the image is relatively large, there is not enough space in the system. The color image of the bmp format in the PC can be converted into a format and sent to the MCU for real-time processing and display.
LCD monitors operate from 4.5 to 6.8 MHz and require complex timing. Considering the working speed of the single-chip microcomputer and the working frequency of the liquid crystal display, on the one hand, the liquid crystal display can be continuously refreshed at the working frequency to work, and a large amount of display data and control information needs to be transmitted; on the other hand, the single-chip microcomputer has to perform many processing work even if it is working. At 100 MHz, it will also become a bottleneck in the system's operating rate. In order to solve this problem, add a SRAM as a memory, add an FPGA to achieve timing conversion and control and refresh the LCD. The FPGA reads/writes the SRAM in a time-sharing manner. Under the action of the clock, the FPGA reads data from the SRAM for half of the time (when the clock signal is high), and continuously refreshes the liquid crystal display; the other half of the time (when the clock signal is low) ), if the microcontroller has sent data to be displayed, write this data to the SRAM. The use of time-sharing operation can receive and store the data of the single-chip microcomputer while continuously refreshing the liquid crystal display, so that the work of the two aspects does not affect each other, not only reduces the workload of the single-chip microcomputer, but also fully exerts the performance of the FPGA.
Figure 1 system block diagram
Selecting the liquid crystal display with a touch screen and connecting the touch screen to the handwriting recognition controller can increase the handwriting recognition function and provide a friendly human-computer interaction interface. The system block diagram can be drawn from the above analysis, as shown in Figure 1.
2 system hardware designIn this embedded display system, a liquid crystal display model of the Sharp model LQ0357DH01 is used, and the operating temperature range is -10 to 70 ° C, and the minimum operating temperature is relatively lower.
The display module is composed of a color active dot matrix LCD module and an amorphous silicon TFT, and thus may be referred to as an ADTFT (Advanced TFT). It consists of a color TFT LCD panel, an IC driver, an FPC, a backlight, a resistive touch screen, and a back seal box, but the module does not include a control circuit. The display operates at a frequency of 4.5 to 6.8 MHz with a resolution of 240 & TImes; 320 pixels and a color bit depth of 18 bits. Graphics and text can be displayed on the 240&TImes; 320 dot matrix display in 262,114 colors. However, considering the data bus width of the single chip microcomputer is 8 bits, in order to simplify the operation process, the color depth can be determined to be 16 bits, and the single chip transmits the color data of each pixel twice. This simplified operation also satisfies the requirement to display 65 536 color graphics.
In order to improve the operating speed of the whole system, a high-performance 8-bit MCU model C8051F120 is used as the processor. The C8051F120 uses Silicon Labs' patented CIP51 microcontroller core. The CIP51 is fully compatible with the MCS51 instruction set and can be developed using the standard 803x/805x assembler and compiler. The C8051F120 is stable for maximum system clock frequency of 100 MHz and peak performance of 100 MIPS. Flash uses M29W400BB (512K & TImes; 8 bits), which is a readable, erasable and reprogrammable Flash. FPGA Xilinx SpartanII series XC2S100.XC2S100 is an FPGA with 100,000 system gates, which can provide enough logic for the system in the number of logic gates. The XC2S100 in a 144-pin package provides 103 I/O ports to provide sufficient I/O port resources for system devices.
Regarding the choice of SRAM, considering the resolution of the liquid crystal display is 240 & TImes; 320 pixels, each pixel can display 65 536 colors (16 bits), so the memory size is at least 240 × 320 × 2B = 150 KB. Add a block 512 KB SRAM CY7C1041BV33 can be used as video memory. CY7C1041BV33 can work in the word operation mode to facilitate the display of data access. In the process of refreshing the liquid crystal, each word in the SRAM can correspond to each pixel of the liquid crystal.
Handwriting recognition uses a handwriting recognition microcontroller of the type ePH1200AQ. The ePH1200AQ hardware integrates an 8-bit RISC microcontroller, touch screen driver, interface UART, 4 KB SRAM, 32K word programming ROM and 512K word data ROM; the software includes handwriting recognition kernel, character set and handwriting collection software. When the microcontroller is connected to an external touch screen, it can form a handwriting recognition application such as an SMS, mobile phone or handwriting input device.
3 system software designSystem software includes two parts: single chip and FPGA. This article mainly introduces the software design of the MCU part.
Figure 2 main function flow
The functions completed by the MCU include cyclically querying whether the two serial ports receive new data. When a serial port receives new data, it takes the corresponding meaning. When the character is displayed, the dot matrix data in the Flash ROM is read, converted and processed, and then sent to the FPGA; when the graphic is displayed, the dots are drawn according to the set graphic trajectory.
The MCU periodically polls the two serial ports to receive new data in the main program. When any serial port generates an interrupt, according to the meaning of the data received by the serial port, the corresponding operation is taken. The main function flow is shown in Figure 2.
3.1 character display principle
The file HZK16 and file ASC16 in the UCDOS software are 16×16 national standard Chinese character dot matrix files and 8×16 ASCII code dot matrix files, respectively, and are stored in a binary format. In the file HZK16, all the Chinese characters in the national standard area code table are stored in the order of the Chinese character area code, and each Chinese character occupies 32 bytes (16×16 Chinese character dot matrix), and each area is 94 Chinese characters. In the file ASC16, 8×16 ASCII code arrays are stored in order from ASCII to small, and each ASCII code occupies 16 bytes.
In the text file of the PC, the Chinese characters are stored in the form of the internal code, and each Chinese character occupies two bytes. The first byte is the area code. In order to distinguish it from the ASCII code, the range starts from hexadecimal 0A1H (less than 80H is an ASCII code character), corresponding to the first area of ​​the area code in the location code; the second byte For the bit code, the range also starts from 0A1H and corresponds to the first bit code in a certain area. In this way, the location code of the Chinese character is obtained by subtracting 0A0A0H from the Chinese character internal code. For example, the internal code of the Chinese character "I" is hexadecimal "CED2", where "CE" represents the area code, and "D2" represents the bit code. Therefore, the location code of "I" is 0CED2H-0A0A0H=2E32H. The area code of the Chinese character "I" which is converted into the decimal code is "4650", that is, the dot matrix of the "room" is located in the 46th district. The position of 50 words is equivalent to the display dot matrix in which the position in the file HZK16 is 32×[(46-1)×94+(50-1)]=67136 B and 32 bytes are “Iâ€. .
Read each byte in turn, read one byte each time, and extract each bit in the byte. If a bit is "1", send two bytes to the pixel corresponding to the bit data. Font color data, such as (0x0000, black); if a bit is "0", the two pixels of the background data are sent to the pixel corresponding to the bit data, such as (0xffff, white). When the 32-byte dot matrix data is sent (the total color data sent is 32B×8dot×2B=512 B), the Chinese character with the background color white and the font color black is displayed on the LCD screen. The display result of the Chinese character "I" is shown in Figure 3.
Figure 3 shows the result of the Chinese character "I"
The LCD monitor has a color depth of 16 bits and can display 65 536 colors per pixel. The SRAM operates in a word mode of operation, with each word in the SRAM corresponding to each pixel of the liquid crystal display. For example, the point of the first column of the first row of the liquid crystal display corresponds to the 0x0000 address of the SRAM, the point of the second column of the first row corresponds to the address of 0x0001, and so on.
3.2 Interface operation through the PC keyboard
When the interface is operated by the PC keyboard, the operating key value of the keyboard is sent to the serial port of the single-chip microcomputer through the serial port of the PC through the computer software. 0. The serial port of the single-chip computer receives one byte of data every interrupt, and the received data can be divided into three. Case: When the value is greater than 0xA0, it indicates that the byte is a byte in the two-byte data of a Chinese character; when the value is 0x20~0x7f, it indicates that the byte is a printable ASCII code character; when the value is less than 0x20, it indicates This byte is a non-printable value that can be used as the control command byte for the interface operation. When two data values ​​greater than 0xA0 are continuously received, they can be converted into a certain Chinese character; each time a data with a value of 0x20~0x7f is received, it can be converted into an ASCII code character; each time a value less than 0x20 is received When the data is data, it can be translated into an operation command and the corresponding control operation is performed. Figure 4 shows the interrupt flow of the keyboard interface operation.
Figure 4 keyboard interface operation interrupt process
3.3 Interface operation through the touch screen
When the interface is operated through the touch screen, the handwriting recognition microcontroller ePH1200AQ sends the handwritten track packet to the serial port of the single chip microcomputer. 1. The data during the operation mainly includes inputting the Chinese character, identifying the input stroke, and sending the candidate word to the single chip; The coordinates of the screen contacts are sent in real time; when touched, the coordinates of the touch points are sent. The communication protocol command format of ePH1200AQ is listed in Table 1.
Table 1 ePH1200AQ communication protocol command format
The identification type definition value of the identification type command (0x10) in Table 1 defines the identifiable word set, including the Chinese character one/second level font, uppercase and lowercase letters, numbers, symbols, preset gestures, hiragana and slices. pseudonym.
The ePH1200AQ communicates with the serial port 1 of the single-chip microcomputer. The command packet is sent. The frame positioning of the packet needs to be considered to determine the header and the end of the packet. In the command format in Table 1, the command with the longest packet length is the "send candidate word array" command (command code is 0x18), and the number of candidate words sent by ePH1200AQ is up to 10, and each candidate word is two bytes. The data, the maximum length of the command is 25 bytes, you can create an array of 25 elements (uart1_RX_buffer[25]) as a command cache.
ConclusionThis paper designs an embedded color graphics display system with C8051F120 as the core processor. Its outstanding advantages are strong real-time performance, simple interface circuit and strong scalability. The system has high integration degree, convenient carrying and strong practicability, and has application in many fields, and has certain research and application value.
Lithium-ion Battery For Mechanical Equipment
Lithium Ion Battery,Lithium Car Battery,Lithium Ion Battery Price,Lithium Battery Price
Shenzhen Sunbeam New Energy Co., Ltd , https://www.sunbeambattery.com