1 Introduction
Liquid crystal display (LCD) is a low-power, small-size, radiation-free display device that has been widely used in various embedded electronic products in recent years. LCD can be divided into three types: segment type, character type and dot matrix type. Among them, segment type LCD and character type LCD can only be used for simple display of characters and numbers, and cannot meet the requirements of graphic curve and Chinese character display. Dot matrix LCD can not only display characters and numbers, but also various graphics, curves and Chinese characters, and can realize screen scrolling animation functions, partition window opening, inversion, flashing and other functions. It has a wide range of uses. In order to simplify the design and application of LCD display circuits, manufacturers usually assemble LCD display units, display controllers, display memory and display driver circuits together to make LCD modules (LCM) [1]. LCM provides standard data and control interface and control instructions. Taking ATM12864C as an example, this paper introduces the interface design and programming method of LCD display module with control driver ST7920 and Philips' ARM7 microcontroller LPC2214. On this basis, it introduces in detail the design method of displaying continuously scrollable Chinese menu and menu item highlight selection display on the LCD screen, and discusses how to solve the garbled problem that occurs during the display of Chinese characters.
2 Hardware Implementation
ATM12864C is a Chinese LCD module produced by Guangdong Jinpeng Electronics Co., Ltd. This LCD module uses the control driver ST7920 of the Chinese character dot matrix. It contains 8192 16×16 dot matrix national standard simplified Chinese characters and 126 16×8 dot matrix English symbol fonts. Users can enter the national standard code or ASCII code to realize text display. The full screen displays 8 Chinese characters × 4 lines. In addition, it also provides a 64 × 256-dot drawing RAM (GDRAM), which can be mixed with text display, and contains a font generation RAM (CGRAM) to provide programmable character creation function. The external interface signals provided by ATM12864C are: 8-bit data bus D0-D8; register selection signal R/S, when R/S is high, it controls the data register, when R/S is low, it controls the instruction register, read and write signal R/W, when R/W is at this level, it reads, and when it is low, it writes, enable signal E, the falling edge is valid, the write operation timing of ATM12864C is shown in Figure 1 (b). The read operation timing is the same as the write operation timing except that the R/W signal is high [2].
LPC2214 is a microcontroller launched by Philips based on a 32-bit ARM7TDMI-S CPU that supports real-time simulation and tracing. The frequency is up to 60MHz, with 256KB embedded high-speed on-chip Flash memory and four 32-bit width external memory interfaces. It is a low-power, high-performance, small-package microcontroller. The external memory access timing of LPC2214 is shown in Figure 1 (a) [1].
In order to save the ordinary I/O port resources of the microcontroller and simplify program writing, LPC2214 can directly use the external memory access form to control the LCD display module through the data bus and control signal. This method is more important for some complex systems with limited I/O port resources. Since the data access timing of STA7920 is very different from the memory access timing of LTC2214, as shown in Figure 1. The key to the interface circuit design of LPC2214 and LCD display module is how to make the memory access timing of LPC2214 and the access timing of ST7920 match correctly through reasonable design.
The interface circuit between LPC2214 and the liquid crystal display module is shown in Figure 2. LPC2214 controls the R/S signal of LCM through the low-order address A1 to select the currently controlled register. The data flow method on the data bus is controlled by appropriately delaying the LPC2214 write signal WE as the R/W signal of LCM. The enable signal E of LCM is synthesized by the read signal OE, write signal WE of LPC22414 and the chip select signal CS1 of the memory controller. In the circuit that generates the read/write signal R/W signal, the selection of resistor R and capacitor C is the key. According to the electrical characteristics of LPC2214 and ST7920 (see references [1, 2] for details) and the debugging results, the ideal values are: R takes 1KΩ and C takes 12PF. In order to achieve low power consumption, the backlight of LCM is controlled through a common I/O port. When there is an external key response, the backlight is on, otherwise the backlight is off.
Since the chip select signal of LCM is controlled by CS1, that is, using the Bank1 address space of the LPC2214 external memory interface, and the R/S signal is controlled by A1, the operation of LCM is as follows:
Command input address: 0x81000000
Data operation address: 0x81000002
3 Software Design
In the design process of LCD display program with Chinese character library, the scrolling display of Chinese menu and the highlighting selection of menu items are the key. The LCD display module selected in this paper can display 4 lines, and each line can display 8 Chinese characters. When the menu items to be displayed are greater than 4, scrolling display is required. This paper designs a human-computer interaction friendly menu operation program. The basic idea of the program is: open a display buffer in the memory that can display a 4×16 two-dimensional character array, store the list of menu items to be displayed in another two-dimensional array, and conveniently and flexibly display the specified menu items in the menu list by changing the parameters of the display function LCM_Show(). Assume that the 5-item menu in Figure 3 (a) is to be displayed, the default display focus is on the first line, that is, the menu items in the first line are highlighted. When the "down" key is pressed, the display focus moves down one line. When the focus moves down to the last line of the LCD screen, as shown in Figure 3 (b), press the "Down" key again and the screen will scroll up, as shown in Figure 3 (c). When you continue to press the "Down" key, the screen will continue to scroll up and cycle through the 5 menu items in the menu list, as shown in Figure 3 (d). Press the "Up" key and the operation will be the same.
This article uses the display function LCM_Show() and the reverse display function LCM_ShowInvert() to implement the menu continuous scrolling display function and the focus reverse display function as described above. The specific code is as follows:
In the process of displaying Chinese characters, the displayed content is often a mixture of Chinese characters and ASCII codes. Since Chinese characters are composed of 2 bytes and ASCII codes are one byte, if the number of ASCII numbers in the displayed content is odd, garbled Chinese characters will appear after the ASCII codes.
In response to this phenomenon, this paper proposes a method to format the display content before displaying. The basic idea is to add a space after consecutive odd-numbered ASCII characters to keep the consecutive ASCII characters in the display content in even numbers. This method effectively solves the garbled problem when displaying Chinese characters. The program flow is shown in Figure 4.
4 Conclusion
Based on the research on the access timing of ARM7 microcontroller LPC2214 and LCD display module with control driver ST7920, this paper designs the interface circuit between them. This interface circuit does not need to add ordinary I/O, and directly uses the external memory access form of LPC2214 to simply and conveniently control the LCD display module, which not only saves ordinary I/O ports, but also makes program writing more convenient. At the same time, it also gives the program of Chinese menu scrolling display and menu item highlight selection, and discusses the garbled code phenomenon that occurs during the display process, and gives solutions and program flow. This paper proposes an effective solution for the design of a display system with Chinese character display function for embedded systems based on ARM microcontrollers.
Previous article:Development of Micro-arc Oxidation Power Supply Control System Based on LPC2119
Next article:Interrupt handling during the transplantation of uCOS II on ARM processor
Recommended ReadingLatest update time:2024-11-16 21:01
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- 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
- (Transfer) Bluetooth BLE GATT complete analysis and application
- Why do OEMs like to specify Ethernet connectors?
- "Play Board" + Shared Bicycle Control Panel 1
- Wire harness disc abnormal noise test
- Mid-Autumn Festival and Teachers' Day are coming together. I heard that there are only three times in a century.
- Liyuan Award Live Broadcast: Interpreting ON Semiconductor Power Solutions, Transforming Server Power Supplies and Solar Inverters
- CC2640R2F Battery Fuel Measurement
- 【AT-START-F425 Review】Use of GPIO port and OLED screen display driver
- How to dynamically open the Bluetooth kernel log for the Allwinner V853 chip?
- Regarding the problem of leakage current when the MOS tube is not completely turned off