資源描述:
《《lcd數(shù)字時(shí)鐘》word版》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在應(yīng)用文檔-天天文庫。
1、;LCD顯示時(shí)鐘,第一行顯示設(shè)定日期"DATEXXXX-XX-XX",第二行顯示設(shè)定時(shí)間"TIMEXX-XX-XX",開始時(shí)兩行并列逐字;顯示日期和時(shí)間,然后定格,時(shí)鐘繼續(xù)運(yùn)行。祝亞森(0515074240),朱大三(0515074239)RSEQUP3.0;寫入數(shù)據(jù)(1)或指令(0)選擇端RWEQUP3.1;讀(1)寫(0)控制EEQUP3.2;;使能LCDEQUP2;LCD數(shù)據(jù)口BFEQUP2.7;忙標(biāo)志YEA1EQU30H;日期儲(chǔ)存地址YEA2EQU31HMONEQU32HDAYEQU33HHOUEQU34H
2、;時(shí)間儲(chǔ)存地址MINEQU35HSECEQU36HCOUNTEQU3CB0H;T0初值COUNT1EQU20;20*50us=1SSECCOUNEQU10H;存放20的地址LEDBUFEQU40H;顯示數(shù)據(jù)首地址ORG0000HLJMPMAINORG000BH;T0中斷入口LJMPSTIME;調(diào)用定時(shí)器T0中斷服務(wù)子程序MAIN:;裝入固定點(diǎn)顯示字母或符號(hào)SETBPSW.5MOVLEDBUF,#12;DMOVLEDBUF+1,#13;AMOVLEDBUF+2,#14;TMOVLEDBUF+3,#15;EMOVLED
3、BUF+4,#16;空格MOVLEDBUF+9,#10;-MOVLEDBUF+12,#10;-MOVLEDBUF+15,#17;TMOVLEDBUF+16,#18;IMOVLEDBUF+17,#19;MMOVLEDBUF+18,#15;EMOVLEDBUF+19,#16;空格MOVLEDBUF+20,#16;空格MOVLEDBUF+23,#11;:MOVLEDBUF+26,#11;:MOVLEDBUF+29,#16;空格;---------LCD1602初始化-------------------MOVA,#000
4、00001B;發(fā)送清屏操作指令;CALLW_CMD;調(diào)寫入指令子程序MOVA,#00001111B;發(fā)送顯示開/關(guān)控制ACALLW_CMD;指令,有光標(biāo),有閃爍MOVA,#00011100B;發(fā)送光標(biāo)移動(dòng)指令A(yù)CALLW_CMD;光標(biāo)和字一起移動(dòng),光標(biāo)自動(dòng)右移MOVA,#00111100B;發(fā)送功能設(shè)置指令CALLW_CMD;8位DB,雙行,5x7字符MOVDPTR,#TAB;裝入查表地址;---------LCD1602初始化結(jié)束---------------------;---------T0定時(shí)初始化----
5、----------------------MOVYEA1,#20H;設(shè)置日期初始值MOVYEA2,#08HMOVMON,#10HMOVDAY,#12HMOVHOU,#12H;設(shè)置時(shí)間初始值MOVMIN,#59HMOVSEC,#50HMOVTMOD,#01H;設(shè)置T0定時(shí),模式1MOVTH0,#HIGH(COUNT);裝入高4位初始值MOVTL0,#LOW(COUNT);裝入低4位初始值SETBEA;開中斷SETBET0;開T0中斷允許位SETBTR0;開始定時(shí)MOVSECCOUN,#COUNT1;把數(shù)值20放到1
6、0H單元中;---------T0定時(shí)初始化結(jié)束------------------------MOVBUF1:;日期"年"前兩位處理MOVA,YEA1ANLA,#0F0H;取高四位SWAPA;高四位和低四位調(diào)換MOVLEDBUF+5,A;把處理的數(shù)存放到相應(yīng)地址中MOVA,YEA1ANLA,#0FH;取低四位MOVLEDBUF+6,A;把處理的數(shù)存放到相應(yīng)地址中MOVA,YEA2;日期"年"后兩位處理ANLA,#0F0HSWAPAMOVLEDBUF+7,AMOVA,YEA2ANLA,#0FHMOVLEDBUF+8
7、,AMOVA,MON;日期"月"處理ANLA,#0F0HSWAPAMOVLEDBUF+10,AMOVA,MONANLA,#0FHMOVLEDBUF+11,AMOVA,DAY;日期"日"處理ANLA,#0F0HSWAPAMOVLEDBUF+13,AMOVA,DAYANLA,#0FHMOVLEDBUF+14,AMOVA,HOU;時(shí)間"時(shí)"處理ANLA,#0F0HSWAPAMOVLEDBUF+21,AMOVA,HOUANLA,#0FHMOVLEDBUF+22,AMOVA,MIN;時(shí)間"分"處理ANLA,#0F0HSWAP
8、AMOVLEDBUF+24,AMOVA,MINANLA,#0FHMOVLEDBUF+25,AMOVA,SEC;時(shí)間"秒"處理ANLA,#0F0HSWAPAMOVLEDBUF+27,AMOVA,SECANLA,#0FHMOVLEDBUF+28,AJMP2DIS:LCALLDISPLAYLCD;調(diào)用顯示子程序SJMPMOVBUF1;-------------定時(shí)