Interface design based on LPC2134 and T6963C LCD module

Publisher:落霞与孤鹜Latest update time:2012-04-07 Source: 21ICKeywords:LPC2134  T6963C Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

When designing a program, you can simulate the read and write timing diagram of the LPC2134 GPIO pin to achieve data transmission. According to the data and read and write types, four underlying sub-functions can be designed to complete the transmission function. The functional description is listed in Table 1.

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:

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:

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.

Keywords:LPC2134  T6963C Reference address:Interface design based on LPC2134 and T6963C LCD module

Previous article:Introduction to the principles and application examples of photoelectric encoders
Next article:Interface and Application of BC7281B and DSP

Latest Power Management Articles
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号