Research on Graphic Dot Matrix LCD Display Control

Publisher:数字翻飞Latest update time:2010-05-06 Source: 现代电子技术 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Dot-matrix LCD interface technology

The single-chip microcomputer can directly control the LCD display module in the form of memory access and I/O device access through the data bus and control signal. This article takes AT89C51 as an example, and its interface circuit with YEJHD19264 is shown in Figure 1. The single-chip microcomputer controls the CSA and CSB column selection drivers through P2.6 and P2.7. At the same time, AT89C51 uses P2.1 as the R/W signal to control the data flow of the data bus, and uses P2.0 as the D/I signal to control the selection of the register. The E signal is controlled by P2.4 of AT89C51. The LCD power control terminal VO in the circuit is used to adjust the grayscale of the display screen. Adjusting the voltage at this terminal can change the color depth of the characters and graphics on the display screen. The basic display timing circuit and display driver can be found by consulting the display product manual.

2. Display control technology of dot matrix LCD

According to the functions and characteristics of dot matrix LCD, the author studied two widely used control algorithms, left (right) circular displacement algorithm and page turning algorithm.

2.1 Left (right) circular shift algorithm

This algorithm is used in advertisements or on-board station announcement systems. As shown in Figure 2, taking the left loop as an example, if an advertisement with a string of 8 Chinese characters (16*16 font) is to be displayed on the second row of a 192*64 dot matrix LCD (4 rows and 12 columns when the 192*64 dot matrix displays 16*16 font), the specific algorithm is shown in Figure 3.

Note: Consider the 8 characters as a whole, i.e., a Chinese character string, and use the display coordinates of the first Chinese character as the display coordinates of the entire Chinese character string, and initialize it to the rightmost coordinate value (assuming that the advertisement moves from right to left). Then extend to the left to display 8 Chinese characters (an advertisement) in sequence. If during the display process, the coordinates of some Chinese characters exceed the display limit of the LCD screen, the control program will not display these Chinese characters, as shown in the dashed small box in Figure 2. When the display coordinates of the Chinese character string are shifted to the left by one position (minus 1), it is necessary to determine whether the coordinate value is equal to -7 (if it is equal to -7, then the left shift is completed, and it is reinitialized to the rightmost coordinate value to prepare for the second round of left shift; if it is not equal to -7, then the current round of left shift has not yet ended).

[page]

In practical applications, the left (right) circular shift algorithm can also be improved and expanded according to system requirements to make its application more flexible. For example, if the advertising slogan is required to be changeable in real time, that is, when the user inputs a new advertisement through the serial port or other external interface, the original old advertisement should be replaced by the new advertisement. In this way, the algorithm will be more complicated because in addition to the change of the content of the advertisement itself (word change), the number of words may also change.

2.2 Page Turning Algorithm

This algorithm is used in the short message display system. First, the number of pages required for display must be calculated. The formula is:

Among them: P is the page number, S is the total number of Chinese characters to be displayed, and M is the maximum number of Chinese characters that can be accommodated on the entire screen.

For example, when displaying 100 Chinese characters, 100/46 (the original divisor should be 48, but two Chinese characters should be reserved as the display position of the prompt for turning pages up and down), the quotient is 2 and the remainder is 8. This means that the 100 characters are displayed on 3 pages, with 46 Chinese characters displayed on the first and second pages, and the last 8 Chinese characters displayed on the third page. Secondly, it is also necessary to establish a corresponding relationship between the page number and the first address of the memory of a screen of Chinese characters, that is, for 100 Chinese characters, the first address of the first 46 Chinese characters corresponds to the first page, the first address of the next 46 Chinese characters corresponds to the second page, and the remaining 8 Chinese characters correspond to the third page. Because one address stores one byte, and the Chinese character internal code consists of two bytes, then the calculation formula for the storage first address of any screen of Chinese characters is:

Among them: t is the first address of any Chinese character storage on the screen, T is the first address of all Chinese characters storage, M is the maximum number of Chinese characters that can be accommodated on the entire screen, and P is the number of pages. The following algorithm structure still takes the 192*64 dot matrix display as an example, and the entire display part program structure diagram is shown in Figure 4.

