时钟控制Word下载.docx
《时钟控制Word下载.docx》由会员分享,可在线阅读,更多相关《时钟控制Word下载.docx(19页珍藏版)》请在冰豆网上搜索。
SETBET0
SETBTR0
MOVR4,#14H
MOVDISPFIRST,#70H
START1:
LCALLDISPLAY
JNBP1.0,SETMM1
JNBP1.1,FUNSS
JNBP1.2,FUNPT
JNBP1.3,TSFUN
JB08H,QQQQ
FUNPT:
LJMPFUNPTT;
以下为闹铃时间设定程序
TSFUN:
JBP1.3,START1
WAIT113:
JNBP1.3,WAIT113
JB05H,CLOSESP
MOVDISPFIRST,#50H
MOV50H,#0CH
MOV51H,#0AH
DSWAIT:
JNBP1.2,DSFINC
JNBP1.0,DSDEC
JNBP1.3,DSSFU
AJMPDSWAIT
CLOSESP:
CLR05H
CLRBELL
DSSFU:
JBP1.3,DSWAIT
LJMPDSSFUNN
SETMM1:
LJMPSETMM
DSFINC:
JBP1.2,DSWAIT
DSWAIT12:
JNBP1.2,DSWAIT12
CLREA
MOVR0,#53H
LCALLADD1
MOVA,R3
CLRC
CJNEA,#60H,ADDHH22
ADDHH22:
JCDSWAIT
ACALLCLR0
DSDEC:
JBP1.0,DSWAIT
DSWAITEE:
JNBP1.0,DSWAITEE
LCALLSUB1
LJMPDSWAIT;
以下为秒表功能和时钟转换程序
FUNSS:
JBP1.1,START11
WAIT11:
JNBP1.1,WAIT11
CPL03H
JNB03H,TIMFUN
MOVDISPFIRST,#60H
MOV60H,#00H
MOV61H,#00H
MOV62H,#00H
MOV63H,#00H
MOV64H,#00H
MOV65H,#00H
MOVTL1,#0F0H
MOVTH1,#0D8H
SETBTR1
SETBET1
START11:
LJMPSTART1
TIMFUN:
CLRET1
CLRTR1
START12:
LJMPSTART1;
秒表暂停清零功能程序
FUNPTT:
JBP1.2,START12
WAIT22:
JNBP1.2,WAIT21
WAIT33:
JBP1.2,WAIT31
LCALLDS20MS
JBP1.2,WAIT33
WAIT66:
JNBP1.2,WAIT61
WAIT44:
JBP1.2,WAIT41
JBP1.2,WAIT44
WAIT55:
JNBP1.2,WAIT51
WAIT21:
AJMPWAIT22
WAIT31:
AJMPWAIT33
WAIT41:
AJMPWAIT44
WAIT51:
AJMPWAIT55
WAIT61:
AJMPWAIT66
*********************1s计时程序**********************
INTT0:
PUSHACC
PUSHPSW
CLRET0
CLRTR0
MOVA,#0B7H
ADDA,TL0
MOVTL0,A
MOVA,#3CH
ADDCA,TH0
MOVTH0,A
DJNZR4,OUTT0
ADDSS:
CPL07H
MOVR0,#71H
ACALLADD1
CJNEA,#60H,ADDMM
ADDMM:
JCOUTT0
MOVR0,#77H
CJNEA,#60H,ADDHH
ADDHH:
ACALLCLR0
SETB08H
MOVR0,#79H
CJNEA,#24H,HOUR
HOUR:
OUTT0:
MOV72H,76H
MOV73H,77H
MOV74H,78H
MOV75H,79H
LCALLBAOJ
POPPSW
POPACC
************闪烁调时程序和秒表功能程序*******************
INTT1:
JB03H,MMFUN
DJNZR2,INTT1OUT
MOVR2,#06H
CPL02H
JB02H,FLASH1
INTT1OUT:
POPPSW
FLASH1:
JB01H,FLASH2
MOV72H,7AH
MOV73H,7AH
MOV75H,79H
AJMPINTT1OUT
FLASH2:
MOV72H,76H
MOV73H,77H
MOV74H,7AH
MOV75H,7AH
MMFUN:
MOVA,#0F7H
ADDA,TL1
MOVTL1,A
MOVA,#0D8H
ADDCA,TH1
MOVTH1,A
MOVR0,#61H
MOVA,R3
JZFSS1
AJMPOUTT01
FSS1:
MOVR0,#63H
CJNEA,#60H,ADDHH1
ADDHH1:
JCOUTT01
LCALLCLR0
MOVR0,#65H
OUTT01:
********加1子程序***********
ADD1:
MOVA,@R0
DECR0
SWAPA
ORLA,@R0
ADDA,#01H
DAA
MOVR3,A
ANLA,#0FH
MOV@R0,A
RET
***************分减1字程序*****************
SUB1:
JZSUB11
DECA
SUB111:
SUBBA,#0AH
SUB1111:
JCSUB1110
MOV@R0,#09H
SUB110:
SUB11:
MOVA,#59H
AJMPSUB111
SUB1110:
MOVA,R3
AJMPSUB110
************时减1子程序***************
SUBB1:
JZSUBB11
SUBB111:
MOVR3,A
SUBB1111:
JCSUBB1110
SUBB110:
SUBB11:
MOVA,#23H
AJMPSUBB111
SUBB1110:
AJMPSUBB110
************清0程序*************
CLR0:
CLRA
**************时钟时间调整程***********************
SETMM:
JBP1.0,CLOSEDIS
MOVR2,#06H
MOV70H,#00H
MOV71H,#00H
SET2:
JNBP1.0,SET1
SETB00H
SET4:
JBP1.0,SET3
LCALLDL05S
JNBP1.0,SETHH
CJNEA,#60H,HHH
HHH:
JCSET4
AJMPSET4
CLOSEDIS:
SETBET0
CLOSE:
JBP1.0,CLOSE
JBP1.0,CLOSE
WAITH:
JBP1.0,WAITH
SETHH:
CLR00H
SETB01H
SETHH1:
JNBP1.0,SET5
SET6:
JBP1.0,SET7
JNBP1.0,SETOUT
MOVR0,#79H
CJNEA,#24H,HOUU
HOUU:
JCSET6
AJMPSET6
SETOUT:
JNBP1.0,SETOUT1
CLR01H
CLR02H
SET1:
AJMPSET2
SET3:
JNBP1.1,FUNSUB
SET5:
AJMPSETHH1
SET7:
JNBP1.1,FUNSUBB
SETOUT1:
LCALLDISPLAY
AJMPSETOUT
FUNSUB:
JBP1.1,SET41
FUNSUB1:
JNBP1.1,FUNSUB1
SET41:
LJMPSET4
FUNSUBB:
LCALLDS20MS
JBP1.1,SET61
FUNSUBB1:
JNBP1.1,FUNSUBB1
LCALLSUBB1
LJMPSET6
SET61:
******************显示程序***********************
DISPLAY:
MOVR1,DISPFIRST
MOVR5,#0FEH
PLAY:
MOVA,R5
MOVP2,A
MOVA,@R1
MOVDPTR,#TAB
MOVCA,@A+DPTR
MOVP0,A
JBACC.2,LOOP5
CLRP0.7
LOOP5:
JBACC.4,LOOP6
LOOP6:
LCALLDL1MS
INCR1
JNBACC.5,ENDOUT
RLA
MOVR5,A
MOVP0,#0FFH
AJMPPLAY
ENDOUT:
MOVP2,#0FFH
TAB:
DB0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H,0FFH,88H,0BFH
************上电显示子程序************************
SDISPLAY:
SPLAY:
MOVDPTR,#TABS
JNBACC.5,ENDOUTS
AJMPSPLAY
ENDOUTS:
MOVP2,#0FFH
TABS:
DB0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H,0FFH,0C6H,0BFH,88H
STAB:
DB0AH,0AH,0AH,0AH,0AH,0AH,08H,02H,0CH,02H,0CH,04H,00H,0BH,0AH,0AH
DB03H,02H,0CH,02H,01H,0CH,06H,00H,00H,02H,0AH,0AH,0AH,0AH,0AH,0AH
**************************************************************************
ST:
MOVR0,#40H
MOVR2,#20H
MOVR3,#00H
MOVDPTR,#STAB
SLOOP:
MOV@R0,A
INCA
MOVR3,A
DJNZR2,SLOOP
MOVDISPFIRST,#40H
SSLOOP:
MOVR2,#50
SSLOOP1:
LCALLSDISPLAY
DJNZR2,SSLOOP1
INCDISPFIRST
MOVA,DISPFIRST
CJNEA,#5AH,SSLOOP
MOVDISPFIRST,#5AH
MOVR3,#1BH
SSLOOP2:
MOVR2,#32H
SSLOOP12:
DJNZR2,SSLOOP12
DECDISPFIRST
DJNZR3,SSLOOP2
**************延时程序****************
DL1MS:
MOVR6,#14H
DL1:
MOVR7,#19H
DL2:
DJNZR7,DL2
DJNZR6,DL1
DS20MS:
SETBBELL
DL1S:
DL05S:
MOVR3,#20H
DL05S1:
DJNZR3,DL05S1
**************以下为闹铃时间设定程序中的时调整程序***********************
DSSFUNN:
JNBP1.3,DSSFUNN
MOV50H,#0AH
MOV51H,#0CH
WAITSS:
JNBP1.2,FFFF
JNBP1.0,DDDD
JNBP1.3,OOOO
JNBP1.1,ENA
AJMPWAITSS
OOOO:
JBP1.3,WAITSS
DSSFUNNM:
JNBP1.3,DSSFUNNM
ENA:
JBP1.1,WAITSS
DSSFUNMMO:
JNBP1.1,DSSFUNMMO
CPL05H
JNB05H,WAITSS11
MOV50H,#00H
WAITSS11:
MOV50H,#0AH
FFFF:
JBP1.2,WAITSS
DSSFUNMM:
JNBP1.2,DSSFUNMM
MOVR0,#55H
CJNEA,#24H,ADDHH33N
ADDHH33N:
JCWAITSS
DDDD:
JBP1.0,WAITSS
DSSFUNDD:
JNBP1.0,DSSFUNDD
LJMPWAITSS
******************以下为闹钟判断子程序*****************
BAOJ:
JNB05H,BBA0
MOVA,79H
CJNEA,55H,BBA0
MOVA,78H
BB3:
CJNEA,54H,BBA0
MOVA,77H
CJNEA,53H,BBA0
MOVA,76H
BB2:
CJNEA,52H,BBA0
JNB07H,BBA0
BBA0:
END