51单片机实现的多图显示用12864液晶驱动程序方案设计书.docx
《51单片机实现的多图显示用12864液晶驱动程序方案设计书.docx》由会员分享,可在线阅读,更多相关《51单片机实现的多图显示用12864液晶驱动程序方案设计书.docx(68页珍藏版)》请在冰豆网上搜索。
51单片机实现的多图显示用12864液晶驱动程序方案设计书
封面
作者:
PanHongliang
仅供个人学习
51单片机实现的多图显示用12864液晶驱动程序设计
作者:
佚名 日期:
2010年06月02日 来源:
不详 【字体:
大中小】 我要评论(0)
核心提示:
/************************************************程序名称:
12864液晶驱动程序(显示多图)简要说明:
控制器:
KS0107LCD型号:
FM12864、TS12864A-2或兼容型号(不带字库)&nbs
/************************************************
程序名称:
12864液晶驱动程序(显示多图)
简要说明:
控制器:
KS0107
LCD型号:
FM12864、TS12864A-2或兼容型号(不带字库)
MCU:
AT89S5*,晶体频率:
11.0592MHz
取模方式:
纵向取模、字节倒序
CS1和CS2为高电平有效
************************************************/
;***************硬件端口定义***********
RSEQUP2.0
RWEQUP2.1
EEQUP2.2
CS1EQUP2.3
CS2EQUP2.4
RSTEQUP2.5
COMEQU20H;指令数据寄存器
DATEQU21H;显示数据寄存器
;**********************************主程序入口地址
ORG0000H
AJMPSTR
ORG0003H
;*********************************中断程序入口地址
STR:
AJMPL0100
L0100:
CLRRST
NOP
NOP
SETBRST
;********************************以上是软件复位
MOVSP,#60H
MOVIE,#81H;中断允许
MOVIP,#01H;优先中断
MOVTCON,#00H;电平中断
MOVCOM,#3FH;显示开
LCALLS02A9;左半屏写指令子程序
LCALLS02C1;右半屏写指令子程序
;----------------------------------------------------------------------
MOVCOM,#0C0H;第一行
LCALLS02A9;左半屏写指令子程序
LCALLS02C1;右半屏写指令子程序
;----------------------------------------------------------------------
MOVCOM,#0B8H;第一页
LCALLS02A9;左半屏写指令子程序
LCALLS02C1;右半屏写指令子程序
;----------------------------------------------------------------------
MOVCOM,#40H;第一列
LCALLS02A9;左半屏写指令子程序
LCALLS02C1;右半屏写指令子程序
;********************************************************以上是软件初始化
MOVB,#0AAH
LCALLXIHX;显示横线1
LCALLDELAY
;MOVB,#55H
;LCALLXIHX
;LCALLDELAY;显示横线2
MOVB,#0FFH
MOV29H,#00H
LCALLXISX
LCALLDELAY;显示竖线1
;MOVB,#00H
;MOV29H,#0FFH
;LCALLXISX
;LCALLDELAY;显示竖线2
MOVDPTR,#TAB1
LCALLLEFT
MOVDPTR,#TAB2
LCALLRIGHT
LCALLDELAY;显示第一幅图片
MOVDPTR,#TAB3
LCALLLEFT
MOVDPTR,#TAB4
LCALLRIGHT
LCALLDELAY;显示第二幅图片
MOVDPTR,#TAB5
LCALLLEFT
MOVDPTR,#TAB6
LCALLRIGHT
LCALLDELAY;显示第三幅图片
AJMPL0100
;=======================================================以上是主程序
LEFT:
MOVR1,#0B8H
_AB:
MOVCOM,R1;第一页
LCALLS02A9;左半屏写指令子程序
MOVCOM,#40H;第一列
LCALLS02A9;左半屏写指令子程序
MOVR0,#64
S027B:
MOVA,#00H
MOVCA,@A+DPTR
MOVDAT,A
LCALLS02B1;左半屏写数据子程序
INCDPTR
DJNZR0,S027B
INCR1
CJNER1,#0C0H,_AB
RET
;======================================================以上是左半屏写数据子程序
RIGHT:
MOVR1,#0B8H
ABC:
MOVCOM,R1;第一页
LCALLS02C1;右半屏写指令子程序
MOVCOM,#40H;第一列
LCALLS02C1;右半屏写指令子程序
MOVR0,#64
S027D:
MOVA,#00H
MOVCA,@A+DPTR
MOVDAT,A
LCALLS02B9;右半屏写数据子程序
INCDPTR
DJNZR0,S027D
INCR1
CJNER1,#0C0H,ABC
RET
;*******************************************************以上是右半屏写数据子程序
XIHX:
MOVR1,#0B8H
BA:
MOVCOM,R1;第一页
LCALLS02A9;左半屏写指令子程序
LCALLS02C1;右半屏写指令子程序
MOVCOM,#40H;第一列
LCALLS02A9;左半屏写指令子程序
LCALLS02C1;右半屏写指令子程序
MOVR0,#64
W027B:
MOVDAT,B
LCALLS02B1;左半屏写数据子程序
LCALLS02B9;右半屏写数据子程序
DJNZR0,W027B
INCR1
CJNER1,#0C0H,BA
RET
;---------------------------------------------------------
XISX:
MOVR1,#0B8H
CA:
MOVCOM,R1;第一页
LCALLS02A9;左半屏写指令子程序
LCALLS02C1;右半屏写指令子程序
MOVCOM,#40H;第一列
LCALLS02A9;左半屏写指令子程序
LCALLS02C1;右半屏写指令子程序
MOVR0,#32
X027B:
MOVDAT,B
LCALLS02B1;左半屏写数据子程序
LCALLS02B9;右半屏写数据子程序
MOVDAT,29H
LCALLS02B1;左半屏写数据子程序
LCALLS02B9;右半屏写数据子程序
DJNZR0,X027B
INCR1
CJNER1,#0C0H,CA
RET
;****************************************************以上是显示线条程序
S02A9:
SETBCS1
LCALLS02C9
CLRCS1;左半屏写指令子程序
RET
S02B1:
SETBCS1;左半屏写数据子程序
LCALLS02E0
CLRCS1
RET
S02C1:
SETBCS2;右半屏写指令子程序
LCALLS02C9
CLRCS2
RET
S02B9:
SETBCS2;右半屏写数据子程序
LCALLS02E0
CLRCS2
RET
;****************************************************
S02C9:
CLRRS
SETBRW
S02C9A:
MOVP0,#0FFH
SETBE
MOVA,P0
CLRE
JBACC.7,S02C9A
CLRRW
MOVP0,COM
SETBE
NOP
CLRE
RET
;*************************************************以上是写指令子程序
S02E0:
CLRRS
SETBRW
S02E0A:
MOVP0,#0FFH
SETBE
MOVA,P0
CLRE
JBACC.7,S02E0A
SETBRS
CLRRW
MOVP0,DAT
SETBE
NOP
CLRE
RET
;************************************************以上是写数据子程序
DELAY:
MOVR5,#0BH;延时
D1:
MOVR7,#0FFH
D2:
MOVR6,#0FFH
D3:
DJNZR6,$
DJNZR7,D2
DJNZR5,D1
RET
;****************************************************************
TAB1:
;--调入了一幅图像:
C\128x64-1.bmp--
;--宽度x高度=64x64--
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,080H,080H,0C0H,0C0H
DB0E0H,0E0H,0E0H,0F0H,0F0H,0F0H,0F0H,0F0H,0F8H,0F8H,0F8H,0F8H,0F8H,0F8H,0F8H,0F8H
DB0FCH,0FCH,0FCH,0FCH,0FCH,0FCH,0FCH,0FCH,0FCH,0FCH,07CH,078H,078H,038H,038H,030H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,0E0H,0F0H,0FCH,0FEH,0FFH,0FFH,0FFH,0FFH,0FFH
DB0FFH,0FFH,0FFH,0FFH,0EFH,0CFH,0E7H,0E7H,0E7H,0F3H,073H,033H,03BH,019H,00DH,08DH
DB0CDH,0E7H,0F6H,0FEH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,07FH,03EH,01CH,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,0E0H,0E0H,0F0H,0F0H,0F0H,0F8H,0F9H,0FDH,0FDH,0FDH,0DFH,09FH,08EH,08FH,08FH
DB08FH,00FH,00FH,00FH,00FH,00FH,007H,003H,001H,060H,060H,06CH,06CH,06EH,06FH,067H
DB067H,0E7H,0F7H,0F7H,0F3H,0F3H,0F3H,0F3H,0F9H,0F9H,0F8H,0F8H,0FCH,0FCH,0FEH,0FEH
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,001H,00FH,07FH,0FFH,0FFH,0FFH,0FFH,0FFH,07FH,01FH,00FH,007H,003H,003H,001H
DB081H,0E0H,0F0H,0F8H,0FCH,0FEH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FEH,0FEH,0FEH,0FEH
DB0FEH,0FCH,0FCH,0FCH,0F8H,0F0H,061H,001H,001H,003H,003H,007H,0DFH,0FFH,0FFH,0FFH
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,001H,00FH,07FH,0FFH,0FFH,0E0H,0C0H,0C0H,080H,000H,000H,000H
DB003H,007H,00FH,00FH,00FH,00FH,00FH,00FH,00FH,00FH,00FH,00FH,00FH,00FH,00FH,007H
DB087H,087H,0C3H,0C3H,0C1H,0E0H,0F0H,0F0H,0F8H,0FCH,0FCH,0FFH,0FFH,0FFH,0FFH,0FFH
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,001H,00FH,07FH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FEH,0FFH,0FFH,0FFH,0FFH
DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,07FH,07FH,03FH,03FH,03FH,01FH,01FH,01FH,00FH
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,003H,00FH,07FH,0FFH,0FFH,0FFH
DB0FFH,07FH,07FH,03FH,03FH,03FH,01FH,01FH,01FH,00FH,00FH,00FH,007H,007H,003H,003H
DB003H,001H,001H,001H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
TAB2:
;--调入了一幅图像:
C:
\128x64-2.bmp--
;--宽度x高度=64x64--
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,080H,080H,080H,0C0H
DB0C0H,0C0H,0E0H,0E0H,0E0H,0F0H,0F0H,0F8H,0F8H,0F8H,0FCH,0FCH,0FCH,0FEH,0FEH,0FFH
DB0FFH,0FFH,0FFH,0FEH,0F8H,0C0H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB030H,038H,078H,0F8H,0FCH,0FCH,0FCH,0FEH,0FEH,0FEH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FEH,0F0H,0C0H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,080H,0C0H,0F1H,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FEH,0F0H,080H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,03FH,007H,001H,001H,001H,001H,001H
DB0E1H,0FDH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,01FH,007H,001H,001H,001H,0C1H,0C1H
DB001H,001H,001H,007H,01FH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FEH,0F0H,080H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,03FH,007H,001H,000H,000H,000H,000H,0E0H,0F8H,0FFH
DB0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,03FH,007H,000H,000H,000H,000H,038H,03EH,03FH,0BFH
DB0BFH,0F8H,0C0H,0C0H,0E0H,0E0H,0E7H,0FFH,0FFH,09FH,01FH,00FH,00FH,007H,007H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB0FFH,0FFH,0FFH,0FFH,0EFH,0E1H,0E0H,0E0H,0E0H,0E0H,0E0H,0F8H,07FH,07FH,07FH,03FH
DB03FH,03FH,07FH,07FH,07FH,078H,07CH,07CH,07CH,07EH,00EH,007H,003H,003H,003H,003H
DB003H,003H,003H,00FH,03FH,07FH,07FH,07FH,07FH,07FH,07CH,070H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB00FH,00FH,007H,007H,003H,003H,003H,001H,001H,001H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
DB000H,000H,000H,000H,000H,000H,000H,0