返回主页 单片机教程XL2000开发板 单片机学习 自制编程器 单片机资料 软件下载 电子技术产品介绍如何购买 论坛

        12864液晶原理+程序+ 照片+电路图

        下载汉字取模软件 以及完整的ASM,HEX 源程序 直接烧写使用!

        ;12864(带字库汉字显示演示程序)
        ;***************************************************************************
        ;* sxj1974@163.com (51c51 test web) www.8951.com *
        ;* Create by :石学军 www.districtaligarh.com 更多例程请登陆网站 *
        ;***************************************************************************

        RS EQU P2.0
        RW EQU P2.1
        E EQU P2.2
        PSB EQU P2.3
        RST EQU P2.5
        ;-----------------------------------------------
        LCD_X EQU 30H
        LCD_Y EQU 31H
        COUNT EQU 32H
        COUNT1 EQU 33H
        COUNT2 EQU 34H
        COUNT3 EQU 35H
        ;-----------------------------------------------
        LCD_DATA EQU 36H
        LCD_DATA1 EQU 37H
        LCD_DATA2 EQU 38H
        STORE EQU 39H

        ;-----------------------------------------------
        ORG 0000H
        LJMP MAIN
        ORG 0100H
        ;-----------------------------------------------
        MAIN:
        MOV SP,#5FH
        CLR RST ;复位
        LCALL DELAY4
        SETB RST
        NOP
        SETB PSB ;通讯方式为8位数据并口

        ;********************初始化**********************
        LGS0: MOV A,#34H ;34H--扩充指令操作
        LCALL SEND_I
        MOV A,#30H ;30H--基本指令操作
        LCALL SEND_I
        MOV A,#01H ;清除显示
        LCALL SEND_I
        MOV A,#06H ;指定在资料写入或读取时,光标的移动方向
        LCALL SEND_I ;DDRAM 的地址计数器(AC)加1
        MOV A,#0CH ;开显示,关光标,不闪烁
        LCALL SEND_I
        ;===============================================
        TU_PLAY1:
        MOV DPTR,#TU_TAB1 ;显示图形
        LCALL PHO_DISP
        LCALL DELAY3

        ;=================================================
        ;;显示汉字和字符
        ;加入80ms的延时,使你能够看清楚显示的过程
        ;根据汉字显示坐标分段写入(顺序写入)
        ;=================================================
        HAN_WR2:
        LCALL CLEAR_P
        HAN_WR2A:
        MOV DPTR,#TAB1A ;显示汉字和字符
        MOV COUNT,#10H ;地址计数器设为16。
        MOV A,#80H ;第一行起始地址
        LCALL SEND_I
        LCALL QUSHU
        HAN_WR2B:
        MOV DPTR,#TAB1B ;显示汉字和字符
        MOV COUNT,#10H ;地址计数器设为16。
        MOV A,#90H ;第二行起始地址
        LCALL SEND_I
        LCALL QUSHU
        HAN_WR2C:
        MOV DPTR,#TAB1C ;显示汉字和字符
        MOV COUNT,#10H ;地址计数器设为16。
        MOV A,#88H ;第三行起始地址
        LCALL SEND_I
        LCALL QUSHU
        HAN_WR2D:
        MOV DPTR,#TAB1D ;显示汉字和字符
        MOV COUNT,#10H ;地址计数器设为16。
        MOV A,#98H ;第四行起始地址
        LCALL SEND_I
        LCALL QUSHU
        LCALL DELAY3
        LCALL FLASH
        LCALL CLEAR_P
        JMP TU_PLAY2
        ;----------------------------------------------
        ;TU_PLAY1:
        MOV DPTR,#TU_TAB1 ;显示图形
        LCALL PHO_DISP
        LCALL DELAY3

        ;----------------------------------------------
        TU_PLAY2:
        MOV DPTR,#TU_TAB2 ;显示图形
        LCALL PHO_DISP
        LCALL DELAY3

        ;----------------------------------------------
        TU_PLAY3:
        MOV DPTR,#TU_TAB4 ;显示图形
        LCALL PHO_DISP
        LCALL DELAY3

        ;-----------------------------------------------
        ;显示点阵
        ;-----------------------------------------------
        LATPLAY1:
        MOV A,#01H ;清屏
        LCALL SEND_I
        MOV LCD_DATA1,#0CCH ;显示点阵
        MOV LCD_DATA2,#0CCH
        LCALL LAT_DISP
        LCALL DELAY3
        LCALL CLEAR_P

        KU_PLAY2:

        LJMP TU_PLAY1

        ;===============================================
        ;全屏显示图形子程序
        ;===============================================
        PHO_DISP:
        MOV COUNT3,#02H
        MOV LCD_X,#80H
        PHO_DISP1:
        MOV LCD_Y,#80H
        MOV COUNT2,#20H
        PHO_DISP2:
        MOV COUNT1,#10H
        LCALL WR_ZB
        PHO_DISP3:
        CLR A
        MOVC A,@A+DPTR
        LCALL SEND_D
        INC DPTR
        DJNZ COUNT1,PHO_DISP3
        INC LCD_Y
        DJNZ COUNT2,PHO_DISP2
        MOV LCD_X,#88H
        DJNZ COUNT3,PHO_DISP1

        MOV A,#36H
        LCALL SEND_I
        MOV A,#30H
        LCALL SEND_I
        RET
        ;----------------------------------------------
        CLRRAM:
        MOV LCD_DATA1,#00H ;GDRAM写0子程序
        MOV LCD_DATA2,#00H
        LCALL LAT_DISP
        RET
        ;==============================================
        ;显示点阵子程序
        ;==============================================
        LAT_DISP:
        MOV COUNT3,#02H
        MOV LCD_X,#80H
        LAT_DISP1:
        MOV LCD_Y,#80H
        CLR F0
        MOV COUNT2,#20H
        LAT_DISP2:
        MOV COUNT1,#10H
        LCALL WR_ZB
        LAT_DISP3:
        JB F0,LAT_DISP32
        MOV LCD_DATA,LCD_DATA1
        AJMP LAT_DISP31
        LAT_DISP32:
        MOV LCD_DATA,LCD_DATA2
        LAT_DISP31:
        MOV A,LCD_DATA
        LCALL SEND_D
        DJNZ COUNT1,LAT_DISP31
        INC LCD_Y
        CPL F0
        DJNZ COUNT2,LAT_DISP2
        MOV LCD_X,#88H
        DJNZ COUNT3,LAT_DISP1

        MOV A,#36H
        LCALL SEND_I
        MOV A,#30H
        LCALL SEND_I
        RET
        ;---------------------------------------------
        WR_ZB:
        MOV A,#34H
        LCALL SEND_I
        MOV A,LCD_Y
        LCALL SEND_I
        MOV A,LCD_X
        LCALL SEND_I
        MOV A,#30H
        LCALL SEND_I
        RET

        ;===============================================
        FLASH:
        MOV A,#08H ;关闭显示
        LCALL SEND_I
        LCALL DELAY5
        MOV A,#0CH ;开显示,关光标,不闪烁
        LCALL SEND_I
        LCALL DELAY5
        MOV A,#08H ;关闭显示
        LCALL SEND_I
        LCALL DELAY5
        MOV A,#0CH ;开显示,关光标,不闪烁
        LCALL SEND_I
        LCALL DELAY5
        MOV A,#08H ;关闭显示
        LCALL SEND_I
        LCALL DELAY5
        RET
        ;==================================================
        ;清屏
        ;==================================================
        CLEAR_P:
        MOV A,#01H ;清屏
        LCALL SEND_I
        MOV A,#34H
        LCALL SEND_I
        MOV A,#30H
        LCALL SEND_I
        RET
        ;==================================================
        ;查表取数据送显示
        ;==================================================
        QUSHU:
        CLR A
        MOVC A,@A+DPTR ;查表取数据
        LCALL SEND_D ;送显示
        INC DPTR
        LCALL DELAY4 ;延时80ms,
        DJNZ COUNT,QUSHU
        RET

        ;===============================================
        ;写数据子程序
        ;RS=1,RW=0,E=高脉冲,D0-D7=数据
        ;===============================================
        SEND_D:
        LCALL CHK_BUSY ;写数据子程序
        SETB RS
        CLR RW
        MOV P0,A
        SETB E
        NOP
        NOP
        CLR E
        RET
        ;===============================================
        ;写指令子程序
        ;RS=0,RW=0,E=高脉冲,D0-D7=指令码
        ;===============================================
        SEND_I:
        LCALL CHK_BUSY
        CLR RS
        CLR RW
        MOV P0,A
        SETB E
        NOP
        NOP
        CLR E
        RET
        ;================================================
        ;读数据子程序
        ;RS=1,RW=1,E=H,D0-D7=数据
        ;================================================
        READ_D:
        LCALL CHK_BUSY ;读数据子程序
        SETB RS
        SETB RW
        SETB E
        NOP
        MOV A,P0
        CLR E
        MOV STORE,A
        RET
        ;================================================
        ;;测忙碌子程序
        ;RS=0,RW=1,E=H,D0-D7=状态字
        ;================================================
        CHK_BUSY:
        MOV P0,#0FFH ;测忙碌子程序
        CLR RS
        SETB RW
        SETB E
        JB P0.7,$
        CLR E
        RET
        ;================================================
        ;延时子程序

        DELAY3:
        MOV R5,#16H
        DEL31: MOV R6,#100
        DEL32: MOV R7,#0FFH
        DEL33: DJNZ R7,DEL33
        DJNZ R6,DEL32
        DJNZ R5,DEL31
        RET

        DELAY2:
        MOV R6,#0CH
        DEL21: MOV R7,#18H
        DEL22: DJNZ R7,DEL22
        DJNZ R6,DEL21
        RET

        DELAY1:
        MOV R6,#06H
        DEL11: MOV R7,#08H
        DEL12: DJNZ R7,DEL12
        DJNZ R6,DEL11
        RET

        DELAY4:
        MOV R6,#100
        DEL41: MOV R7,#200
        DEL42: DJNZ R7,DEL42
        DJNZ R6,DEL41
        RET

        DELAY5:
        MOV R5,#05H
        DEL51: MOV R6,#100
        DEL52: MOV R7,#0FFH
        DEL53: DJNZ R7,DEL53
        DJNZ R6,DEL52
        DJNZ R5,DEL51
        RET
        ;***********************************************
        TAB1:
        TAB1A: DB ' 51单片机学习网(深圳学林电子有限公司) ' ;显示在第一行
        TAB1C: DB '自学单片机第一站' ;显示在第三行
        TAB1B: DB ' WWW.8951.COM ' ;显示在第二行
        TAB1D: DB 'TEL 755-89956892' ;显示在第四行



        ;*-------------------------------------------------------------------- *
        ;* Bitmap点阵数据表 *
        ;* 图片: E:\图形8.bmp,横向取模左高位,数据排列:从左到右从上到下 *
        ;* 图片尺寸: 128 * 64 *
        ;*-------------------------------------------------------------------- *
        TU_TAB1: ; 数据表

        db 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 3Ch, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 7Fh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h,0FFh,0C0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 01h,0BFh,0F8h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 01h,0FFh,0DCh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 01h, 1Fh,0FEh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 01h,0DFh,0FFh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h,0FFh,0FFh, 19h, 8Ch, 03h, 06h, 00h, 18h, 00h,0FFh,0E1h
        db 80h, 00h, 00h, 00h, 00h, 3Fh,0FFh, 0Ch,0CCh, 03h, 06h, 00h, 18h, 00h,0FFh,0E1h
        db 80h, 00h, 00h, 00h, 00h, 7Fh,0FFh, 04h, 58h, 03h, 06h, 01h,0FFh,0C0h, 00h,0C1h
        db 80h, 00h, 00h, 00h, 00h, 7Fh,0DAh, 3Fh,0FEh, 0Fh,0DFh,0C1h,0FFh,0C0h, 01h, 81h
        db 80h, 00h, 00h, 00h, 00h, 7Fh, 8Ch, 3Fh,0FEh, 0Fh,0DFh,0C1h, 98h,0C0h, 07h, 01h
        db 80h, 00h, 00h, 00h, 00h, 7Fh,0B8h, 30h, 06h, 03h, 06h, 01h, 98h,0C0h, 06h, 01h
        db 80h, 00h, 00h, 00h, 00h,0FEh,0C0h, 0Fh,0F8h, 03h, 8Eh, 01h,0FFh,0C3h,0FFh,0F9h
        db 80h, 00h, 00h, 00h, 00h, 7Eh, 00h, 0Fh,0F8h, 07h,0CFh, 01h, 98h,0C3h,0FFh,0F9h
        db 80h, 00h, 00h, 00h, 00h, 7Fh, 00h, 00h, 60h, 07h, 5Fh, 81h, 98h,0C0h, 06h, 01h
        db 80h, 00h, 00h, 00h, 00h, 7Fh, 80h, 3Fh,0FEh, 0Fh, 36h,0C1h,0FFh,0C0h, 06h, 01h
        db 80h, 00h, 00h, 00h, 00h, 1Fh, 80h,0BFh,0FEh, 0Bh, 36h, 61h,0FFh,0C0h, 06h, 01h
        db 80h, 00h, 00h, 00h, 00h, 1Fh,0C7h, 00h,0C0h, 03h, 66h, 21h, 98h, 30h, 06h, 01h
        db 80h, 00h, 00h, 00h, 15h, 5Fh,0C7h, 00h,0C0h, 03h, 06h, 00h, 18h, 30h, 06h, 01h
        db 80h, 00h, 02h,0E0h, 06h, 7Fh,0CEh, 03h,0C0h, 03h, 06h, 00h, 1Fh,0F0h, 1Eh, 01h
        db 80h, 00h, 04h, 54h, 4Fh,0FFh,0FCh, 01h, 80h, 03h, 06h, 00h, 0Fh,0E0h, 0Ch, 01h
        db 80h, 00h, 03h,0FDh, 3Fh,0FFh,0D9h,0C0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 1Dh,0FFh,0FFh,0FFh, 87h, 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 2Bh,0FFh,0F8h, 7Fh, 06h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 3Fh,0BFh,0F8h, 09h, 0Fh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 1Fh, 9Fh,0F0h, 00h,0BCh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 9Dh,0FEh, 1Fh, 8Fh,0F0h, 00h,0F8h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 9Fh,0FCh, 17h, 8Fh,0F0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 81h,0FFh,0CFh, 9Fh,0E0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 82h,0FFh,0FFh, 9Ch, 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 81h, 7Fh,0FFh,0FCh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 6Fh,0FEh, 30h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 03h,0FCh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 34h, 14h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 0Eh, 18h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 02h, 30h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 01h,0E0h, 00h, 00h, 7Fh, 04h, 00h, 3Fh, 82h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 00h, 7Fh, 0Ch, 00h, 3Fh, 86h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 00h, 7Fh, 1Ch, 00h, 3Fh, 8Eh, 00h, 00h, 00h, 00h, 01h
        db 83h,0BBh, 9Dh,0DCh,0EEh,0E0h, 70h, 7Ch, 38h, 38h, 3Eh, 00h,0E0h, 38h, 3Bh, 31h
        db 83h,0BBh, 9Dh,0DCh,0EEh,0E0h, 70h, 7Ch, 3Ch, 38h, 3Eh, 00h,0F0h, 7Ch, 3Fh,0F9h
        db 83h,0BBh, 9Dh,0DCh,0EEh,0E0h, 76h, 1Ch, 7Eh, 3Bh, 0Eh, 01h,0F8h,0FEh, 3Fh,0F9h
        db 83h,0BBh, 9Dh,0DCh,0EEh,0E0h, 7Fh, 1Ch, 76h, 3Fh, 8Eh, 01h,0D8h,0EEh, 3Bh,0B9h
        db 83h,0BBh, 9Dh,0DCh,0EEh,0E0h, 7Fh, 1Ch, 76h, 3Fh, 8Eh, 01h,0D8h,0EEh, 3Bh,0B9h
        db 83h,0BBh, 9Dh,0DCh,0EEh,0E0h, 77h, 1Ch, 76h, 3Bh, 8Eh, 01h,0D8h,0EEh, 3Bh,0B9h
        db 81h,0BBh, 0Dh,0D8h, 6Eh,0C0h, 07h, 1Ch, 70h, 03h, 8Eh, 01h,0C0h,0EEh, 3Bh,0B9h
        db 81h,0ABh, 0Dh, 58h, 6Ah,0C0h, 07h, 1Ch, 70h, 03h, 8Eh, 01h,0C0h,0EEh, 3Bh,0B9h
        db 81h,0ABh, 0Dh, 58h, 6Ah,0C0h, 77h, 1Ch, 70h, 3Bh, 8Eh, 01h,0C0h,0EEh, 3Bh,0B9h
        db 81h,0ABh, 0Dh, 58h, 6Ah,0C0h, 77h, 1Ch, 76h, 3Bh, 8Eh, 01h,0D8h,0EEh, 3Bh,0B9h
        db 81h,0EFh, 0Fh, 78h, 7Bh,0C0h, 77h, 1Ch, 76h, 3Bh, 8Eh, 01h,0D8h,0EEh, 3Bh,0B9h
        db 81h,0EFh, 0Fh, 78h, 7Bh,0DCh, 77h, 1Ch, 76h, 3Bh, 8Eh, 39h,0D8h,0EEh, 3Bh,0B9h
        db 81h,0EFh, 0Fh, 78h, 7Bh,0DCh, 7Fh, 1Ch, 7Eh, 3Fh, 8Eh, 39h,0F8h,0FEh, 3Bh,0B9h
        db 81h,0EFh, 0Fh, 78h, 7Bh,0DCh, 3Eh, 1Ch, 3Ch, 1Fh, 0Eh, 38h,0F0h, 7Ch, 3Bh,0B9h
        db 81h,0EFh, 0Fh, 78h, 7Bh,0DCh, 1Ch, 1Ch, 3Ch, 0Eh, 0Eh, 38h,0F0h, 78h, 3Bh,0B9h
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh

        ;*-------------------------------------------------------------------- *
        ;* Bitmap点阵数据表 *
        ;* 图片: E:\图形12.bmp,横向取模左高位,数据排列:从左到右从上到下 *
        ;* 图片尺寸: 128 * 64 *
        ;*-------------------------------------------------------------------- *
        TU_TAB2: ; 数据表

        db 40h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 03h, 65h,0E8h, 80h, 00h, 01h
        db 9Ah,0D6h,0B4h, 42h, 00h, 00h, 00h, 00h, 00h, 00h, 34h,0DAh,0D0h, 00h, 00h, 01h
        db0A4h, 00h, 02h, 10h, 6Bh, 30h, 00h, 00h, 00h, 00h, 8Bh,0FFh, 30h, 00h, 00h, 01h
        db 42h,0D6h,0B0h, 42h, 80h, 00h, 00h, 00h, 00h, 16h, 77h,0FEh,0C0h, 00h, 00h, 01h
        db 42h,0D6h,0B0h, 42h, 80h, 00h, 00h, 00h, 00h, 16h, 77h,0FEh,0C0h, 00h, 00h, 01h
        db0B9h, 20h, 04h, 00h, 00h, 02h, 10h, 00h, 00h, 00h,0BCh,0BCh, 00h, 00h, 00h, 01h
        db 46h,0D6h,0B1h,0ACh, 6Bh, 30h, 00h, 00h, 02h, 29h,0CBh, 40h, 00h, 00h, 00h, 01h
        db0FFh,0F9h, 04h, 01h, 00h, 00h, 00h, 00h, 01h, 16h,0B4h,0A0h, 00h, 00h, 00h, 01h
        db0FFh,0FFh,0F2h, 50h, 00h, 40h, 00h, 00h, 00h, 29h, 4Bh, 00h, 00h, 00h, 00h, 01h
        db0FFh,0FFh,0F2h, 50h, 00h, 40h, 00h, 00h, 00h, 29h, 4Bh, 00h, 00h, 00h, 00h, 01h
        db0FFh,0FFh,0BDh, 82h, 94h, 00h, 40h, 00h, 00h,0C9h, 30h, 02h, 00h, 00h, 00h, 01h
        db0FFh,0FFh,0FBh,0B0h, 00h, 08h, 00h, 00h, 05h, 16h, 44h, 40h, 00h, 00h, 00h, 01h
        db0FFh,0FFh,0FFh,0EFh, 90h, 40h, 00h, 00h, 00h, 21h, 00h, 04h,0C8h, 30h, 00h, 01h
        db0A5h,0FFh,0FFh,0FDh, 6Bh, 00h, 00h, 00h, 00h,0C8h, 00h, 99h, 16h,0FAh, 40h, 01h
        db0A5h,0FFh,0FFh,0FDh, 6Bh, 00h, 00h, 00h, 00h,0C8h, 00h, 99h, 16h,0FAh, 40h, 01h
        db 82h, 2Fh,0FFh,0FFh,0E8h, 84h, 00h, 00h, 00h, 00h, 08h, 00h,0DFh,0FFh,0ECh, 01h
        db 24h,0C1h, 7Fh,0FFh,0F4h, 30h, 00h, 00h, 00h, 00h, 00h,0A7h,0FFh,0FFh,0FCh, 01h
        db 42h, 28h, 05h,0BFh,0FBh, 80h, 00h, 00h, 00h, 00h, 04h, 1Bh,0FFh,0FFh,0FFh, 81h
        db 98h,0C1h, 4Ah, 53h,0ECh, 48h, 00h, 00h, 00h, 00h, 40h, 7Fh,0FFh,0FFh,0FFh,0E1h
        db 98h,0C1h, 4Ah, 53h,0ECh, 48h, 00h, 00h, 00h, 00h, 40h, 7Fh,0FFh,0FFh,0FFh,0E1h
        db 42h, 28h, 00h, 0Ch, 77h, 82h, 00h, 00h, 00h, 00h, 33h,0BFh,0FFh,0FFh,0FFh, 89h
        db 18h,0C1h, 4Ah, 51h, 9Bh, 74h, 00h, 00h, 00h, 00h, 04h,0FFh, 3Fh,0FFh,0DFh,0F1h
        db0C2h, 28h, 00h, 0Ch, 04h, 80h, 00h, 00h, 00h, 00h, 40h,0FEh, 1Fh,0F9h,0C3h,0F9h
        db 1Ah,0D6h,0B5h,0A1h, 6Bh, 75h, 80h, 00h, 00h, 00h, 8Fh,0FCh, 3Fh,0F2h, 0Fh, 1Fh
        db 1Ah,0D6h,0B5h,0A1h, 6Bh, 75h, 80h, 00h, 00h, 00h, 8Fh,0FCh, 3Fh,0F2h, 0Fh, 1Fh
        db0C5h, 29h, 79h, 8Ch, 00h, 88h, 00h, 00h, 00h, 00h, 03h,0F8h, 1Fh,0C8h, 52h, 81h
        db 22h,0FFh,0FFh,0F2h, 6Bh, 35h, 80h, 00h, 00h, 00h, 37h,0C2h, 3Fh,0FBh,0FCh, 09h
        db 9Ah,0FFh,0FFh,0FFh, 00h, 48h, 00h, 00h, 00h, 00h, 07h,0D8h, 1Fh,0FFh,0E3h, 81h
        db 9Ah,0FFh,0FFh,0FFh, 00h, 48h, 00h, 00h, 00h, 00h, 07h,0D8h, 1Fh,0FFh,0E3h, 81h
        db 47h,0FFh,0FFh,0FFh,0F3h, 35h, 80h, 00h, 00h, 00h, 8Fh,0C1h, 0Fh,0FFh,0ACh, 01h
        db0B9h,0FFh,0FFh,0FFh,0FCh, 4Ah, 20h, 00h, 00h, 00h, 0Fh,0A4h, 07h,0FEh, 40h, 01h
        db 5Fh,0FFh,0C7h,0FFh,0FCh,0B5h, 80h, 00h, 00h, 00h, 4Fh,0DAh,0FFh,0F8h, 00h, 01h
        db0A7h,0FFh,0B7h,0FFh,0FFh, 8Ah, 20h, 00h, 00h, 00h, 0Fh,0FFh,0EFh, 40h, 00h, 01h
        db0A7h,0FFh,0B7h,0FFh,0FFh, 8Ah, 20h, 00h, 00h, 00h, 0Fh,0FFh,0EFh, 40h, 00h, 01h
        db 7Fh,0FFh, 47h,0FDh, 7Fh,0C5h, 80h, 00h, 00h, 00h, 3Fh,0DAh,0D0h, 00h, 00h, 01h
        db0A7h,0FEh, 37h,0FFh, 7Ch,0FAh, 50h, 00h, 00h, 00h, 0Ch,0A4h, 08h, 00h, 00h, 01h
        db0DFh,0FEh, 43h,0FFh,0F8h,0C1h, 80h, 00h, 00h, 00h, 48h, 01h, 00h, 00h, 00h, 01h
        db 27h,0FFh, 4Bh,0FFh,0FFh,0FAh, 2Ch, 00h, 00h, 00h, 03h, 58h, 20h, 00h, 00h, 01h
        db 27h,0FFh, 4Bh,0FFh,0FFh,0FAh, 2Ch, 00h, 00h, 00h, 03h, 58h, 20h, 00h, 00h, 01h
        db 9Bh,0FFh,0C3h,0FFh,0FFh,0F1h,0C0h, 00h, 00h, 00h, 08h, 00h, 00h, 00h, 00h, 01h
        db 64h, 3Fh,0FDh,0FFh, 6Bh, 7Ch, 10h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 03h,0D7h,0FFh,0FDh, 10h, 01h,0A0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db0D8h, 29h, 4Fh,0A2h, 80h,0B5h, 90h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db0D8h, 29h, 4Fh,0A2h, 80h,0B5h, 90h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 05h, 10h,0B0h, 4Ch, 0Bh, 08h, 40h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db0A0h,0C9h, 0Ah, 00h, 00h, 42h, 10h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 04h, 10h, 40h, 21h, 64h, 09h,0A0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db0A2h,0C1h, 35h, 8Ch, 00h, 44h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db0A2h,0C1h, 35h, 8Ch, 00h, 44h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 00h, 16h, 00h, 21h, 14h, 09h,0A0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db0A5h, 00h,0B5h, 80h, 83h, 44h, 0Ch, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 00h, 26h, 00h, 12h, 08h, 09h,0A0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db0DAh, 00h,0B4h, 40h, 60h, 44h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db0DAh, 00h,0B4h, 40h, 60h, 44h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h,0C8h, 00h, 00h, 04h, 01h,0A0h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db0A2h, 20h, 89h, 91h, 10h, 8Ah, 10h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 44h, 06h, 00h, 00h, 00h, 30h, 40h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 44h, 06h, 00h, 00h, 00h, 30h, 40h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh
        ;*-------------------------------------------------------------------- *

        ;*-------------------------------------------------------------------- *
        ;* Bitmap点阵数据表 *
        ;* 图片: E:\图形13.bmp,横向取模左高位,数据排列:从左到右从上到下 *
        ;* 图片尺寸: 128 * 64 *
        ;*-------------------------------------------------------------------- *
        TU_TAB4: ; 漂亮姑娘看过来


        db 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 11h,0FFh, 80h, 40h, 08h, 30h, 10h, 20h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch, 68h, 3Fh,0FFh, 08h, 30h, 11h,0F8h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch, 68h, 3Fh,0FFh, 08h, 30h, 11h,0F8h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h,0FFh, 00h, 00h, 7Fh,0FEh, 7Dh, 08h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 11h, 6Bh, 07h,0FCh, 16h, 30h, 2Dh,0F8h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Dh,0FFh, 04h, 0Ch, 16h, 30h, 2Dh, 08h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch, 00h, 3Fh,0FFh, 16h, 30h, 2Dh,0F8h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch, 00h, 3Fh,0FFh, 16h, 30h, 2Dh,0F8h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch,0FFh, 30h, 01h, 66h,0FEh, 2Dh, 26h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 1Ch, 00h, 03h,0F0h, 76h, 82h, 2Dh, 28h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Dh,0FFh, 82h, 11h, 08h, 82h, 11h, 10h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch, 8Bh, 04h, 11h, 16h, 82h, 2Dh, 28h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Ch, 8Bh, 04h, 11h, 16h, 82h, 2Dh, 28h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 0Dh, 18h,0B8h, 1Fh, 60h,0FEh, 41h,0C6h, 00h
        db 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 00h, 07h, 8Fh,0FFh, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 00h, 08h, 70h, 40h,0EFh, 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 00h, 08h, 70h, 40h,0EFh, 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 00h, 10h, 00h, 80h, 10h, 60h, 00h, 0Fh,0FFh, 30h, 0Ch, 00h, 80h, 00h, 00h, 00h
        db 00h, 20h, 18h, 38h, 20h, 60h, 00h, 00h, 60h, 08h, 0Ch, 1Fh,0FCh, 1Ch, 00h, 00h
        db 00h,0C0h, 64h, 45h, 00h, 60h, 00h, 03h,0FCh, 0Bh,0FFh, 00h, 80h, 3Eh, 00h, 00h
        db 00h,0C1h, 00h, 01h, 00h, 10h, 00h, 00h, 80h, 00h, 0Ch, 08h, 88h, 3Eh, 00h, 00h
        db 00h,0C1h, 00h, 01h, 00h, 10h, 00h, 00h, 80h, 00h, 0Ch, 08h, 88h, 3Eh, 00h, 00h
        db 01h, 01h, 00h, 00h,0C0h, 10h, 00h, 1Fh,0FFh,0BDh, 8Ch, 06h,0B0h, 3Eh, 00h, 00h
        db 02h, 0Eh, 18h, 1Ch,0C0h, 10h, 00h, 01h, 00h, 04h, 4Ch, 7Fh,0FEh, 1Ch, 00h, 00h
        db 02h, 16h, 64h, 22h, 20h, 10h, 00h, 03h,0FCh, 04h, 4Ch, 01h,0C0h, 1Ch, 00h, 00h
        db 02h, 16h, 64h, 22h, 20h, 10h, 00h, 03h,0FCh, 04h, 4Ch, 01h,0C0h, 1Ch, 00h, 00h
        db 04h,0E8h, 83h, 41h, 1Ch, 08h, 00h, 0Dh, 04h, 04h, 0Ch, 06h,0B0h, 00h, 00h, 00h
        db 07h, 10h, 8Fh, 47h, 03h, 88h, 00h, 11h,0FCh, 04h, 3Ch, 08h, 88h, 1Ch, 00h, 00h
        db 00h, 20h, 6Ch, 26h, 01h, 78h, 00h, 01h, 04h, 0Ah, 00h, 70h, 86h, 1Ch, 00h, 00h
        db 00h,0C0h, 18h, 1Ch, 00h, 80h, 00h, 01h,0FCh, 31h,0FFh, 00h, 80h, 00h, 00h, 00h
        db 00h,0C0h, 18h, 1Ch, 00h, 80h, 00h, 01h,0FCh, 31h,0FFh, 00h, 80h, 00h, 00h, 00h
        db 00h,0C1h, 87h, 80h, 00h, 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 01h, 06h, 78h, 3Ch, 20h, 60h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 01h, 08h, 07h,0C2h,0C0h, 60h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 01h, 08h, 00h, 01h,0C0h, 60h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 01h, 08h, 00h, 01h,0C0h, 60h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 01h, 08h, 18h, 01h,0C0h, 60h, 00h, 00h, 00h,0F1h,0F3h, 87h,0C0h, 00h, 00h, 00h
        db 00h,0C6h, 18h,0C2h, 20h, 80h, 00h, 00h, 03h, 0Eh, 1Ch, 78h, 70h, 00h, 00h, 00h
        db 00h,0C1h, 00h,0C2h, 00h, 80h, 00h, 00h, 04h, 44h, 11h, 10h, 38h, 00h, 00h, 00h
        db 00h, 26h,0E0h, 04h, 01h, 00h, 00h, 00h, 04h, 80h, 12h, 00h, 38h, 00h, 00h, 00h
        db 00h, 26h,0E0h, 04h, 01h, 00h, 00h, 00h, 04h, 80h, 12h, 00h, 38h, 00h, 00h, 00h
        db 00h, 11h, 18h, 38h, 03h, 00h, 00h, 00h, 04h, 80h, 12h, 00h, 38h, 00h, 00h, 00h
        db 00h, 0Eh, 87h,0C2h, 1Ch, 00h, 00h, 00h, 04h, 00h, 10h, 00h, 38h, 00h, 00h, 00h
        db 00h, 01h,0E0h, 04h,0E0h, 00h, 00h, 00h, 03h, 00h, 1Ch, 00h, 70h, 00h, 00h, 00h
        db 00h, 1Eh, 18h, 3Fh, 1Eh, 00h, 00h, 00h, 00h, 80h, 32h, 00h,0C0h, 00h, 00h, 00h
        db 00h, 1Eh, 18h, 3Fh, 1Eh, 00h, 00h, 00h, 00h, 80h, 32h, 00h,0C0h, 00h, 00h, 00h
        db 00h, 38h, 07h,0C0h, 0Fh, 00h, 00h, 00h, 00h, 40h, 61h, 01h, 80h, 00h, 00h, 00h
        db 00h,0E9h,0FFh,0FFh, 0Dh, 80h, 00h, 00h, 00h, 31h,0C0h, 87h, 00h, 00h, 00h, 00h
        db 01h,0E9h, 1Bh,0B9h, 0Dh,0E0h, 00h, 00h, 00h, 0Bh, 80h, 6Eh, 00h, 00h, 00h, 00h
        db 03h,0C9h,0F0h, 1Fh, 0Ch,0F0h, 00h, 00h, 00h, 06h, 00h, 18h, 00h, 00h, 00h, 00h
        db 03h,0C9h,0F0h, 1Fh, 0Ch,0F0h, 00h, 00h, 00h, 06h, 00h, 18h, 00h, 00h, 00h, 00h
        db 07h, 06h,0E0h, 06h, 10h, 78h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 07h,0C1h, 00h, 00h, 20h,0F8h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 07h,0E0h, 80h, 00h,0C1h,0F8h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 07h,0E0h, 80h, 00h,0C1h,0F8h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
        db 80h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
        db0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh


        end

        概述

           带中文字库的128X64是一种具有4/8位并行、2线或3线串行多种接口方式,内部含有国标一级、二级简体中文字库的点阵图形液晶显示模块;其显示分辨率为128×64, 内置8192个16*16点汉字,和128个16*8点ASCII字符集.利用该模块灵活的接口方式和简单、方便的操作指令,可构成全中文人机交互图形界面。可以显示8×4行16×16点阵的汉字. 也可完成图形显示.低电压低功耗是其又一显著特点。由该模块构成的液晶显示方案与同类型的图形点阵液晶显示模块相比,不论硬件电路结构或显示程序都要简洁得多,且该模块的价格也略低于相同点阵的图形液晶模块。

        基本特性:

        l         低电源电压(VDD:+3.0--+5.5V)

        l         显示分辨率:128×64点

        l         内置汉字字库,提供8192个16×16点阵汉字(简繁体可选)

        l         内置 128个16×8点阵字符

        l         2MHZ时钟频率

        l         显示方式:STN、半透、正显

        l         驱动方式:1/32DUTY,1/5BIAS

        l         视角方向:6点

        l         背光方式:侧部高亮白色LED,功耗仅为普通LED的1/5—1/10

        l         通讯方式:串行、并口可选

        l         内置DC-DC转换电路,无需外加负压

        l         无需片选信号,简化软件设计

        l         工作温度: 0℃ - +55℃ ,存储温度: -20℃ - +60℃ 

        模块接口说明


        *注释1:如在实际应用中仅使用串口通讯模式,可将PSB接固定低电平,也可以将模块上的J8和“GND”用焊锡短接。

        *注释2:模块内部接有上电复位电路,因此在不需要经常复位的场合可将该端悬空。

        *注释3:如背光和模块共用一个电源,可以将模块上的JA、JK用焊锡短接。

        2.2并行接口

        管脚号

        管脚名称

        电平

        管脚功能描述

        1

        VSS

        0V

        电源地

        2

        VCC

        3.0+5V

        电源正

        3

        V0

        -

        对比度(亮度)调整

        4

        RS(CS)

        H/L

        RS=“H”,表示DB7——DB0为显示数据

        RS=“L”,表示DB7——DB0为显示指令数据

        5

        R/W(SID)

        H/L

        R/W=“H”,E=“H”,数据被读到DB7——DB0

        R/W=“L”,E=“H→L”, DB7——DB0的数据被写到IR或DR

        6

        E(SCLK)

        H/L

        使能信号

        7

        DB0

        H/L

        三态数据线

        8

        DB1

        H/L

        三态数据线

        9

        DB2

        H/L

        三态数据线

        10

        DB3

        H/L

        三态数据线

        11

        DB4

        H/L

        三态数据线

        12

        DB5

        H/L

        三态数据线

        13

        DB6

        H/L

        三态数据线

        14

        DB7

        H/L

        三态数据线

        15

        PSB

        H/L

        H:8位或4位并口方式,L:串口方式(见注释1)

        16

        NC

        -

        空脚

        17

        /RESET

        H/L

        复位端,低电平有效(见注释2)

        18

        VOUT

        -

        LCD驱动电压输出端

        19

        A

        VDD

        背光源正端(+5V)(见注释3)

        20

        K

        VSS

        背光源负端(见注释3)

        *注释1:如在实际应用中仅使用并口通讯模式,可将PSB接固定高电平,也可以将模块上的J8和“VCC”用焊锡短接。

        *注释2:模块内部接有上电复位电路,因此在不需要经常复位的场合可将该端悬空。   

        *注释3:如背光和模块共用一个电源,可以将模块上的JA、JK用焊锡短接。

        模块主要硬件构成说明

        控制器接口信号说明:

        1、RS,R/W的配合选择决定控制界面的4种模式:

        RS

        R/W

        功能说明

        L

        L

        MPU写指令到指令暂存器(IR)

        L

        H

        读出忙标志(BF)及地址记数器(AC)的状态

        H

        L

        MPU写入数据到数据暂存器(DR)

        H

        H

        MPU从数据暂存器(DR)中读出数据

        2、E信号

        E状态

        执行动作

        结果

        高——>低

        I/O缓冲——>DR

        配合/W进行写数据或指令

        DR——>I/O缓冲

        配合R进行读数据或指令

        /低——>高

        无动作

        ● 忙标志:BF BF标志提供内部工作情况.BF=1表示模块在进行内部操作,此时模块不接受外部指令和数据.BF=0时,模块为准备状态,随时可接受外部指令和数据.     利用STATUS RD 指令,可以将BF读到DB7总线,从而检验模块之工作状态.● 字型产生ROM(CGROM) 字型产生ROM(CGROM)提供8192个此触发器是用于模块屏幕显示开和关的控制。DFF=1为开显示(DISPLAY ON),DDRAM 的内容就显示在屏幕上,DFF=0为关显示(DISPLAY OFF)。    DFF 的状态是指令DISPLAY ON/OFF和RST信号控制的。 显示数据RAM(DDRAM)模块内部显示数据RAM提供64×2个位元组的空间,最多可控制4行16字(64个字)的中文字型显示,当写入显示数据RAM时,可分别显示CGROM与CGRAM的字型;此模块可显示三种字型,分别是半角英数字型(16*8)、CGRAM字型及CGROM的中文字型,三种字型的选择,由在DDRAM中写入的编码选择,在0000H—0006H的编码中(其代码分别是0000、0002、0004、0006共4个)将选择CGRAM的自定义字型,02H—7FH的编码中将选择半角英数字的字型,至于A1以上的编码将自动的结合下一个位元组,组成两个位元组的编码形成中文字型的编码BIG5(A140—D75F),GB(A1A0-F7FFH)。● 字型产生RAM(CGRAM)  字型产生RAM提供图象定义(造字)功能, 可以提供四组16×16点的自定义图象空间,使用者可以将内部字型没有提供的图象字型自行定义到CGRAM中,便可和CGROM中的定义一样地通过DDRAM显示在屏幕中。● 地址计数器AC地址计数器是用来贮存DDRAM/CGRAM之一的地址,它可由设定指令暂存器来改变,之后只要读取或是写入DDRAM/CGRAM的值时,地址计数器的值就会自动加一,当RS为“0”时而R/W为“1”时,地址计数器的值会被读取到DB6——DB0中。 光标/闪烁控制电路   此模块提供硬体光标及闪烁控制电路,由地址计数器的值来指定DDRAM中的光标或闪烁位置。

        指令说明

          模块控制芯片提供两套控制命令,基本指令和扩充指令如下:

        指令表1:(RE=0:基本指令)

                          指 令 码

        功 能

        RS

        R/W

        D7

        D6

        D5

        D4

        D3

        D2

        D1

        D0

        清除

        显示

        0

        0

        0

        0

        0

        0

        0

        0

        0

        1

        DDRAM填满"20H",并且设定DDRAM的地址计数器(AC)到"00H"

        地址

        归位

        0

        0

        0

        0

        0

        0

        0

        0

        1

        X

        设定DDRAM的地址计数器(AC)到"00H",并且将游标移到开头原点位置;这个指令不改变DDRAM 的内容

        显示状态开/关

        0

        0

        0

        0

        0

        0

        1

        D

        C

        B

        D=1: 整体显示 ON

        C=1: 游标ON    

        B=1:游标位置反白允许

        进入点

        设定

        0

        0

        0

        0

        0

        0

        0

        1

        I/D

        S

        指定在数据的读取与写入时,设定游标的移动方向及指定显示的移位

        游标或显示移位控制

        0

        0

        0

        0

        0

        1

        S/C

        R/L

        X

        X

        设定游标的移动与显示的移位控制位;这个指令不改变DDRAM 的内容

         功能

         设定

        0

        0

        0

        0

        1

        DL

        X

        RE

        X

        X

        DL=0/1:4/8位数据

        RE=1: 扩充指令操作

        RE=0: 基本指令操作

         设定CGRAM

         地址

        0

        0

        0

        1

        AC5

        AC4

        AC3

        AC2

        AC1

        AC0

        设定CGRAM 地址

         设定DDRAM

         地址

        0

        0

        1

        0

        AC5

        AC4

        AC3

        AC2

        AC1

        AC0

        设定DDRAM 地址(显示位址)

        第一行:80H-87H

        第二行:90H-97H

        读取忙标志和地址

        0

        1

        BF

        AC6

        AC5

        AC4

        AC3

        AC2

        AC1

        AC0

        读取忙标志(BF)可以确认内部动作是否完成,同时可以读出地址计数器(AC)的值

        写数据到RAM

        1

        0

        数据

        将数据D7——D0写入到内部的RAM (DDRAM/CGRAM/IRAM/GRAM)

        读出RAM的值

        1

        1

        数据

        从内部RAM读取数据D7——D0

        (DDRAM/CGRAM/IRAM/GRAM)

        指令表2:(RE=1:扩充指令)

                          指 令 码

        功 能

        RS

        R/W

        D7

        D6

        D5

        D4

        D3

        D2

        D1

        D0

          待命

        模式

        0

        0

        0

        0

        0

        0

        0

        0

        0

        1

        进入待命模式,执行其他指令都棵终止

        待命模式

        卷动地址开关开启

        0

        0

        0

        0

        0

        0

        0

        0

        1

        SR

        SR=1:允许输入垂直卷动地址

        SR=0:允许输入IRAM和CGRAM地址

          反白

          选择

        0

        0

        0

        0

        0

        0

        0

        1

        R1

        R0

        选择2行中的任一行作反白显示,并可决定反白与否。初始值R1R0=00,第一次设定为反白显示,再次设定变回正常

          睡眠

          模式

        0

        0

        0

        0

        0

        0

        1

        SL

        X

        X

        SL=0:进入睡眠模式

        SL=1:脱离睡眠模式

          扩充

          功能

          设定

        0

        0

        0

        0

        1

        CL

        X

        RE

        G

        0

        CL=0/1:4/8位数据

        RE=1: 扩充指令操作

        RE=0: 基本指令操作

        G=1/0:绘图开关

         设定绘图RAM

         地址

        0

        0

        1

        0

        AC6

        0

        AC5

        0

        AC4

        AC3

        AC3

        AC2

        AC2

        AC1

        AC1

        AC0

        AC0

        设定绘图RAM

        先设定垂直(列)地址AC6AC5…AC0

        再设定水平(行)地址AC3AC2AC1AC0

        将以上16位地址连续写入即可

        备注;当IC1在接受指令前,微处理器必须先确认其内部处于非忙碌状态,即读取BF标志时,BF需为零,方可接受新的指令;如果在送出一个指令前并不检查BF标志,那么在前一个指令和这个指令中间必须延长一段较长的时间,即是等待前一个指令确实执行完成。

        应用举例:

        1 、使用前的准备

           先给模块加上工作电压,再按照下图的连接方法调节LCD的对比度,使其显示出黑色的底影。

           此过程亦可以初步检测LCD有无缺段现象。

        2、字符显示

        带中文字库的128X64-0402B每屏可显示4行8列共32个16×16点阵的汉字,每个显示RAM可显示1个中

        文字符或2个16×8点阵全高ASCII码字符,即每屏最多可实现32个中文字符或64个ASCII码字符的显示。带中文字库的128X64-0402B内部提供128×2字节的字符显示RAM缓冲区(DDRAM)。字符显示是通过将字符显示编码写入该字符显示RAM实现的。根据写入内容的不同,可分别在液晶屏上显示CGROM(中文字库)、HCGROM(ASCII码字库)及CGRAM(自定义字形)的内容。三种不同字符/字型的选择编码范围为:0000~0006H(其代码分别是0000、0002、0004、0006共4个)显示自定义字型,02H~7FH显示半宽ASCII码字符,A1A0H~F7FFH显示8192种GB2312中文字库字形。字符显示RAM在液晶模块中的地址80H~9FH。字符显示的RAM的地址与32个字符显示区域有着一一对应的关系,其对应关系如下表所示。

        80H

        81H

        82H

        83H

        84H

        85H

        86H

        87H

        90H

        91H

        92H

        93H

        94H

        95H

        96H

        97H

        88H

        89H

        8AH

        8BH

        8CH

        8DH

        8EH

        8FH

        98H

        99H

        9AH

        9BH

        9CH

        9DH

        9EH

        9FH

        3 、图形显示  

        先设垂直地址再设水平地址(连续写入两个字节的资料来完成垂直与水平的坐标地址)

        垂直地址范围 AC5...AC0

        水平地址范围 AC3…AC0

        绘图RAM 的地址计数器(AC)只会对水平地址(X )自动加一,当水平地址=0FH 时会重新设为00H 但并不会对垂直地址做进位自动加一,故当连续写入多笔资料时,程序需自行判断垂直地址是否需重新设定。GDRAM的坐标地址与资料排列顺序如下图:

        3、应用说明

        带中文字库的128X64显示模块时应注意以下几点:

        ①欲在某一个位置显示中文字符时,应先设定显示字符位置,即先设定显示地址,再写入中文字符编码。

        ②显示ASCII字符过程与显示中文字符过程相同。不过在显示连续字符时,只须设定一次显示地址,由模块自动对地址加1指向下一个字符位置,否则,显示的字符中将会有一个空ASCII字符位置。

        ③当字符编码为2字节时,应先写入高位字节,再写入低位字节。

        模块在接收指令前,向处理器必须先确认模块内部处于非忙状态,即读取BF标志时BF需为“0”,方可接受新的指令。如果在送出一个指令前不检查BF标志,则在前一个指令和这个指令中间必须延迟一段较长的时间,即等待前一个指令确定执行完成。指令执行的时间请参考指令表中的指令执行时间说明。⑤“RE”为基本指令集与扩充指令集的选择控制位。当变更“RE”后,以后的指令集将维持在最后的状态,除非再次变更“RE”位,否则使用相同指令集时,无需每次均重设“RE”位。