introduction
Embedded devices have developed rapidly and penetrated into every corner of life due to their affinity with users and natural human-computer interaction interface. The design method introduced in this paper is to use the high-performance 8-bit microcontroller C8051F120 as the core processor, SRAM as the system's video memory, and FPGA to achieve timing conversion to build an embedded display system at low temperature (-10℃). The interface operation is realized through the PC keyboard and touch screen, and finally the national standard first/second level Chinese characters, ASCII characters and 65,536 color graphics and pictures are displayed on the LCD display, and a simple operation interface is made.
1 System Working Principle
The 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 by the LCD. In order to display characters, the ASCII code character dot matrix font library and the Chinese character dot matrix font library arranged by the area code can be stored in the Flash ROM external to the microcontroller (constituting the dot matrix data area), and the characters used in the program can be stored in the Flash ROM in the form of machine code (constituting the text data area). When displaying, the microcontroller reads the Chinese character machine code from the text data area, converts it into the font address of the dot matrix data area in the FlashROM, reads the dot matrix data of the character through the address, further converts it into data that can be displayed by the LCD and sends it to the subsequent circuit for processing and display. In this way, a variety of characters including national standard first/second level Chinese characters, uppercase and lowercase English characters, punctuation and numbers can be displayed during the operation. When displaying color graphics, since the storage space requirements for pictures are relatively large and there is not enough space in the system, the color pictures in the bmp format in the PC can be converted into a format and sent to the microcontroller through the serial port for real-time processing and display.
The operating frequency of the LCD is 4.5-6.8MHz, and it requires a complex working sequence. Considering the working speed of the single-chip microcomputer and the working frequency of the LCD, on the one hand, the LCD needs to 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 complete a lot of processing work, even if it works at 100MHz, it will become the bottleneck of the system operation rate. In order to solve this problem, an SRAM is added as a video memory again, and an FPGA is added to realize the timing conversion and control and refresh the LCD. FPGA reads/writes SRAM in time-sharing. Under the action of the clock, the FPGA reads data from the SRAM in half of the time (when the clock signal is high) and continuously refreshes the LCD; in the other half of the time (when the clock signal is low), if the single-chip microcomputer has data to be displayed, the data is written into the SRAM. The use of time-sharing operation can receive and store the data of the single-chip microcomputer while continuously refreshing the LCD, so that the two aspects of work do not affect each other, which not only reduces the workload of the single-chip microcomputer, but also gives full play to the performance of the FPGA.
By choosing a liquid crystal display with a touch screen and connecting the touch screen to a handwriting recognition controller, the handwriting recognition function can be added, which can provide a friendly human-computer interaction interface. Based on the above analysis, a system block diagram can be drawn, as shown in Figure 1.
2 System Hardware Design
In this embedded display system, a Sharp LCD model LQ0357DH01 is used. The operating temperature range is -10 to 70°C, and the lowest operating temperature is relatively lower.
The display module consists of a color active dot matrix LCD module and amorphous silicon TFT, so it can be called AD-TFT (Advanced TFT). It consists of a color TFT-LCD panel, IC driver, FPC, backlight, resistive touch screen and back seal box, but the module does not include the control circuit. The display screen has an operating frequency of 4.5-6.8 MHz, a resolution of 240×320 pixels, and a color bit depth of 18 bits. Graphics and text can be displayed on a 240x 320 dot matrix display screen in 262 11 4 colors. However, considering that the data bus width of the microcontroller is 8 bits, in order to simplify the operation process, the color depth can be determined as 16 bits, and the microcontroller sends the color data of each pixel twice. Such a simplified operation can also meet the requirements of displaying 65,536 color graphics. [page]
In order to improve the operating speed of the entire system, a high-performance 8-bit single-chip microcomputer model C8051F120 is used as the processor. C8051F120 uses Silicon Labs' patented CIP-51 microcontroller core. CIP-51 is fully compatible with the MCS-51 instruction set, and standard 803x/805x assemblers and compilers can be used for software development. The maximum system clock frequency that C8051F120 can stably operate is 100 MHz, and the peak performance reaches 100 MIPS.
The Flash used is M29W400BB (512K×8 bits), which is a readable, erasable and reprogrammable Flash. The FPGA uses the Xilinx Spartan-II series product XC2S100. The XC2S100 is an FPGA with 100,000 system gates, which can provide enough logic circuits for the system in terms of logic gate count. The 144-pin packaged XC2S100 can provide 103 I/O ports, providing enough I/O port resources for system devices.
Regarding the selection of SRAM, considering that the resolution of the LCD is 240×320 pixels, each pixel can display 65,536 colors (16 bits), so the size of the video memory is at least 240×320×2B=150 KB. A 512 KB SRAM CY7C1041BV33 can be added as video memory. CY7C1041BV33 can work in word operation mode, which is convenient for access to display data. During the process of refreshing the LCD, each word in the SRAM can be mapped to each pixel of the LCD.
Handwriting recognition uses a handwriting recognition microcontroller model ePH1200AQ. The hardware of ePH1200AQ integrates an 8-bit RISC microcontroller, a touch screen driver, an interface UART, 4 KB SRAM, a 32K-word programming ROM, and a 512K-word data ROM; the software includes a handwriting recognition kernel, a character set, and handwriting collection software. When the microcontroller is connected to an external touch screen, a handwriting recognition application product can be formed, such as SMS, mobile phones, or handwriting input devices.
3 System Software Design
The system software consists of two parts: the microcontroller and the FPGA. This article mainly introduces the software design of the microcontroller part.
The functions completed by the single-chip microcomputer include cyclically querying whether the two serial ports have received new data. When a serial port receives new data, it will take corresponding actions. When displaying characters, it reads out the dot matrix data in the Flash ROM, converts and processes it, and then sends it to the FPGA; when displaying graphics, it draws points according to the specified graphic trajectory.
The MCU in the main program loops to check whether the two serial ports have received new data. When any serial port generates an interrupt, it takes corresponding actions according to the meaning of the data received by the serial port. The main function flow is shown in Figure 2.
3.1 Character Display Principle
The files HZK16 and ASC16 in the UCDOS software are 16×16 national standard Chinese character dot matrix files and 8×16 ASCII code dot matrix files, respectively, stored in binary format. In the file HZK16, all Chinese characters in the national standard area code table are stored in order from small to large according to the Chinese character area code. 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 dot matrix is stored in order from small to large according to the ASCII code. Each ASCII code occupies 16 bytes.
In the text files of PC, Chinese characters are stored in the form of machine codes, 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 (characters less than 80H are ASCII code characters), corresponding to the first area of the area code in the area code; the second byte is the bit code, and the range also starts from 0A1H, corresponding to the first bit code in a certain area. In this way, subtracting 0A0A0H from the machine code of the Chinese character will get the area code of the Chinese character. For example, the machine code of the Chinese character "我" is hexadecimal "CED2", where "CE" represents the area code and "D2" represents the bit code. So the area code of "我" is 0CED2H-0A0A0H=2E32H. Convert the area code and bit code into decimal respectively, and the area code of the Chinese character "我" is "4650", that is, the dot matrix of "房" is located at the 50th character in the 46th area, which is equivalent to the position of 32×[(46-1)×94+(50-1)]=67136 in the file HZK16. The 32 bytes after B are the display dot matrix of "我".
Read out each byte in turn, and extract each bit in the byte. If a bit is "1", send two bytes of font color data to the pixel corresponding to the bit data, such as (0x0000, black); if a bit is "0", send two bytes of background color data to the pixel corresponding to the bit data, such as (0xffff, white). After sending 32 bytes of dot matrix data (the total color data sent is 32B×8dot×2B=512 B), the LCD screen will display Chinese characters with white background and black font color. The display result of the Chinese character "我" is shown in Figure 3. [page]
The color depth of the LCD is 16 bits, and each pixel can display 65,536 colors. The SRAM works in word operation mode, and each word in the SRAM corresponds to each pixel of the LCD. For example, the point in the first row and first column of the LCD corresponds to the 0x0000 address of the SRAM, the point in the first row and second column corresponds to the 0x0001 address, and so on.
3.2 Interface operation via PC keyboard
When the interface is operated through the PC keyboard, the computer software is used to send the keyboard operation key value to the microcontroller serial port 0 through the PC serial port. The microcontroller serial port 0 receives a byte of data each time it is interrupted. The received data can be divided into three cases: when the value is greater than 0xA0, it means that the byte is one of the two-byte data of a Chinese character; when the value is 0x20 to 0x7f, it means that the byte is a printable ASCII code character; when the value is less than 0x20, it means that the byte is a non-printable value. These 36 values can be used as the control command bytes for interface operations. After receiving two data with values greater than 0xA0 in succession, it can be converted into a Chinese character; each time a data with a value of 0x20 to 0x7f is received, it can be converted into an ASCII code character; each time a data with a value less than 0x20 is received, it can be translated into a certain operation command and the corresponding control operation is performed. Figure 4 shows the keyboard interface operation interruption process.
3.3 Interface operation via touch screen
When the interface is operated through the touch screen, the handwriting recognition microcontroller ePH1200AQ packages the handwriting trajectory and sends it to the serial port 1 of the microcontroller. The data during the operation mainly includes recognizing the input strokes when inputting Chinese characters and sending candidate characters to the microcontroller; sending the coordinates of the screen touch points in real time when drawing; and sending the coordinates of the touch points when touching. The communication protocol command format of ePH1200AQ is listed in Table 1.
The recognition type definition value of the recognition type command (0x10) in Table 1 defines the character set that can be recognized, including Chinese first/secondary character libraries, uppercase and lowercase English letters, numbers, symbols, preset gestures, hiragana, and katakana.
ePH1200AQ communicates with the microcontroller serial port 1 and sends command packets. It is necessary to consider the frame positioning of the packet and determine the packet header and tail. 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). The number of candidate words sent by ePH1200AQ is up to 10, and each candidate word is two bytes of data. The maximum length of the command is 25 bytes. An array with 25 elements (uartl_RX_buffer[25]) can be created as a command buffer.
Conclusion
This 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, easy to carry and strong practicality. It has applicability in many fields and has certain research and application value.
Previous article:Design of a new LCD display control circuit based on single chip microcomputer
Next article:Dual audio communication solution based on FM
- Popular Resources
- Popular amplifiers
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
- 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
- What information do I need to provide for FCC certification of Bluetooth headsets?
- Recommended solutions to reduce Wi-Fi interference
- The MCU cannot run in DC-DC mode of BLUENRG-1
- micropython update: 2020.7
- Disassembling AirTags: The coil, magnet and diaphragm in the ring-shaped motherboard work together, and the body is the speaker
- Serial communication and LCD display
- Detailed explanation of several triggering modes of oscilloscope
- Update the image
- [Prizes await you every week] Are you a circuit master or a circuit novice?
- MCU low power consumption