Application of Chinese LCD LCM12832ZK module in motor soft starter

Publisher:光明2599Latest update time:2012-10-24 Source: 维库电子 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1 Introduction

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

. Keyboard design principles

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.

Hardware Wiring
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.

Timing
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

and


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.

When S is 0:1, data is written 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 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

LCD initialization process


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

sp; ; Display general subroutines

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.

Reference address:Application of Chinese LCD LCM12832ZK module in motor soft starter

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

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号