Design of Embedded Color Display System Based on C8051F120 Core

Publisher:JoyfulHeartedLatest update time:2014-02-21 Source: elecfansKeywords:C8051F120 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  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.

  a.JPG

  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.

  b.JPG

  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]

c.JPG

  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.

  d.JPG

  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.

  e.JPG

  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.

Keywords:C8051F120 Reference address:Design of Embedded Color Display System Based on C8051F120 Core

Previous article:Design of a new LCD display control circuit based on single chip microcomputer
Next article:Dual audio communication solution based on FM

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号