LCD liquid crystal display has many advantages that other displays cannot match, such as low power consumption, small size, light weight, and ultra-thinness , and has been widely used in various intelligent instruments and low-power electronic products. Dot matrix or graphic LCD can not only display characters and numbers, but also various graphics, curves and Chinese characters, and can realize functions such as screen scrolling, animation, flashing, and text feature display, and has a wide range of uses.
2 Keyboard design principles
The 8-bit PIC16F877 microcontroller from Microchip Technology of the United States is used
to implement parameter modification by using the RB port level change interrupt. More than 200 starting modes can be selected through table lookup, and more than 200 parameter values can be input under the selected starting mode. The maximum selection value depends on the upper limit values of registers N and M, as shown in Figure 1
.
When reading the RB port status, software debouncing is required, that is, the RB port status is read, and then the software delays about 50ms before reading the RB port status again. If the status is the same twice, it means the status is correct, preventing erroneous operation caused by jitter.
3 Hardware wiring of Chinese LCD display LCM12832ZK and microcontroller PIC16F877
In this design, the microcontroller PIC16F877 and the Chinese liquid crystal display LCM12832ZK adopt analog serial communication mode. The microcontroller RD5 pin is connected to the LCD serial clock line E, the microcontroller RD6 pin is connected to the LCD data line RW, and the microcontroller RD7 pin is connected to the LCD serial select line RS.
As shown in Figure 2, R1 is used to adjust the brightness of the LCD backlight, and R2 is used to adjust the brightness of the Chinese subtitles on the LCD. Adjusting the potentiometer R2 to an appropriate value is very important for subtitle display. When R2 is too large, the LCD screen is black; when R2 is too small, the LCD is too bright and the font display cannot be seen.
|
The RB port should be set to weak pull-up. Using the RB port level change interrupt, find the corresponding interrupt service subroutine by looking up the table. There are more than 200 parameters to choose from, and the operation is simple and convenient.
4 Serial and parallel interfaces of Chinese LCD display LCM12832ZK
4.1 LCM12832ZK pins and their functions are shown in Table (1):
4.2 Basic functions of LCM12832ZK LCD display
LCM12832ZK can display two lines, each line can display 8 Chinese characters. Its font ROM contains 8192 Chinese fonts and 128 half-width alphabetic fonts. In addition, the graphics display screen provides a drawing area GDRAM, and the built-in CGRAM provides 4 sets of software-programmable dot matrix character creation functions.
LCM12832ZK has flexible interface with microcontrollers such as single-chip microcomputers, three modes of parallel 8-bit/4-bit and serial 3-wire/2-wire, and can also realize Chinese characters, ASCII codes and dot matrix images.
Table (1):
It has the same-screen display of the same shape, as well as commands to move the current display screen up/down/left/right and clear the screen, cursor display/blinking control commands and LCD sleep/wake-up/display off commands, and reserves a variety of control lines, such as reset/serial-parallel selection/brightness adjustment, for users to use flexibly.
4.3 Parallel/Serial Interface Module Settings
4.4 Serial interface data transmission
This design uses the serial mode, that is, the short-circuit resistor of the S/P on the back of the module is on the "S" side. In the serial mode, two transmission lines will be used to transmit serial data. The main control system will coordinate the transmission synchronization clock (SCLK) and the receiving serial data line (SID) to complete the serial transmission action.
When the serial interface transmits data, the chip select CS is set to 1 first. When the rising edge of the clock SCLK arrives, a data is transmitted. From the perspective of a complete serial transmission process, the start bit is transmitted first. It needs to receive five consecutive "1" (synchronous bit string) in the start byte first. At this time, the transmission count will be reset and the serial transmission will be synchronized. The following two BITs specify the transmission direction bit (RW) and the register selection bit (RS). When RW:RS is 0:0, the command is written to the LCD RAM. RW:RS is 0:0.
|
After receiving the start byte, each command/data will be received in two groups: the higher 4 bits (DB7~DB4) of the command data will be placed in the LSB part of the first group, and the lower 4 bits (DB3~DB0) of the command data will be placed in the LSB part of the second group. As for the other four related bits, they are all 0, as shown in Figure 4.
5 Serial interface programming of Chinese LCD display LCM12832ZK
5.1 PIC16F877 MCU serial port settings
#DEFINE CS PORTD,7; CS is chip select, 1 when working
#DEFINE SCLK PORTD,5 ;SCLK is the clock line, rising edge action
#DEFINE SID PORTD,6; SID is the data line
5.2 Initialization process of Chinese LCD display LCM12832ZK
MOVLW .40
CALL DELAY_2
MOVLW B'00110000' ; Function setting
MOVWF DAT
CALL W_COMMOND
CALL DELY_1
MOVLW B'00110000' ; Function setting
MOVWF DAT
CALL W_COMMOND
CALL DELY_1
MOVLW B'00001100' ;Display status on/off
MOVWF DAT
CALL W_COMMOND
CALL DELY_1
MOVLW B'00000001' ; Clear display
MOVWF DAT
CALL W_COMMOND
MOVLW .10
CALL DELAY_2
MOVLW B'00000110' ;Entry point setting
MOVWF DAT
CALL
W_COMMOND
5.3 Chinese LCD display LCM12832ZK font display subroutine
The data and instructions of the single-chip microcomputer are sent to the Chinese LCD display LCM12832ZK module in a serial transmission mode, one byte at a time. During transmission, the LCM12832ZK Chinese LCD display has a fixed transmission mode. This design uses a cyclic method to transmit 24 bits at a time in the software. The specific timing is shown in Figure 4. The implementation program is as follows:
MOVLW 0XB2 ; Display "参" subroutine
MOVWF DATH; "B2CE" is the font code of "参"
MOVLW 0XCE
MOVWF DATL
MOVLW B'10000000'; 80H is the display address of the word "參"
CALL DISPLAY
DISPLAY &nb
|
MOVWF DAT
CALL W_COMMOND ;Call the write command subroutine
CALL DELY_1 ; call a subroutine with a delay of 100μs
BSF RWRS,0; the 1 and 0 bits of RWRS are command and data judgment bits
BCF RWRS,1; bit1-bit0: 00 transmission command
MOVF DATH,W ;bit1-bit0: 01 transfer data
MOVWF DAT
CALL WRITE_1 ;Call the data writing subroutine
MOVF DATL,W
MOVWF DAT
CALL WRITE_1
RETURN
6 Conclusion
The PIC16F877 single-chip microcomputer is used to control the LCM12832ZK Chinese LCD display and the multi-parameter keyboard input programming method. It is practical, low-cost, has small instructions, powerful functions, and is easy to learn. The external wiring is simple and flexible, and the software is easy to modify. The LCM12832ZK Chinese LCD display has powerful fonts and graphic editing functions, and is suitable for the intelligent LCD display part of various low-voltage electrical appliances.
Previous article:Detailed Design of Single Chip Microcomputer LED Chinese Character Dot Matrix Display
Next article:Design of a high power LED constant current source series driver
- Popular Resources
- Popular amplifiers
- Linux lcd_display_font tutorial
- Research on control algorithm and program design of intelligent tracking car_Technical report of the first \"Freescale\" Cup National College Student Intelligent Car Invitational Competition
- Design of voice/text message wireless transmitter
- v4l2 acquisition and display program
- 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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- Different backlight structure types in monochrome LCD screens
- 3rd Anniversary
- Instrumentation Amplifiers: CMRR, You Stole My Precision
- DSP Flash API Steps
- The physical meaning of FFT results
- MSP430 - Timer_A timer interrupt program
- Buck switching power supply MOS tube gate has pwm signal, but cannot conduct normally
- Motor Driver
- Sharing on the serious problem of LM2611 output voltage heating
- How much do you know about the "ADI Inside" behind these popular healthcare products?