LCD显示实验Word格式文档下载.docx
- 文档编号:21022685
- 上传时间:2023-01-27
- 格式:DOCX
- 页数:21
- 大小:91.42KB
LCD显示实验Word格式文档下载.docx
《LCD显示实验Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《LCD显示实验Word格式文档下载.docx(21页珍藏版)》请在冰豆网上搜索。
COMEQU10H;
指令寄存器
DATEQU11H;
数据寄存器
COLUMNEQU12H;
列地址寄存器
PAGEnEQU13H;
页地址寄存器
CODEnEQU14H;
字符代码寄存器
COUNTEQU15H;
字模列计数器
nnEQU16H
;
--------左、右半面读写数据、指令的操作地址---------
CWADD1EQU0e000H;
写指令代码地址(左)
CRADD1EQU0e800H;
读状态字地址(左)
DWADD1EQU0e400H;
写显示数据代码地址(左)
DRADD1EQU0ec00H;
读显示数据地址(左)
CWADD2EQU0f000H;
写指令代码地址(右)
CRADD2EQU0f800H;
读状态字地址(右)
DWADD2EQU0f400H;
写显示数据代码地址(右)
DRADD2EQU0fc00H;
读显示数据地址(右)
--------------------------------------------------
ASCIICODEEQU17H
FIRST0_SECOND1_BITequ00H
ASCII_DOT16EQU30H
--------------------------------------------
ORG0000H
AJMPMAIN
ORG0100H
MAIN:
ACALLINIT
ACALLCLEAR;
调用清屏子程序
MOVPAGEn,#00H
MOVCOLUMN,#00
MOVCODEn,#00H
LCALLCW_PR
MOVPAGEn,#00H
MOVCOLUMN,#16
MOVCODEn,#01H
LCALLCW_PR
MOVPAGEn,#00H
MOVCOLUMN,#32
MOVCODEn,#02H
MOVCOLUMN,#48
MOVCODEn,#03H
MOVCOLUMN,#64
MOVCODEn,#04H
MOVPAGEn,#00H
MOVCOLUMN,#80
MOVCODEn,#05H
MOVPAGEn,#04H
MOVCODEn,#06H
MOVPAGEn,#04H
MOVCODEn,#07H
MOVPAGEn,#04H
MOVCODEn,#08H
HERE:
AJMPHERE
---------------------------------------------------
左半屏写指令子程序
PRL0:
PUSHDPL
PUSHDPH
MOVDPTR,#CRADD1;
状态字口地址
PRL01:
MOVXA,@DPTR;
读状态字
JBACC.7,PRL01;
查询忙标志
MOVDPTR,#CWADD1;
写指令口地址
MOVA,COM;
取指令码
MOVX@DPTR,A;
写指令码
POPDPH
POPDPL
RET
--------------------------------------------------
左半屏写显示数据子程序
PRL1:
PRL11:
JBACC.7,PRL11;
MOVDPTR,#DWADD1;
写数据口地址
MOVA,DAT;
取数据
写数据
RET
右半屏写指令子程序
PRR0:
MOVDPTR,#CRADD2;
PRR01:
JBACC.7,PRR01;
MOVDPTR,#CWADD2;
右半屏写显示数据子程序
PRR1:
PRR11:
JBACC.7,PRR11;
MOVDPTR,#DWADD2;
;
初始化子程序
开显示
INIT:
MOVCOM,#0C0H;
1100,0000B
LCALLPRL0;
设左半屏起始行为0
LCALLPRR0;
设右半屏起始行为0
MOVCOM,#03FH;
0011,1111B,开显示
清屏子程序
CLEAR:
MOVR4,#00H
CLEAR1:
MOVA,R4
ORLA,#0B8H;
1011,10000B,设置页面为0页
MOVCOM,A
设左半屏起始页为0
设右半屏起始页为0
MOVCOM,#040H;
0100,0000B,设列地址为0
MOVR3,#40H;
2^6=64列
CLEAR2:
MOVDAT,#00H;
数据为0
LCALLPRL1;
调用写数据指令清屏
LCALLPRR1
DJNZR3,CLEAR2
INCR4
CJNER4,#08H,CLEAR1
16*16汉字显示子程序
CW_PR:
MOVDPTR,#CTAB;
16*16点阵,占32个字节
MOVA,CODEn;
根据字模编码查该字符在字模表里的地址
MOVB,#32
MULAB
ADDA,DPL
MOVDPL,A
MOVA,B
ADDCA,DPH
MOVDPH,A
MOVnn,#00H
MOVR4,COLUMN;
保存列地址
MOVA,PAGEn;
取页地址
MOVR2,#2;
共分两页显示
CW_1:
MOVcount,#16
CW_2:
ANLA,#07H;
00000111B取页号D2,D1,D0
10111000B,将页号转为页地址指令
MOVCOM,A;
设置页地址
LCALLPRL0
LCALLPRR0
MOVA,COLUMN;
判断在左半还是右半屏
CLRC
CJNEA,#64,CW_21;
列数〈64,在左半
CW_21:
JNCCW_22;
列数〉=64,在右半
CLRFIRST0_SECOND1_BIT;
左半屏列标志BIT1=0
AJMPCW_3
CW_22:
CLRC
SUBBA,#64
MOVCOLUMN,A
SETBFIRST0_SECOND1_BIT;
右半屏列标志BIT1=1
CW_3:
MOVCOM,COLUMN;
取列地址
ORLCOM,#40H;
01000000B,转为列地址指令
JBFIRST0_SECOND1_BIT,CW_31;
判断在右半屏
设置左屏显示列地址
LJMPCW_4
CW_31:
设置右屏显示列地址
CW_4:
MOVA,nn;
显示字模第0列
MOVCA,@A+DPTR;
查表取字模
MOVDAT,A;
保存字模数据
JBFIRST0_SECOND1_BIT,CW_42;
CW_41:
写左半屏数据
AJMPCW_5
CW_42:
LCALLPRR1;
写右半屏数据
CW_5:
INCnn;
指向下一列字模
INCCOLUMN;
列地址计数加1
MOVA,COLUMN
CJNEA,#64,CW_6;
是否超过64,超过则转右半屏
CW_6:
JCCW_9;
未超过,继续显示下一列
当前在左半,转右半屏继续显示
MOVCOLUMN,#00H
MOVCOM,#40H;
01000000B,设右半列地址为0
LCALLPRR0
CW_9:
DJNZCOUNT,CW_4;
16列全显示完了吗?
CW_10:
INCPAGEn
MOVA,PAGEn
MOVCOLUMN,R4
CLRFIRST0_SECOND1_BIT
DJNZR2,CW_1
CW:
CTAB:
DB000H,070H,008H,008H,008H,088H,070H,000H;
DB000H,0E0H,010H,008H,008H,010H,0E0H,000H;
DB000H,030H,028H,024H,022H,021H,030H,000H;
"
2"
0
DB000H,00FH,010H,020H,020H,010H,00FH,000H;
0"
1
2
DB000H,000H,031H,022H,022H,011H,00FH,000H;
9"
3
DB000H,010H,010H,0F8H,000H,000H,000H,000H;
DB000H,020H,020H,03FH,020H,020H,000H,000H;
1"
4
5
DB000H,0E0H,010H,088H,088H,018H,000H,000H;
DB000H,030H,008H,088H,088H,048H,030H,000H;
DB000H,00FH,011H,020H,020H,011H,00EH,000H;
6"
6
DB000H,018H,020H,020H,020H,011H,00EH,000H;
3"
7
8
9
DB000H,000H,0C0H,020H,010H,0F8H,000H,000H;
10
DB000H,007H,004H,024H,024H,03FH,024H,000H;
4"
11
DB020H,024H,024H,0A4H,0A4H,0BFH,0A4H,0E4H;
DB0A4H,0BFH,0A4H,0A4H,024H,024H,020H,000H;
DB000H,080H,080H,05FH,032H,012H,012H,01FH;
DB012H,012H,032H,05FH,0C0H,000H,000H,000H;
黄"
DB000H,000H,000H,0C0H,070H,020H,000H,0FFH;
DB000H,010H,020H,0C0H,080H,000H,000H,000H;
DB004H,002H,001H,000H,000H,040H,080H,07FH;
DB000H,000H,000H,000H,001H,007H,002H,000H;
小"
DB000H,018H,026H,022H,0A2H,072H,02EH,0AAH;
DB022H,022H,022H,032H,022H,00AH,006H,000H;
DB000H,010H,010H,012H,013H,012H,012H,0FFH;
DB012H,012H,012H,013H,012H,018H,010H,000H;
军"
END
3、选取图片为
计数器
zimocodeEQU16H
FIRST0_SECOND1_BITequ18H
ACALLCLEAR;
调用显示子程序
;
ACALLINIT
MOVCOLUMN,#30
MOVPAGEn,#00H
LCALLCW_PR
AJMPHERE
左半屏读显示数据子程序
PRL2:
PRL21:
JBACC.7,PRL21;
MOVDPTR,#DRADD1;
读数据口地址
读数据
存数据
右半屏读显示数据子程序
PRR2:
PRR21:
JBACC.7,PRR21;
MOVDPTR,#DRADD2;
64*64图片显示子程序
点阵模首地址
MOVR2,#00H;
点阵字节计数器
MOVA,
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- LCD 显示 实验