电子钟 万年历 程序 毕业设计Word格式文档下载.docx
《电子钟 万年历 程序 毕业设计Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《电子钟 万年历 程序 毕业设计Word格式文档下载.docx(59页珍藏版)》请在冰豆网上搜索。
MOVSCON,#00H;
串行输出,方式0
MOVTMOD,#10H;
计数器1,方式1
MOVTL1,#00H
MOVTH1,#00H
MOVDS1302_ADDR,#8EH;
允许写1302
MOVDS1302_DATA,#00H
LCALLWRITE
MOVDS1302_ADDR,#90H
MOVDS1302_DATA,#0A6H;
1302充电,充电电流1.1MA
MAIN1:
MOVDS1302_ADDR,#8DH;
主程序,读出年
LCALLREAD
MOVYEAR,DS1302_DATA
MOVDS1302_ADDR,#8BH;
读出星期
MOVWEEK,DS1302_DATA
MOVDS1302_ADDR,#89H;
读出月
MOVMONTH,DS1302_DATA
MOVDS1302_ADDR,#87H;
读出日
MOVDAY,DS1302_DATA
MOVDS1302_ADDR,#85H;
读出小时
MOVHOUR,DS1302_DATA
MOVDS1302_ADDR,#83H;
读出分钟
MOVMINTUE,DS1302_DATA
MOVDS1302_ADDR,#81H;
读出秒
MOVSECOND,DS1302_DATA
MOVR0,YEAR;
~~~~~~~~~~~~分离缓存~~~~~~~~
LCALLDIVIDE;
年分离,送显示缓存
MOV7BH,R1
MOV4BH,R1
MOV7CH,R2
MOV4CH,R2
MOV78H,WEEK
MOV48H,WEEK
MOVR0,MONTH;
月分离,送显示缓存
LCALLDIVIDE
MOV79H,R1
MOV49H,R1
MOV7AH,R2
MOV4AH,R2
MOVR0,DAY;
日分离,送显示缓存
MOV76H,R1
MOV46H,R1
MOV77H,R2
MOV47H,R2
MOVR0,HOUR;
小时分离,送显示缓存
MOV74H,R1
MOV44H,R1
MOV75H,R2
MOV45H,R2
MOVR0,MINTUE;
分钟分离,送显示缓存;
;
MOV72H,R1
MOV42H,R1
MOV73H,R2
MOV43H,R2
MOVR0,SECOND;
秒分离,送显示缓存
MOV70H,R1
MOV40H,R1
MOV71H,R2
MOV41H,R2
LCALLDISPLAY
LCALLGENGXIAN;
调用更新农历程序
JNBP1.2,NUM
JNBP1.1,SETG
JNBF0,SSS
CLRP1.3;
非闰月,则p0.4清零,指示灯亮
LJMPMAIN1
SSS:
SETBP1.3;
闰月,则p0.4置位,指示灯不亮
NUM:
MOVMONTH,#0AAH
MOVHOUR,#0AAH
MOVMINTUE,#0AAH
MOVSECOND,#04H
MOVR0,MONTH
MOVR0,HOUR
MOVR0,MINTUE
MOV42H,R1
MOVR0,SECOND
SETG:
SETBTR1
SETBET1;
公历设置程序~~~~~~~~~~~~~~~~~~~~~
CLR08H
CLR09H
CLR0AH
CLR0BH
CLR0CH
CLR0DH
CLR0EH
CLR0FH
MOVDS1302_ADDR,#8EH
MOVDS1302_DATA,#00H;
允许写1302
LCALLWRITE
MOVDS1302_ADDR,#80H
MOVDS1302_DATA,#80H
LCALLWRITE;
1302停止振荡
GWAIT:
JNBP1.1,GWAIT
SETG1:
JNBP1.1,SETG2
JNBP1.2,GADDYEAR
AJMPSETG1
GADDYEAR:
MOVR7,66H;
年加一
LCALLADD1
MOV66H,A
CJNEA,#51H,GADDYEAR1
MOV66H,#01H
GADDYEAR1:
MOVDS1302_ADDR,#8CH;
年值送人1302
MOVDS1302_DATA,66H
MOVR0,66H
年分离送显示缓存
WAITT1:
JNBP1.2,WAITT1
SETG2:
SETB0AH;
调月时闪标志
GWAIT2:
JNBP1.1,GWAIT2
SETG3:
JNBP1.1,SETG4
JNBP1.2,GADDMONTH
AJMPSETG3
GADDMONTH:
MOVR7,65H;
月加一
MOV65H,A
CJNEA,#13H,GADDMONTH1
MOV65H,#01H
GADDMONTH1:
MOVDS1302_ADDR,#88H;
月值送人1302
MOVDS1302_DATA,65H
MOVR0,65H
WAITT2:
JNBP1.2,WAITT2
SETG4:
SETB0BH;
调日时闪标志
GWAIT4:
JNBP1.1,GWAIT4
SETG5:
JNBP1.1,SETG6
JNBP1.2,GADDDAY
AJMPSETG5
GADDDAY:
MOVR7,63H;
日加一
MOV63H,A
CJNEA,#32H,GADDDAY1
MOV63H,#01H
GADDDAY1:
MOVDS1302_ADDR,#86H;
日值送人1302
MOVDS1302_DATA,63H
MOVR0,63H
WAITT3:
JNBP1.2,WAITT3
SETG6:
SETB0CH;
调星期时闪标志
GWAIT6:
JNBP1.1,GWAIT6
SETG7:
JNBP1.1,SETG8
JNBP1.2,GADDWEEK
AJMPSETG7;
星期加一
GADDWEEK:
MOVR7,64H
MOV64H,A
CJNEA,#08H,GADDWEEK1
MOV64H,#01H
GADDWEEK1:
MOVDS1302_ADDR,#8AH
MOVDS1302_DATA,64H;
星期值送人1302
MOVR0,64H
星期值分离送显示缓存
MOV48H,R1
MOV78H,R1
WAITT4:
JNBP1.2,WAITT4
AJMPSETG7
SETG8:
SETB0DH;
调小时时闪标志
GWAIT8:
JNBP1.1,GWAIT8
SETG9:
JNBP1.1,SETG10
JNBP1.2,GADDHOUR
AJMPSETG9
GADDHOUR:
MOVR7,62H;
小时加一
MOV62H,A
CJNEA,#24H,GADDHOUR1
MOV62H,#00H
GADDHOUR1:
MOVDS1302_ADDR,#84H;
小时值送人1302
MOVDS1302_DATA,62H
MOVR0,62H
小时值分离送显示
WAITT5:
JNBP1.2,WAITT5
SETG10:
SETB0EH;
调分时候闪标志
GWAITT10:
JNBP1.1,GWAITT10
SETG11:
JNBP1.1,SETGOUT
JNBP1.2,GADDMINTUE
AJMPSETG11
GADDMINTUE:
MOVR7,61H;
分钟加一