Interface Design between LCD Display and PIC Microcontroller

Publisher:科技小巨人Latest update time:2011-12-03 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction
In the design of intelligent instruments, it is usually necessary to display the measurement and control information. Due to the power consumption, volume and other conditions of the instrument, general CRT displays are often not suitable. Although semiconductor digital tubes can display numbers and a few letters, they cannot flexibly display various texts, graphics, tables, etc., and have great limitations. LCD displays are widely used in the display of various intelligent instruments due to their advantages such as powerful functions, low power consumption, clear display and light structure. PIC microcontroller is a high-performance microcontroller launched by MICROCHIP of the United States. Compared with the traditional MCS51 series microcontroller, it has many built-in functional modules, good anti-interference, fast speed and low power consumption, and is widely used in the field of industrial control [1]. This article will take SED1520 and PIC16F874 as examples to introduce the practical method of LCD display and PIC microcontroller interface.
2 Structure, instructions of SED1520 and its interface circuit with PIC microcontroller

The structural block diagram of SED1520 is shown in Figure 1. It mainly consists of a timing counter, row and column address storage and decoding circuit, display RAM, MPU interface circuit, and LCD interface circuit. Its interface with the outside is mainly divided into three parts: one part is power supply, reset signal and clock; one part is LCD interface, and the other part is interface with MPU (microprocessor). The interface with LCD is generally provided by the manufacturer of LCD module. For the user of LCD module, only the part with MPU interface needs to be mastered. In addition, SED1520 also needs to provide a 2KHZ clock signal [2].
The instruction list of SED1520 is shown in Table 1. Its display memory has 4 pages (corresponding to page addresses 0~3), each page has 80 bytes (corresponding to column addresses 0~79), and the 8-bit data in each byte corresponds to the 8-dot row in the same column on the display screen. The column address pointer manages these 80 byte units. The column address pointer is a 7-bit plus 1 counter. It and the page address register uniquely specify a unit of the display memory. The RAM in SED1520 has 32 lines, divided into 4 pages, 8 lines per page. If characters are displayed in 8*8 dot matrix, 10 characters can be written in one line per page, and 4 lines in total. Chinese characters are generally 16*16 dot matrix, so 5 characters can be displayed in each line, and 2 lines in total. If multiple SED1520s are put together, LCD modules with different display capacities can be formed.


The interface circuit between SED1520 and PIC16F874 is shown in Figure 2. The pins are described as follows:
 A0: instruction/data selection. A high level indicates that data is transmitted, and a low level indicates that instructions are transmitted.
 Chip select signal, low level is valid, and high level means that the MPU does not access SED1520.
Read enable, low level indicates that the MPU reads data or instructions from SED1520, and high level is invalid.
 Write enable, low level indicates that the MPU writes data or instructions to SED1520, and high level is invalid.
 CL: clock input terminal. Provided by RC1 of PIC16F874, it allows it to work in PWM2 output mode.
 D0~D7: data input and output pins.
 Reset signal input terminal, low level is valid.
 VDD: logic power positive.
 VSS: logic power ground. [page]

The interpretation and execution of the instructions of SED1520 do not rely on the external clock, but are synchronized by the internal clock, so its instruction execution speed is very fast, and it is generally not necessary to detect whether SED1520 is busy. Since the I/O port of PIC16F874 is output or input, the corresponding register must be set [3], as shown in Figure 2, the RD port of PIC16F874 must be set as an output port when writing data to SED1520, and it must be set as an input port when reading data. In order to simplify the program and increase the speed, we can write data directly to it without reading the status of SED1520. In this way, the RD pin of SED1520 is directly connected to a high level, and the RC3 pin of PIC16F874 can also be saved for other uses.
3 Specific programming examples
In specific practical applications, we often need to display Chinese characters. The general Chinese character model is shown in Figure 4. The 8 bits inside the byte are arranged horizontally, while for SED1520, the 8 bits of the byte are arranged vertically, that is, each character is displayed across 8 lines. It is necessary to display Chinese characters according to Figure 5.

Then the bytes of the font need to be calculated bit by bit as follows: bit7 of the 8 bytes of byte group 1 of the standard font is combined to become byte 1 of the SED1520 Chinese font, bit6 is combined to become byte 2 of the SED1520 Chinese font, and so on, the 32 bytes of the SED1520 Chinese font can be calculated. When displaying, first determine the position of byte 1 (page address and column address), then display bytes 1 to byte 16 continuously, then add 1 to the page address, and the column address is the column address of byte 1. After setting, send bytes 17 to byte 32 to complete the display of a Chinese character. We will take 12232 as an example to introduce the use of the LCD module. 12232 has two built-in SED1520s. Different SED1520s are accessed through chip selection. It can display 4 lines (corresponding to page addresses 0~3), and each line can display 122 characters. The first 61 characters correspond to the left SED1520, and the last 61 characters correspond to the right SED1520. Column addresses 0~60 correspond to the positions of these 61 characters, and column addresses 61~79 are not used. The program flow chart for initializing SED1520 is shown in Figure 3. Clearing the screen is to set all the data in the display RAM to 0. After initialization, to display characters at a specific position, you need to set the corresponding page address (row) and column address, and then write data to SED1520. The following is the display part initialization program flow chart.


4 Conclusion
SED1520 is a high performance-price ratio LCD driver chip. It can be used in various instruments with single-chip microcomputer interface, which has the characteristics of hardware saving, low power consumption, and simple software program. The interface design has been successfully applied to the display of electric vehicle power management, proving that the design is stable and reliable.
The author's innovation point: Before writing data to the LCD controller, the single-chip microcomputer generally reads whether it is busy to avoid data writing failure, and the I/O port of the PIC single-chip microcomputer must constantly change the setting of the port during the function conversion between reading and writing, so the program is very cumbersome and may also cause system instability. After actual design and application, the author omitted the read status detection of the LCD controller and made appropriate delays according to the read and write timing described in the SED1520 data sheet. This streamlined the program and saved the I/O port, which is relatively valuable in the single-chip microcomputer system design, and the system has been stable.

Reference address:Interface Design between LCD Display and PIC Microcontroller

Previous article:Automobile Electric Power Steering System Using PIC Microcontroller
Next article:High-precision data acquisition device based on PIC16F87X series microcontroller

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号