19264液晶模块显示51单片机汇编程序

合集下载
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

com equ 30h
dat equ 31h
cs1 bit p3.3
cs2 bit p3.4
cs3 bit p3.5
res bit p3.6
rs bit p3.0
rw bit p3.1
e bit p3.2
bf bit p1.7
county equ 32h
countx equ 33h
org 0000h
;********************主程序
main:
call init
call display
sjmp $
;********************显示程序
display:

call select1
mov r3,#0b8h ;页地址暂存
mov r4,#40h ;列地址暂存
mov dptr,#table1
call wordw

mov r3,#0b8h ;页地址暂存
mov r4,#50h ;列地址暂存
mov dptr,#table2
call wordw

mov r3,#0b8h ;页地址暂存
mov r4,#60h ;列地址暂存
mov dptr,#table3
call wordw

mov r3,#0b8h ;页地址暂存
mov r4,#70h ;列地址暂存
mov dptr,#table4
call wordw

call select2
mov r3,#0b8h ;页地址暂存
mov r4,#40h ;列地址暂存
mov dptr,#table5
call wordw

ret


;********************1个汉字写入
wordw:
mov com,r3
call rswrite
mov com,r4
call rswrite

mov r5,#2
mov county,#16
clr a
w1:
movc a,@a+dptr
mov dat ,a
call datawrite
inc dptr
djnz county,w1
djnz r5,w2
sjmp w3
w2:
inc r3 ; 页地址增加1
mov com,r3
call rswrite
mov com,r4 ;列地址为原来的
call rswrite
mov county,#16
clr a
sjmp w1
w3:
ret

;********************初始化
init:
call delay10ms
call select1 ;选择模块1初始化
call clear

call select2 ;选择模块2初始化
call clear

call select3 ;选择模块3初始化
call clear

setb cs1 ;关闭所有的模块
setb cs2
setb cs3

ret
;********************清屏
clear:
mov r2,#64 ;用于清屏循环
mov r3,#0b8h ;用于设置清屏起始页
mov r4,#40h ;用于设置清屏起始列
mov com,#3fh ;开显示
call rswrite
mov com,r3 ;设置起始页为第0页,总共8页
call rswrite
mov com,r4 ;设置起始列为第0列,总共64列
call rswrite
clear1:
mov dat,#00h ;清除显示(清屏)
call datawrite
djnz r2,clear1 ;列循环64列
mov r2,#64
inc r3
mov com,r3 ;设置页地址
call rswrite
cjne r3,#0c0h,clear1 ;页循环8页
ret


;********************写入命令
rswrite:
acall busy
clr rs
clr rw
mov p1,com
setb e
nop
clr e

ret
;********************写入数据
datawrite:
acall busy
setb rs
clr rw
mov p1,dat
setb e
nop
clr e

ret
;********************忙判断
busy:
clr rs
setb rw
busy01:
mov p1,#0ffh ;p1口置1
setb e ;在e高电平的作用下状态输出到数据线
mov a,p1
clr e ;为使液晶能工作e必须保持低电平
jb acc.7,busy01 ;判忙,标志为0 ?否再读
ret

;********************模块选择
select1:
clr cs1
setb cs2
setb cs3
ret
select2:
setb cs1
clr cs2
setb cs3
ret
select3:
setb cs1
setb cs2
clr

cs3
ret
;********************


DELAY10ms: MOV R4,#20
D1: MOV R5,#248
DJNZ R5,$
DJNZ R4,D1
RET

table1: db 10h, 22h, 64h, 0Ch, 90h, 08h,0F7h, 14h ;海
db 34h, 54h, 14h, 14h,0F6h, 04h, 00h, 00h
db 04h, 04h,0FEh, 01h, 01h, 1Fh, 11h, 11h
db 13h, 15h, 51h, 91h, 7Fh, 11h, 01h, 00h

table2: db 00h, 00h, 00h, 00h, 00h, 00h, 00h,0FFh ; "上",
db 20h, 20h, 20h, 30h, 20h, 00h, 00h, 00h
db 40h, 40h, 40h, 40h, 40h, 40h, 40h, 7Fh
db 40h, 40h, 40h, 40h, 40h, 60h, 40h, 00h

table3:db 80h, 84h, 84h, 84h, 84h,0FEh, 82h, 83h ; "升",
db 82h, 80h,0FFh, 80h, 80h,0C0h, 80h, 00h
db 00h, 00h, 40h, 20h, 18h, 07h, 00h, 00h
db 00h, 00h,0FFh, 00h, 00h, 00h, 00h, 00h


table4: db 00h,0FCh, 44h, 44h, 44h,0FEh, 04h, 00h ;明
db 0FEh, 22h, 22h, 22h, 22h,0FFh, 02h, 00h
db 00h, 0Fh, 04h, 04h, 04h, 8Fh, 40h, 30h
db 0Fh, 02h, 02h, 42h, 82h, 7Fh, 00h, 00h

table5: db 00h, 00h, 00h, 00h,0FEh, 22h, 22h, 22h ;月
db 22h, 22h, 22h,0FFh, 02h, 00h, 00h, 00h
db 00h, 80h, 40h, 30h, 0Fh, 02h, 02h, 02h
db 02h, 42h, 82h, 7Fh, 00h, 00h, 00h, 00h
end

相关文档
最新文档