Design of LCD display system based on STC89C52 and HT1621D

Publisher:chinalisaLatest update time:2012-11-03 Source: 维库电子Keywords:STC89C52  HT1621D Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Liquid crystal display (LCD) has many advantages that many other displays cannot match, such as low power consumption, small size, light weight, ultra-thin, large visible area, good picture effect, high resolution, strong anti-interference ability, etc. In recent years, it has been widely used in intelligent instruments, meters and low-power electronic systems controlled by single-chip microcomputers. In a microcontroller system with a single-chip microcomputer as the core, the interface between the single-chip microcomputer and the display device is an indispensable link. The specific work includes selecting the type of display device, whether the interface adopts serial or parallel mode, etc. In view of the requirements of intelligent industrial equipment controlled by single-chip microcomputers for simple and convenient human-computer dialogue interfaces, this article discusses in detail a hardware interface circuit and software programming method between the segmented liquid crystal module HT1621D and the single-chip microcomputer STC89C52.

1 HT1621 LCD module and STC89CS2 microcontroller

The HT1621 is a 128-dot memory-mapped and multifunctional LCD driver. The software configuration feature of the HT1621 makes it suitable for a variety of LCD applications, including LCD modules and display subsystems. The static display memory RAM stores the displayed data in a 32×4-bit format. The RAM data is directly mapped to the LCD driver and can be accessed using the READ, WRITE and READ-MODIFY-WRITE commands. The HT1 621D pinout is shown in Figure 1.

HT1621D Pin Diagram

Figure 1 HT1621D pin diagram

The functions of each pin are as follows:

COM0~COM2: LCD common output port.

SEG1~SEG31: LCD segment output port.

:Chip select input, connected to a pull-up resistor. When is high level, the data and commands read and written to HT1621 are invalid, and the serial interface circuit is reset; when is low level and serves as input, the data and commands read and written to HT1621 are valid.

: READ pulse input, connected to a pull-up resistor. At the falling edge of the signal, the data in the HT1621 memory is read to the DATA line, and the host controller can latch this data at the next rising edge.

: WRITE pulse input, connected to a pull-up resistor. At the rising edge of the signal, the data on the DATA line is written to the HT1621.

DATA: Serial data input/output with external pull-up resistor.

VSS: negative power supply; ground.

VLCD: LCD power input.

VDD: positive power supply.

: Time base or watchdog timer overflow flag, NMOS open drain output.

BZ: Sound frequency output.

STC89C52 is a low-power, high-performance CMOS 8-bit microcontroller. Its most prominent advantage is the 8 KB reprogrammable FLASH program memory integrated in the chip. With ISP function, user programs can be downloaded directly through the serial port, which is convenient for debugging programs. The internal 8 KB FLASH E2PROM allows user-compiled programs and letters, numbers, Chinese characters and graphics to be displayed to be stored in it, eliminating the trouble of expanding external memory, making the control system circuit with STC89C52 microcontroller as the core simpler, very suitable for liquid crystal display, and widely used in intelligent instruments, meters and low-power electronic products.

2 Hardware Circuit Design

Considering that the peripheral expansion circuit of the single-chip microcomputer should be as small as possible, the simpler the hardware structure, the better. If the 8-bit data line of the LCD display and the single-chip microcomputer adopt a parallel interface, the data line will occupy 8 bits, plus some other control lines, which will occupy more I/O port lines. Therefore, in many instrument applications, the 8-bit data line of the LCD display and the single-chip microcomputer are serially interfaced through serial input and parallel output devices to achieve a practical and accurate data transmission method. Only three wires are needed to connect the HT1621 and the microcontroller, that is, the three pins of the HT1621 , DATA and , are connected to P3.4, P3.3 and P3.5 of the single-chip microcomputer respectively.

The HT1621D has only four pins for the interface. Pin is used to initialize the serial interface circuit and terminate the communication between the host controller and the HT1621. When pin is set to "1", the data and commands between the host controller and the HT1621 are invalid and initialized. Before generating a mode command or mode conversion, the serial interface of the HT1621 must be initialized with a high-level pulse. Pin DATA is a serial data input/output pin. Read/write data and write commands are performed through pin DATA. Pin is a read clock input pin. At the falling edge of the signal, data is output to pin DATA. Between the rising edge of the signal and the next falling edge, the host controller should read the corresponding data. Pin is a write clock input pin. At the rising edge of the signal, the data, address and command on pin DATA are written to the HT1621. The optional pin can be used as an interface between the host controller and the HT1621, and can be set by software as a timer output or WDT overflow flag output. After the main controller is connected to the of HT1621, the time base or WDT function can be realized. Its hardware circuit is shown in Figure 2.

LCD display circuit

Figure 2 LCD display circuit

3 Software Design

3.1 LCD driver related commands

