1 Introduction
Because LCD liquid crystal displays have low power consumption, small size, light weight, ultra-thin and many other advantages that other displays cannot match, they have 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. It can also realize functions such as screen scrolling, animation, flashing, and text feature display. It has a wide range of uses.
2 Keyboard design principles
Using the 8-bit PIC16F877 microcontroller from Microchip Technology Company of the United States, the RB port level change interrupt is used to realize parameter modification. Through the table lookup method, more than 200 starting modes can be selected and more than 200 parameter values can be input under the selected starting mode. The maximum selection value depends on the upper limit value of registers N and M, as shown in Figure 1.
Reading the RB port status requires software debounce processing, that is, reading the RB port status, and then the software delays about 50ms before reading the RB port status. The same status twice indicates that the status is correct to prevent misoperation caused by jitter.
3 Hardware wiring between Chinese LCD display LCM12832ZK and microcontroller PIC16F877
In this design, the single-chip computer PIC16F877 and the Chinese LCD display LCM12832ZK adopt an analog serial communication method. The single-chip computer RD5 pin is connected to the LCD serial clock line E, the single-chip computer RD6 pin is connected to the LCD data line RW, and the single-chip computer RD7 pin is connected to the LCD serial select line. Pass through 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 becomes black; when R2 is too small, the LCD screen is too bright and the font display cannot be seen.
The RB port should be set to a weak pull-up. Use the RB port level change interrupt to find the corresponding interrupt service subroutine through table lookup. There are up to two hundred 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 liquid crystal display
LCM12832ZK can display two lines, and each line can display 8 Chinese characters. Its font ROM contains 8192 Chinese fonts and 128 half-width alphabetic symbol fonts. In addition, the drawing display screen provides a drawing area GDRAM, and contains CGRAM to provide 4 sets of software-programmable dot matrix character creation functions.
The interface between LCM12832ZK and microcontrollers such as microcontrollers is flexible. It has three modes: parallel 8-bit/4-bit and serial 3-wire/2-wire. It can also realize Chinese characters, ASCII codes and bitmaps.
Table 1):
Shaped same-screen display, as well as commands to move the current display screen up/down/left/right and clear the screen, cursor display/flash control commands and LCD sleep/wake/close display commands reserve multiple control lines, such as reset /Serial and parallel selection/brightness adjustment for users to use flexibly.
4.3 Parallel/serial interface module settings
4.4 Serial interface data transmission
This design adopts serial mode, that is, the short-circuit resistor of S/P on the back of the module is on the "S" side. In serial mode, two transmission lines will be used to transmit serial data. The main control system will cooperate with the transmission synchronization clock (SCLK) and the reception serial data line (SID) to complete the serial transmission action.
When the serial interface transmits data, the chip select CS is first set to 1. When the rising edge of clock SCLK arrives, a data is transmitted. From a complete serial transmission process, the start bit is transmitted first. It needs to receive five consecutive "1" (synchronization bit string) in the start byte group. At this time, the transmission count will be reset. Set and the serial transmission will be synchronized, and the following two BITs specify the transmission direction bit (RW) and the temporary register selection bit (RS) respectively. When RW:RS is 0:0, write the command to the LCD RAM, RW When :RS is 0:1, write data to the LCD RAM, and the last eighth bit is "0".
After receiving the start byte, each command/data will be received in two groups: the higher 4-bit (DB7~DB4) command data will be placed in the LSB part of the first group, and the higher 4-bit command data will be placed in the LSB part of the first group. The command data of the lower 4 bits (DB3~DB0) will be placed in the LSB part of the second group, and the other four related bits are all 0, as shown in Figure 4.
5 Serial interface program design of Chinese LCD display LCM12832ZK
5.1 PIC16F877 microcontroller serial port settings
#DEFINE CS PORTD,7 ;CS is the chip select, it is 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' ;Enter point setting
MOVWF DAT
CALL W_COMMOND
5.3 Chinese LCD display LCM12832ZK font display subroutine
The data and instructions of the microcontroller are sent to the Chinese liquid crystal display LCM12832ZK module in a serial transmission manner, and each time 1 byte is input. 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, and the implementation program is as follows:
MOVLW 0XB2; Subroutine to display the word “parameter”
MOVWF DATH; where "B2CE" is the font code of "parameter"
MOVLW 0XCE
MOVWF DATL
MOVLW B'10000000'; 80H is the display address of "parameter"
CALL DISPLAY
DISPLAY ;display general subroutines
MOVWF DAT
CALL W_COMMOND; call write command subroutine
CALL DELY_1; Call a subroutine with a delay of 100μs
BSF RWRS,0; bits 1 and 0 of RWRS are command and data judgment bits
BCF RWRS,1; bit1-bit0: 00 transmission command
MOVF DATH,W; bit1-bit0: 01 transmit data
MOVWF DAT
CALL WRITE_1; call the write data subroutine
MOVF DATL,W
MOVWF DAT
CALL WRITE_1
RETURN
6 Conclusion
The PIC16F877 microcontroller is used to control the LCM12832ZK Chinese LCD display and the multi-parameter keyboard input programming method. It has the characteristics of practicality, low price, small instructions, strong functions and easy to learn. The external wiring is simple and flexible, and the software modification is convenient. The LCM12832ZK Chinese LCD display used has powerful font library and graphic editing functions, and is suitable for the intelligent LCD display part of various low-voltage electrical appliances.
references
[1] Translated by Liu Heping, et al. PIC16F87X Data Manual [M]. Beijing: Beihang University Press, 2001.6 Welcome to Wuyou Electronics Development Network (online shopping mall for online reading of technical articles)
[2] Liu Heping, et al., eds. PIC16F87X Microcontroller Practical Software and Interface Technology [M]. Beijing: Beihang University Press, 2002.3
[3]LCMXXXXZK Instruction Manual[M]. Beijing: Beijing Qingyun Innovation Technology Co., Ltd., 2003
[4]Microchip CDROM. United States: Microchip company, 2002
Previous article:Implementation of CANopen protocol in servo motor control system
Next article:Design of intelligent motor protector based on DSP
Recommended ReadingLatest update time:2024-11-16 20:59
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- The half-bridge chip 2104 drives a single NMOS on the high side. Is it theoretically possible?
- Noise Figure Measurement Handbook
- X-nucleo-iks01A3 application--using Lis2DW12 accelerometer to calculate angle
- Invite you to attend! Make electronic systems ubiquitous - Mentor 2019 PCB Industry Solution Forum
- What knowledge do you need for infrared temperature measurement?
- ISM330DHCX Machine Learning Core Chinese Documentation
- 27 "Ten Thousand Miles" Raspberry Pi Car - Fix and Get the Raspberry Pi IP Address
- GD32F305 CAN debugging failed
- [Xianji HPM6750 Review] Simple unboxing and data download
- Why do electrolytic capacitors explode? How to avoid it?