MOV 42H,R1
MOV 73H,R2 MOV 43H,R2
MOV R0,second ;秒分离,送显示缓存 LCALL DIVIDE MOV 70H,R1 MOV 40H,R1 MOV 71H,R2 MOV 41H,R2 CLR EA
LCALL TOUTOU SETB EA
LCALL DISPLAY
LCALL GENGXIAN ;更新农历程序
JNB P0.1,SETG111 JNB F0,SSS
setb P0.4 ;非闰月,则p0.4清零,指示灯亮 LJMP MAIN1 SETG111: LJMP SETG
SSS:
clr P0.4 ;闰月,则p0.4置位,指示灯不亮 LJMP MAIN1
;~~~~~~~~~~~~~~ 温度 TOUTOU:
LCALL CHUSHI LCALL RDTEMP MOV A,TEMPL ANL A,#11110000B MOV TEMPL,A MOV A,TEMPH ANL A,#00000111B ORL A,TEMPL SWAP A MOV 25H,A MOV A,25H MOV B,#64H DIV AB MOV A,B MOV B,#0AH DIV AB SWAP A ORL A,B
MOV 10H,A RET CHUSHI:
LCALL RESET MOV A,#0CCH LCALL WRITE111 MOV A,#4EH LCALL WRITE111 MOV A,#CONFIG12 LCALL WRITE111 RET RDTEMP: LCALL RESET MOV A,#0CCH LCALL WRITE111 MOV A,#44H LCALL WRITE111 LCALL DL1MS LCALL RESET MOV A,#0CCH LCALL WRITE111
MOV A,#0BEH LCALL WRITE111 LCALL ERAD111 MOV TEMPL,A
LCALL ERAD111 MOV TEMPH,A RET RESET: LA:
SETB DAT MOV 52H,#200 LB:
CLR DAT DJNZ 52H,LB SETB DAT MOV 52H,#30 LC:
DJNZ 52H,LC CLR C ORL C,DAT JC LB
MOV 58H,#80 LD:
ORL C,DAT JC LP
DJNZ 58H,LD SJMP LA LP:
MOV 52H,#250 LF:
DJNZ 52H,LF RET WRITE111: MOV 53H,#8 W51HA: SETB DAT MOV 54H,#8 RRC A CLR DAT W52HA:
DJNZ 54H,W52HA MOV DAT,C MOV 54H,#30 W53HA:
DJNZ 54H,W53HA DJNZ 53H,W51HA SETB DAT RET
ERAD111: CLR EA MOV 58H,#8 RD1A: CLR DAT MOV 54H,#6 NOP SETB DAT RD2A:
DJNZ 54H,RD2A MOV C,DAT RRC A MOV 55H,#30 RD3A:
DJNZ 55H,RD3A DJNZ 58H,RD1A SETB DAT RET
;公历设置程序~~~~~~~~~~~~~~~~~~~~~ SETG :
SETB TR1 SETB ET1
MOV 32H,#8EH
MOV 31H,#00H ;允许写1302 LCALL WRITE
MOV 32H,#80H
MOV 31H,#80H ;1302停止振荡 LCALL WRITE
GWAIT: ;~~~~~~~~~~~~~~~~~~ LCALL DISPLAY JNB P0.1,GWAIT SETG1:
LCALL DISPLAY JNB P0.1,SETG2 JNB P0.2,GADDYEAR JNB P0.3,JIANYEAR AJMP SETG1
GADDYEAR:
MOV R7,66H ;年加一
LCALL ADD1 MOV 66H,A
CJNE A,#51H,GADDYEAR1 MOV 66H,#00H
AJMP GADDYEAR1 JIANYEAR:
MOV R7,66H ;年减一 LCALL JIAN1 MOV 66H,A
CJNE A,#00H,GADDYEAR1 MOV 66H,#51H
GADDYEAR1:
MOV 32H,#8CH ;年值送人1302 MOV 31H,66H LCALL WRITE
MOV R0,66H
LCALL DIVIDE ;年分离送显示缓存 MOV 4BH,R1 MOV 7BH,R1 MOV 4CH,R2
MOV 7CH,R2
WAITT1: ;~~~~~~~~~~~~~~~~ LCALL DISPLAY
JNB P0.2,WAITT1
JNB P0.3,WAITT1 AJMP SETG1 SETG2:
SETB 0AH ;调月时闪标志 GWAIT2:
LCALL DISPLAY JNB P0.1,GWAIT2 SETG3:
LCALL DISPLAY JNB P0.1,SETG4
JNB P0.2,GADDMONTH JNB P0.3,JIANMONTH AJMP SETG3
GADDMONTH:
MOV R7,65H ;月加一 LCALL ADD1 MOV 65H,A
CJNE A,#13H,GADDMONTH1 MOV 65H,#01H AJMP GADDMONTH1 JIANMONTH:
MOV R7,65H ;月减一 LCALL JIAN1 MOV 65H,A
CJNE A,#00H,GADDMONTH1 MOV 65H,#12H
GADDMONTH1:
MOV 32H,#88H ;月值送人1302 MOV 31H,65H
LCALL WRITE MOV R0,65H
LCALL DIVIDE ;月分离,送显示缓存 MOV 79H,R1
MOV 49H,R1 MOV 7AH,R2 MOV 4AH,R2
WAITT2: ;~~~~~~~~~~~~~~~~~~~~ LCALL DISPLAY JNB P0.2,WAITT2 JNB P0.3,WAITT2
AJMP SETG3 SETG4:
SETB 0BH ;调日时闪标志