找回密码
 注册会员
更新自动建库工具PCB Footprint Expert 2024.04 Pro / Library Expert 破解版

请各位大侠帮帮忙解释下程序~~~十万火急

[复制链接]
admin 发表于 2012-9-2 12:19:31 | 显示全部楼层 |阅读模式

本文包含原理图、PCB、源代码、封装库、中英文PDF等资源

您需要 登录 才可以下载或查看,没有账号?注册会员

×
基于89C2051编写的数字时钟程序,请帮忙注解一下,谢谢了
小弟我才疏学浅,刚接触单片机,学艺不精啊~~~~
ORG 0000H
LJMP START
ORG 0003H
RETI
ORG 000BH
LJMP INTT0
ORG 0013H
RETI
ORG 001BH
LJMP INTT1
ORG 0023H
RETI
START: MOV R0,#70H
MOV R7,#0BH
CLEARDISP: MOV @R0,#00H
INC R0
DJNZ R7,CLEARDISP
MOV 20H,#00H
MOV 7AH,#0AH
MOV TMOD,#11H
MOV TL0,#0B0H
MOV TH0,#3CH
MOV TL1,#0B0H
MOV TH1,#3CH
SETB EA
SETB ET0
SETB TR0
MOV R4,#14H
START1: LCALL DISPLAY
JNB P3.7,SETMM1
SJMP START1
SETMM1: LJMP SETMM
INTT0: PUSH ACC
PUSH PSW
CLR ET0
CLR TR0
MOV A,#0B7H
ADD A,TL0
MOV TL0,A
MOV A,#3CH
ADDC A,TH0
MOV TH0,A
SETB TR0
DJNZ R4, OUTT0
ADDSS: MOV R4,#14H
MOV R0,#71H
ACALL ADD1
MOV A,R3
CLR C
CJNE A,#60H,ADDMM
ADDMM: JC OUTT0
ACALL CLR0
MOV R0,#77H
ACALL ADD1
MOV A,R3
CLR C
CJNE A,#60H,ADDHH
ADDHH: JC OUTT0
ACALL CLR0
MOV R0,#79H
ACALL ADD1
MOV A,R3
CLR C
CJNE A,#24H,HOUR
HOUR: JC OUTT0
ACALL CLR0
OUTT0: MOV 72H,76H
MOV 73H,77H
MOV 74H,78H
MOV 75H,79H
POP PSW
POP ACC
SETB ET0
RETI
INTT1: PUSH ACC
PUSH PSW
MOV TL1, #0B0H
MOV TH1, #3CH
DJNZ R2,INTT1OUT
MOV R2,#06H
CPL 02H
JB 02H,FLASH1
MOV 72H,76H
MOV 73H,77H
MOV 74H,78H
MOV 75H,79H
INTT1OUT: POP PSW
POP ACC
RETI
FLASH1: JB 01H,FLASH2
MOV 72H,7AH
MOV 73H,7AH
MOV 74H,78H
MOV 75H,79H
AJMP INTT1OUT
FLASH2: MOV 72H,76H
MOV 73H,77H
MOV 74H,7AH
MOV 75H,7AH
AJMP INTT1OUT
ADD1: MOV A,@R0
DEC R0
SWAP A
ORL A,@R0
ADD A,#01H
DA A
MOV R3,A
ANL A,#0FH
MOV @R0,A
MOV A,R3
INC R0
SWAP A
ANL A,#0FH
MOV @R0,A
RET
CLR0: CLR A
MOV @R0,A
DEC R0
MOV @R0,A
RET
SETMM: CLR ET0
CLR TR0
LCALL DL1S
JB P3.7,CLOSEDIS
MOV R2,#06H
SETB ET1
SETB TR1
SET2: JNB P3.7,SET1
SETB 00H
SET4: JB P3.7,SET3
LCALL DL05S
JNB P3.7,SETHH
MOV R0,#77H
LCALL ADD1
MOV A,R3
CLR C
CJNE A,#60H,HHH
HHH: JC SET4
LCALL CLR0
CLR C
AJMP SET4
CLOSEDIS: SETB ET0
SETB TR0
CLOSE: JB P3.7,CLOSE
LCALL DISPLAY
JB P3.7,CLOSE
WAITH: JNB P3.7,WAITH
LJMP START1
SETHH: CLR 00H
SETHH1: JNB P3.7,SET5
SETB 01H
SET6: JB P3.7,SET7
LCALL DL05S
JNB P3.7,SETOUT
MOV R0,#79H
LCALL ADD1
MOV A,R3
CLR C
CJNE A,#24H,HOUU
HOUU: JC SET6
LCALL CLR0
AJMP SET6
SETOUT: JNB P3.7,SETOUT1
LCALL DISPLAY
JNB P3.7,SETOUT
CLR 01H
CLR 00H
CLR 02H
CLR TR1
CLR ET1
SETB TR0
SETB ET0
LJMP START1
SET1: LCALL DISPLAY
AJMP SET2
SET3: LCALL DISPLAY
AJMP SET4
SET5: LCALL DISPLAY
AJMP SETHH1
SET7: LCALL DISPLAY
AJMP SET6
SETOUT1: LCALL DISPLAY
AJMP SETOUT
DISPLAY: MOV R1,#70H
MOV R5,#0FEH
PLAY: MOV A,R5
MOV P3,A
MOV A,@R1
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P1,A
LCALL DL1MS
INC R1
MOV A,R5
JNB ACC.5,ENDOUT
RL A
MOV R5,A
AJMP PLAY
ENDOUT: SETB P3.5
MOV P1,#0FFH
RET
TAB: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H,0FFH
DL1MS: MOV R6,#14H
DL1: MOV R7,#19H
DL2: DJNZ R7,DL2
DJNZ R6,DL1
RET
DS20MS: ACALL DISPLAY
ACALL DISPLAY
ACALL DISPLAY
RET
DL1S: LCALL DL05S
LCALL DL05S
RET
DL05S: MOV R3,#20H
DL05S1: LCALL DISPLAY
DJNZ R3,DL05S1
RET
END


再次感谢啊~~~~~~
*滑块验证:
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

QQ|手机版|MCU资讯论坛 ( 京ICP备18035221号-2 )|网站地图

GMT+8, 2024-11-24 22:30 , Processed in 0.061236 second(s), 11 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表