As a commonly used display device, the liquid crystal module has the characteristics of low power consumption, rich display content, and flexible control. Among the medium-sized graphic liquid crystal display modules, the LCD module with built-in T6963C controller is currently a more commonly used built-in controller type graphic liquid crystal display module. The module can be initialized and set by the hardware circuit, so it can save software overhead. In terms of software, the T6963C controller also provides a rich instruction set, and the control method is flexible and diverse. The 32-bit microprocessor with ARM as the core has the characteristics of high performance and low power consumption, and is widely used in the field of industrial control. Therefore, for the low-end ARM7 chip without a liquid crystal interface, its general purpose input and output (GPIO) pins can be used to connect to the LCD and control the LCD to realize its display function.
1 LCD hardware interface design
The T6963C controller can be connected to the row and column drivers and display buffer RAM of the LCD module, and the LCD screen structure (single or dual screen), display window length, width, font, etc. can be set through this hardware connection method. The principle block diagram of the single-screen structure dot matrix graphic LCD display module with built-in T6963C is shown in Figure 1.
In Figure 1, the data bus and the control bus are directly connected to the IO port line of the CPU. The liquid crystal can use the SMG240128A dot matrix graphic liquid crystal display module; and the CPU can use the 32-bit microprocessor chip LPC2134 based on the ARM7TD-MI-S core. The chip is designed based on the principle of RISC, and the instructions and decoding are simple and convenient. It adopts three-level pipeline technology, the CPU operating frequency can reach up to 60MHz, and it has 47 general I/O ports. At the same time, it contains rich peripheral resources, which is very suitable for use in the field of industrial measurement and control. The interface circuit between the liquid crystal module and LPC2134 is shown in Figure 2.
The LCD module in Figure 2 uses a data parallel transmission mode and is connected to the LPC2134 through two driver chips 74L3245 and 74HC14. Among them, 74LS245 is an eight-bit bidirectional bus transceiver, which can connect the data bus of the LCD module to the 8 port lines of the CPU's P0 port, is responsible for controlling the transmission of data, and has data latching and buffering functions: 74HC14 is a six-input inverting driver that can drive the four control lines of the LCD module. Pin 21 of the LCD module is the backlight ground terminal, which is controlled by p0.23 to turn the backlight on and off. The backlight brightness can be adjusted through potentiometer W2, and the contrast of the LCD display can be controlled by potentiometer W1. The FG pin is the frame ground and must be grounded to prevent static electricity and lightning strikes. The FS pin is grounded to control the font to 8x8 dot matrix.
2. Realization of display function
The LCD display function can be realized by controlling the LCD controller T6963C by LPC2134. The T6963C controller has a rich set of built-in instructions, and the display function can be set by instructions. Instructions can have one or two parameters, or no parameters. The execution of each instruction is to first enter the parameters and then the instruction code. Before each operation, the status word needs to be detected first.
2.1 Low-level sub-function design
At the program level, whether it is the detection of status words or the transmission of parameters and instruction codes, it involves the read and write operations of the LCD controller. According to the read and write timing provided in the T6963C manual and combined with the hardware design of this system, the read and write timing diagram shown in Figure 3 can be obtained.
As for the writing of the sub-functions for reading status and writing data, you can refer to this sub-function when designing. 2.2 Driver layer implementation
Next, we need to use the instructions of T6963C to complete the setting of the display function of the driver layer. The definitions of some basic instructions are listed in Table 2. In fact, the writing of the driver layer sub-function can be achieved by calling the write command, write data, and read status sub-functions.
The source code of the LCD initialization setting function is as follows:
.3 Chinese character reading and writing program design
After initializing the LCD, you can set the display area, display mode and display status. Next, the font data of the characters to be displayed should be written into the display buffer to realize the display function. For the text mode, the font data can be written into the display buffer and CGRAM can be established. Then the character code can be determined by the data storage location, and then the character can be displayed by writing the corresponding code; for the graphic display mode, the font data needs to be written into the graphic display buffer byte by byte to realize the display function. Compared with each other, the two have their own characteristics. The text mode has a fast display speed. The built-in CGROM contains 128 ASCII characters, which can be called directly, but CGRAM needs to be established first, and the capacity is limited. It can only manage 2K bytes of data, which is more suitable for occasions with few characters to be displayed; while the graphic mode has a relatively slow display speed, but there is no need to establish CGRAM. The user only needs to write the font data into the graphic display area in bytes, which is suitable for occasions with more display content. In general engineering applications, the display of Chinese characters is a relatively important content. Therefore, this article mainly introduces the program design of Chinese character display.
By the LCD initialization program, this system uses the graphic mode as the display mode. The Chinese font is generally 16x16 dot matrix, occupying 32 bytes, and can also use 32x32 dot matrix fonts. Western characters are 16x8. The sub-function program written in this way is as follows:
Next, we need to use the instructions of T6963C to complete the setting of the display function of the driver layer. The definitions of some basic instructions are listed in Table 2. In fact, the writing of the driver layer sub-function can be achieved by calling the write command, write data, and read status sub-functions.
The source code of the LCD initialization setting function is as follows:
.3 Chinese character reading and writing program design
After initializing the LCD, you can set the display area, display mode and display status. Next, the font data of the characters to be displayed should be written into the display buffer to realize the display function. For the text mode, the font data can be written into the display buffer and CGRAM can be established. Then the character code can be determined by the data storage location, and then the character can be displayed by writing the corresponding code; for the graphic display mode, the font data needs to be written into the graphic display buffer byte by byte to realize the display function. Compared with each other, the two have their own characteristics. The text mode has a fast display speed. The built-in CGROM contains 128 ASCII characters, which can be called directly, but CGRAM needs to be established first, and the capacity is limited. It can only manage 2K bytes of data, which is more suitable for occasions with few characters to be displayed; while the graphic mode has a relatively slow display speed, but there is no need to establish CGRAM. The user only needs to write the font data into the graphic display area in bytes, which is suitable for occasions with more display content. In general engineering applications, the display of Chinese characters is a relatively important content. Therefore, this article mainly introduces the program design of Chinese character display.
By the LCD initialization program, this system uses the graphic mode as the display mode. The Chinese font is generally 16x16 dot matrix, occupying 32 bytes, and can also use 32x32 dot matrix fonts. Western characters are 16x8. The sub-function program written in this way is as follows:
The horizontal coordinate x on this LCD screen ranges from 0 to 29, and the vertical coordinate y ranges from 0 to 127. The font data is provided by the font creation software. The order of writing the font data should correspond to the structural position of the character it represents. When reading and writing display data, please note that the address pointer will automatically increase by one each time it is read and written. When modifying its value, you must first end the current read and write operation, and then modify the address, so that it will be effective. The writing of other sub-functions is the same as the Chinese character display sub-function. Characters of different fonts only have different font data amounts. Continuous writing can be achieved by calling a separate write function multiple times, or the corresponding byte data of all characters can be written in each line. As for the realization of the reverse function, you can first read the data byte of the corresponding character, invert it, and then rewrite it.
3 Conclusion
This paper realizes the interface design with the LCD display module with built-in T6963C through the GPIO of the ARM7 microprocessor chip LPC2134, and realizes its basic display function in software, thus meeting the requirements of engineering design. This paper systematically explains the design process of the LCD display program, and gives the source code for reference for the difficulties in the design. The program has good portability and is applicable to LPC213x series chips, other ARM7 chips and different models of LCD display modules with built-in T6963C.
Previous article:Introduction to the principles and application examples of photoelectric encoders
Next article:Interface and Application of BC7281B and DSP
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- 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
- Analog input and output buffers
- XMC4800 ECAT Evaluation Board First Experience - Unboxing Review
- Notes on wiring for st-link and jlink debugging stm32
- Misunderstanding of using XF pin in DSP program interruption during programming
- Share the correct use and maintenance guide of NiMH batteries
- Vicor: Innovative solutions for powering computing applications and data centers
- [Raspberry Pi Pico Review] - USB CDC serial communication (BSP compiled, not MicroPython)
- What should I do if the number of IO pins of the microcontroller is insufficient?
- DSP GPIO Programming
- [ESP32-Audio-Kit Audio Development Board] - 2: Installing "esp-idf-v3.3.5" on Windows 10