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.
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.
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:
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.
Figure 3 Command 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
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.
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.
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
- Popular Resources
- Popular amplifiers
- 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
- How to configure LSM6DS3TR-C single and double click at the same time
- MCU serial port sends data frame
- [RVB2601 Creative Application Development] @fxyc87 RVB2601-CLI (Command Prompt) Test
- R329 Development Board Unboxing
- TI blog post: How to regulate low-voltage isolated power supplies
- EEWORLD University ---- Python Chinese video tutorial
- Fluke Live Broadcast with Prizes | New 8.5-digit Digital Multimeter Technology Development and Application Registration Open!
- RL78 MCU Timer
- [Smart Network Desk Lamp] 6. ESP32-S2 solves the problem of excessive RAM space overhead
- ADC Experiment of DSP5509