单片机课程设计电子钟汇编语言
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
ORG 0000H
MOV 40H,#00H MOV 41H,#00H MOV 42H,#00H MOV 43H,#00H MOV 44H,#00H MOV 45H,#00H MOV 46H,#00H MOV 47H,#00H MOV R0,#00H
MOV R1,#00H
CLR P3.0
CLR P3.1
UU:
MOV TMOD ,#00H MOV TH0,#00H MOV TL0,#00H
CLR TR0
MM:
MOV A,40H
MOV 50H,#11111110B MOV P2,50H
MOV DPTR ,#TAB MOVC A,@A+DPTR MOV P0,A
LCALL YY
MOV A,50H
RL A
MOV 50H,A
MM1:
MOV P2,50H
MOV DPTR,#TAB MOV A,41H
ADD A,#0AH MOVC A,@A+DPTR MOV P0 ,A
LCALL YY
MOV A,50H
RL A
MOV 50H,A
MM2:
MOV P2,50H
MOV DPTR,#TAB MOV A,42H
MOV P0 ,A
LCALL YY
MOV A,50H
RL A
MOV 50H,A
MM3:
MOV P2,50H
MOV DPTR,#TAB
MOV A,43H
ADD A,#0AH MOVC A,@A+DPTR MOV P0 ,A
LCALL YY
MOV A,50H
RL A
MOV 50H,A
MM4:
MOV P2,50H
MOV DPTR,#TAB MOV A,44H MOVC A,@A+DPTR MOV P0 ,A
LCALL YY
MOV A,50H
RL A
MOV 50H,A
MM5:MOV P2,50H
MOV DPTR,#TAB MOV A,45H
ADD A ,#0AH MOVC A,@A+DPTR MOV P0 ,A
LCALL YY
MOV A,50H
RL A
MOV 50H,A
MM6:
MOV P2,50H
MOV DPTR,#TAB MOV A,46H
MOV P0 ,A
LCALL YY
MOV A,50H
RL A
MOV 50H,A
MM7:MOV P2,50H MOV DPTR,#TAB MOV A,47H
ADD A,#0AH MOVC A,@A+DPTR MOV P0 ,A
LCALL YY
MOV A,50H
RL A
MOV 50H,A
JNB P1.0,KK1
JNB P1.1,KK2
JNB P1.2,KK3
JNB P1.3,KK4 CJNE R0,#01H,HH1 JNB P1.4,KK5 SETB TR0
CJNE R1,#00H,KK7 JNB P1.6,KK7
BB:JB TF0, GG LJMP MM
KK5:JNB P1.4,KK5 MOV R0,#00H LJMP UU
HH1:
JNB P1.5 ,KK6 LJMP UU
KK7:LJMP KKK7 KK1:LJMP KKK1
GG:
CLR TF0
MOV A,47H
CJNE A,#09H,LL1 MOV 47H,#00H MOV A,46H CJNE A,#09H,LL2 MOV 46H,#00H KK4:
JNB P1.3,KK4 JNB P3.1,QQ1 MOV A,45H CJNE A,#09H,QQ1 CLR P3.1
QQ1:
MOV A,45H CJNE A,#09H,LL3 MOV 45H,#00H MOV A,44H CJNE A,#05H,LL4 MOV 44H,#00H KK3:JNB P1.2,KK3 MOV A,43H CJNE A,#09H,LL7 MOV 43H,#00H MOV A,42H CJNE A,#05H,LL8 MOV 42H,#00H KK2:JNB P1.1,KK2 MOV A,41H CJNE A,#09H,LL5 MOV 41H,#00H LL6:
INC 40H
LJMP UU
KKK1:
MOV A,#00H MOV 40H,A
MOV 41H,A
MOV 42H,A
MOV 40H,A
MOV 43H,A
MOV 44H,A
MOV 45H,A
MOV 46H,A
LJMP MM
KK6:
JNB P1.5 ,KK6
MOV R0,#01H
LJMP UU
LL1:
INC 47H
LJMP UU
LL7: INC 43H
LJMP UU
LL8:
INC 42H
LJMP UU
LL2:
INC 46H
LJMP UU
LL3:
INC 45H
LJMP UU
LL4:
INC 44H
LJMP UU
LL5:
CJNE A,#03H,DD1 MOV A,40H
CJNE A,#02H,DD1 MOV 40H,#00H
MOV 41H,#00H
LJMP UU
DD1:INC 41H
LJMP UU
YY: MOV R6,#10 YY1: MOV R7,#09 YY2 :NOP
NOP
DJNZ R7,YY2
DJNZ R6,YY1 RET
KKK7:JNB P1.6,KKK7