The HT1621 can be configured using software. Two modes of commands can configure the HT1621 and transmit data displayed on the LCD. The configuration mode of the HT1621 is called the command mode, and the command mode type code is 100. The command mode includes a system configuration command, a system frequency selection command, an LCD configuration command, a sound frequency selection command, a timer setting command, and an operation command. The data mode includes READ, WRITE, and READ-MODIFY-WRITE operations. The data and command mode types are as follows:

Code

The mode command should be executed before data or command transmission. If a continuous command is executed, the command mode code, i.e. 100, will be ignored. When the system is in discontinuous command mode or discontinuous address data mode, the pin should be set to "1" and the previous operation mode will be reset. When the pin returns to "0", the new operation mode type code should be executed first.

3.2 Working sequence

Only by mastering and being familiar with the HT1621 working timing diagram can you better perform software programming. The command mode timing diagram of the HT1621 is shown in Figure 3, and the write mode timing diagram is shown in Figure 4.

Command Mode Timing Diagram

Figure 3 Command mode timing diagram

WRITE mode timing diagram

Figure 4 Timing diagram of WRITE mode

WRITE101

a5 a4 a3 a2 a1 a0 d0 d1 d2 d3 write data to RAM

a5~a0 RAM address; d3~d0 RAM data

3.3 LCD display program writing

To correctly write an LCD display program, it is necessary to know the correspondence between the HT1621 segments and the LCD screen. The RAM data is directly mapped to the LCD driver. The RAM can be seen as an image consisting of SEG1~SEG31 and COM0~COM2. The HT1621 RAM segment code mapping is shown in Table 1.

Table 1 HT1621 RAM segment code mapping table

HT1621 RAM segment code mapping table

Each symbol to be displayed on the LCD screen corresponds to a bit in the RAM. To display a bit, just set the unit corresponding to the bit, that is, the intersection of SEG and COM, to "1". If you don't want to display it, set the bit to "0". The digital display of 0 to 9 is displayed using seven-segment codes. When writing a display program, you can put the display code of the content to be displayed in a table, and then in the program, you can find the corresponding content to be displayed according to this display code by looking up the table. The LCD display subroutine flow is shown in Figure 5.

LCD display subroutine flow chart

Figure 5 LCD display subroutine flow chart

4 Conclusion

This paper introduces in detail a practical hardware interface circuit and software programming method between the segment LCD display module HT1621 and the single-chip microcomputer STC89C52. This design not only has a simple and reliable hardware circuit, but also can conveniently display Chinese characters, letters and graphics. It also saves the port lines of the single-chip microcomputer, makes full use of system resources, realizes interactive display and graphic human-computer interface effects, and has been successfully applied in a variety of household appliances and industrial equipment, with good practical value.

Keywords:STC89C52  HT1621D Reference address:Design of LCD display system based on STC89C52 and HT1621D

Previous article:Design of LCD display system based on STC89C52 and HT1621D
Next article:Sigma-Delta ADC Application Brief

Recommended ReadingLatest update time:2024-11-16 18:07

An indoor air control scheme based on STC89C52 single chip microcomputer
    With the progress of society and the improvement of living standards, people have put forward higher and higher requirements for living environment. In addition to a comfortable thermal environment, healthy and fresh air and safe and convenient control have also attracted more and more attention. At present, most
[Microcontroller]
An indoor air control scheme based on STC89C52 single chip microcomputer
Design of Multimeter Based on 51 Single Chip Microcomputer
1 Working Principle The multimeter is one of the commonly used instruments in the electrical and electronic industries. This paper develops circuits and software for the MCS-51 single-chip microcomputer to achieve accurate measurement of resistance, inductance, and capacitance, and uses the DDS chip to generate arbit
[Microcontroller]
Design of Multimeter Based on 51 Single Chip Microcomputer
Design of STC89C52RC programmer based on CH340T
    The programmer communicates with the PC host computer through the USB interface. Users only need to perform simple operations on the PC host computer GUI to erase, program, verify and encrypt STC 89C/S51XX/52XX series microcontrollers. After repeated tests on STC89C52RC and other microcontrollers, the programmer h
[Microcontroller]
Design of STC89C52RC programmer based on CH340T
D/A: Detailed explanation of D/A design based on STC89C52 and DAC0832
1. Detailed explanation of hardware design   1) D/A conversion principle Digital quantities are represented by binary codes in combination of digits. For weighted codes, each digit has a certain weight. To convert the code into analog quantity, each bit of code must be converted into the corresponding analog q
[Microcontroller]
D/A: Detailed explanation of D/A design based on STC89C52 and DAC0832
Brief Analysis of 51 Single Chip Microcomputer (STC89C52RC) Keil Software Precise Timing
  Here I mainly give my own opinions on the problem of improving the software accuracy of 51 single-chip microcomputers using the Keil environment. I have read the article Using Keil Cx51 to achieve accurate timing of T0 . The method in the article can indeed improve the software accuracy, but when there are many stat
[Microcontroller]
Brief Analysis of 51 Single Chip Microcomputer (STC89C52RC) Keil Software Precise Timing
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号