Description: According to the different pages to be displayed, the text divides the page display into three software modules, namely: the homepage display module, which represents the Chinese characters of the first page; the middle page display module, which represents all other pages other than the first page and the last page; and the last page display module, which represents the Chinese characters of the last page. At the beginning of the program, the variable P is used as the page identifier to be displayed, and the initial value is 1. Therefore, when the program enters the loop for the first time, it enters the homepage module. At this time, the first address of the Chinese characters storage on this screen is calculated according to formula (2), so as to display the first page content and display the page down prompt at the same time. Then wait for the external key interruption. When the page down key prompt comes, the P value is changed (increased by 1) and enters the middle page display module or the last page display module. When the program enters the middle page display module, the first address of the Chinese characters storage on this screen is calculated according to formula (2), the Chinese characters on this screen are displayed, and the page up and page down prompts are displayed at the same time. Then wait for the external key interruption. When the page down or page up key prompt comes, the P value is changed (increased by 1 or subtracted by 1) and enters the previous page display module or the next page display module. Note: The previous page display module here may still be the middle page, not the first page; similarly, the next page display module may still be the middle page, not the last page, depending on the total number of pages. When the program enters the last page display module, the first address of the Chinese characters on this screen is calculated according to formula (2), and the Chinese characters on this screen are displayed, and the page-up prompt is displayed at the same time. Then wait for an external key interrupt. When the page-up key prompt comes, change the P value (minus 1) to enter the middle page display module or the first page display module.

[page]

In practical applications, the page-turning display algorithm can be combined with the short message storage and access algorithm and the file system to realize a display system similar to the short message mode of a mobile phone.

3 Experimental Design and Results

3.1 Design Idea

When designing the peripheral hardware, the author used E2PROM to store the Chinese character library, and 8 kB of external RAM to store the internal code of each Chinese character in the short message and advertisement, and then converted the internal code into the first address of the Chinese character library font, and then read the font in E2PROM. In the external RAM, the area is divided: the first 4 kB: store the short message that has been preprocessed and is about to be displayed, which can accommodate 2000 Chinese characters (2 B for each Chinese character). The next 2 kB: store the advertisement that has been preprocessed and is about to be displayed. Due to the addition of a scrolling mechanism, it can only accommodate 200 Chinese characters. The last 2 kB: store the BTYE received by the serial port, including all the preprocessing of unpacking and decoding. Here, as mentioned earlier, the useful information is extracted, and the extracted Chinese character part is sent to the short message or advertisement storage area to wait for the display command. This area can support a coding length of 2 000 B. At the same time, 4 buttons are designed to control the up and down page turning, the switch between the advertisement mode and the message mode, and the reset of the microcontroller.

3.2 Experimental Results

Figure 5 is the result of the experiment. Since the advertisement is scrolling, a static image cannot be used to describe it clearly, so here we only show the short message display image. This is the middle page display, with the upper left corner and lower right corner being the prompts for turning up and down, respectively. The author lets the microcontroller sequentially extract Chinese characters from the character library for display.

4 Conclusion

These two algorithms have been applied to vehicle-borne and ship-borne short message communication systems based on wireless measurement and control networks. At the same time, the algorithms can be further expanded to meet more complex system requirements. I hope this article can provide a way of thinking and method to solve practical problems for those program developers based on low-end LCD applications.

Reference address:Research on Graphic Dot Matrix LCD Display Control

Previous article:Application of LED display driver chip
Next article:Design of LED backlight drive scheme for medium-sized display screen

Recommended ReadingLatest update time:2024-11-16 22:49

STM32 USB Mass Storage example debugging notes
1. Cause of the problem       Recently, several customers reported that the USB Mass Storage routine of the STM3210E development board had some problems. The team leader assigned me to debug. The Mass Storage routine implements two USB disks on the PC, one is an SD disk and the other is a NAND Flash disk. After downlo
[Microcontroller]
STM32 USB Mass Storage example debugging notes
Latest Home Electronics 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号