本文目录
一、参数介绍
二、模块接口说明
三、控制器接口信号说明
四、带字库汉字显示演示
五、汉字显示程序
六、图象显示程序
七、显示电压电流程序
八、绘图功能
九、显示程序(串口)
十、显示C程序
十一、显示驱功程序
十二、显示源程序
概述:12864具有带中文字库的128X64是一种具有4位/8位并行、2线或3线串行多种接口方式,内部含有国标一级、二级简体中文字库的点阵图形液晶显示模块;其显示分辨率为128×64, 内置8192个16*16点汉字,和128个16*8点ASCII字符集.利用该模块灵活的接口方式和简单、方便的操作指令,可构成全中文人机交互图形界面。可以显示8×4行16×16点阵的汉字. 也可完成图形显示.低电压低功耗是其又一显著特点。由该模块构成的液晶显示方案与同类型的图形点阵液晶显示模块相比,不论硬件电路结构或显示程序都要简洁得多,且该模块的价格也略低于相同点阵的图形液晶模块。
一、参数介绍
1.基本特点
低电源电压(VDD:+3.0--+5.5V)
显示分辨率:128×64点
内置汉字字库,提供8192个16×16点阵汉字(简繁体可选)
内置 128个16×8点阵字符
2MHz时钟频率
显示方式:STN、半透、正显
驱动方式:1/32DUTY,1/5BIAS
视角方向:6点
背光方式:侧部高亮白色LED,功耗仅为普通LED的1/5—1/10
通讯方式:串行、并口可选
内置DC-DC转换电路,无需外加负压
无需片选信号,简化软件设计
工作温度: 0℃ - +55℃ ,存储温度: -20℃ - +60℃
2.效果图
3.12864液晶屏接线原理
二、模块接口说明
*注释1:如在实际应用中仅使用串口通讯模式,可将PSB接固定低电平,也可以将模块上的J8和“GND”用焊锡短接。
*注释2:模块内部接有上电复位电路,因此在不需要经常复位的场合可将该端悬空。
*注释3:如背光和模块共用一个电源,可以将模块上的JA、JK用焊锡短接。
并行接口
*注释1:如在实际应用中仅使用并口通讯模式,可将PSB接固定高电平,也可以将模块上的J8和“VCC”用焊锡短接。
*注释2:模块内部接有上电复位电路,因此在不需要经常复位的场合可将该端悬空。
*注释3:如背光和模块共用一个电源,可以将模块上的JA、JK用焊锡短接。
三、控制器接口信号说明
1、RS,R/W的配合选择决定控制界面的4种模式:
● 忙标志: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中的光标或闪烁位置
四、带字库汉字显示演示程序
;12864(带字库汉字显示演示程序)
;***************************************************************************
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 [Page]
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.xxxxxxx.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 [Page]
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 [Page]
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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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
db 0FFh,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
db 0A4h, 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
db 0B9h, 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
db 0FFh,0F9h, 04h, 01h, 00h, 00h, 00h, 00h, 01h, 16h,0B4h,0A0h, 00h, 00h, 00h, 01h
db 0FFh,0FFh,0F2h, 50h, 00h, 40h, 00h, 00h, 00h, 29h, 4Bh, 00h, 00h, 00h, 00h, 01h
db 0FFh,0FFh,0F2h, 50h, 00h, 40h, 00h, 00h, 00h, 29h, 4Bh, 00h, 00h, 00h, 00h, 01h
db 0FFh,0FFh,0BDh, 82h, 94h, 00h, 40h, 00h, 00h,0C9h, 30h, 02h, 00h, 00h, 00h, 01h
db 0FFh,0FFh,0FBh,0B0h, 00h, 08h, 00h, 00h, 05h, 16h, 44h, 40h, 00h, 00h, 00h, 01h
db 0FFh,0FFh,0FFh,0EFh, 90h, 40h, 00h, 00h, 00h, 21h, 00h, 04h,0C8h, 30h, 00h, 01h
db 0A5h,0FFh,0FFh,0FDh, 6Bh, 00h, 00h, 00h, 00h,0C8h, 00h, 99h, 16h,0FAh, 40h, 01h
db 0A5h,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 [Page]
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
db 0C2h, 28h, 00h, 0Ch, 04h, 80h, 00h, 00h, 00h, 00h, 40h,0FEh, 1Fh,0F9h,0C3h,0F9h
db 1Ah,0D6h,0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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
db 0D8h, 29h, 4Fh,0A2h, 80h,0B5h, 90h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
db 0D8h, 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
db 0A0h,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
db 0A2h,0C1h, 35h, 8Ch, 00h, 44h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
db 0A2h,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
db 0A5h, 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
db 0DAh, 00h,0B4h, 40h, 60h, 44h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 01h
db 0DAh, 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
db 0A2h, 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 [Page]
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 0FFh,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 [Page]
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
db 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh
end
五、汉字显示程序
硬件连接方式是:并口直接访问
#include<reg51.h>
#include<absaCC.h>
#define uchar unsigned char
#define datawr 0x1200 //写数据通道
#define comwr 0x1000 //写控制命令通道
#define datare 0x1300 //读数据通道
#define comre 0x1100 //读忙通道
uchar code disp_data[]={" 浙江大学 " //第一行,第一页
"04级通信工程一班" //第三行
" 宁波理工学院 " //第二行
" 竞赛小组 " //第四行
"128X64液晶显示器" //第一行,第二页
" 测试程序 " //第三行[Page]
" 07年07月25日 " //第二行
" Tornado "}; //第四行
void set12864();
void write_command(uchar command);
void write_page(uchar data_add);
void read_page(uchar data_add);
void delays(uchar cont);
void main()
{
while(1)
{
set12864(); //初始化12864
write_page(0); //写入一页数据
read_page(0x30); //读出一页数据到内部RAM
delays(2); //延时2s
write_page(64); //写入下一页数据
delays(2); //延时2s
}
}
//初始化12864子程序
void set12864()
{
write_command(0x30); //功能设定控制字
write_command(0x0c); //显示开关控制字
write_command(0x01); //清除屏幕控制字
write_command(0x06); //进入设定点控制字
}
//写控制命令子程序
void write_command(uchar command)
{
bit flag=1; //12864空闲标志位
while(flag) //检查12864是否空闲
flag="XBYTE"[comre]&0x80;
XBYTE[comwr]=command; //空闲传送控制字
}
//写一页子程序
void write_page(uchar data_add)
{
bit flag=1; //12864空闲标志位
uchar num=64; //64个循环,连续写入32个汉字或是64个西文字符
write_command(0x80);
for(;num>0;num--)
{
while(flag) //检查12864是否空闲
flag="XBYTE"[comre]&0x80;
XBYTE[datawr]=disp_data[data_add++]; //空闲传送数据
}
}
//读一页子程序
void read_page(uchar data_add)
{
bit flag=1; //12864空闲标志位
uchar num=64; //64个循环,连续写入32个汉字或是64个西文字符
write_command(0x80);
for(;num>0;num--)
{
while(flag) //检查12864是否空闲
flag="XBYTE"[comre]&0x80;
DBYTE[data_add++]=XBYTE[datare]; //空闲传送数据
}
}
//延时cont秒子程序
void delays(uchar count)
{
unsigned char h,i,j,k;
do
{
for(h=5;h>0;h--)
for(i=4;i>0;i--)
for(j=116;j>0;j--)
for(k=214;k>0;k--);
}while(--count);
}
六、图象显示程序
#include<reg51.h>
#include<absaCC.h>
#define uchar unsigned char
#define uint unsigned int
#define datawr 0x1200 //写数据通道
#define comwr 0x1000 //写控制命令通道
#define datare 0x1300 //读数据通道
#define comre 0x1100 //读忙通道
uchar code disp_data[] = // 数据表
{
0x00,0x01,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,
0x00,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,
0x00,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,
0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,
0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,
0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF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0xA0,0x03,0xFC,0x00,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x05,0xC0,0x03,0xC8,0x00,0x7F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x19,0x00,0x00,0x88,0x0C,0x07,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFC,0x00,0x0C,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0xC0,0x7F,0xFF,0xFF,
0xFF,0xFF,0xF8,0x07,0x0F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x0F,0xFF,0xFE,
0xFF,0xFF,0xD0,0x07,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x03,0xFF,0xF8,
0xFF,0xFC,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xC0,
0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0xFF,0xF8,
0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x1F,0xFE,
0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x78,0x02,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x03,0xF0,0x78,0x00,0x00,0x00,0x00,0x00,0x02,0xFF,
0xFE,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,
0xF0,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,
0xE0,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,
0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,
0xC0,0x00,0x00,0x00,0x00,0x00,0x01,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,
0x80,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01
};
void set12864();
void setxy(uchar x,uchar y);
void write_command(uchar command);
void write_16byte(uint data_add);
void delays(uchar count);[Page]
void main()
{
uchar x,y,i;
while(1)
{
y="0x80"; //设置液晶上半部分坐标
x="0x80";
delays(2); //延时2s
set12864(); //初始化12864
delays(2);
for(i=0;i<32;i++) //写入液晶上半图象部分
{ //写入坐标
setxy(x,y);
write_16byte(i*16); //连续写入16字节数据
y++; //y轴地址加1
}
y="0x80"; //设置液晶下半部分坐标
x="0x88";
for(i=0;i<32;i++) //写入液晶下半图象部分
{
setxy(x,y); //写入坐标
write_16byte((32+i)*16);//连续写入16字节数据
y++; //y轴地址加1
}
write_command(0x34); //写入扩充指令命令
write_command(0x36); //显示图象
}
}
//初始化12864子程序
void set12864()
{
write_command(0x30); //功能设定控制字
write_command(0x0c); //显示开关控制字
write_command(0x01); //清除屏幕控制字
write_command(0x06); //进入设定点控制字
}
//设置绘图坐标
void setxy(uchar x,uchar y)
{
write_command(0x34); //写入扩充指令命令
write_command(y); //写入y轴坐标
write_command(x); //写入x轴坐标
write_command(0x30); //写入基本指令命令
}
//写控制命令子程序
void writ
网友评论