100分求AT89C51电子钟设计,需要proteus仿真图和汇编程序。要求四位共阴极数码管显示时分秒带校时电路。
2个回答
展开全部
四位怎么显示时分秒呢????
我刚刚做了一个,图没有,直接飞的线,这个很简单的
程序可以给你
ORG 0000H
AJMP MAIN
ORG 000BH
AJMP INTT0
ORG 0050H
DATA1 EQU 30H
DATA2 EQU 31H
COMMAND EQU 32H
LI1 EQU 33H
LI2 EQU 34H
DIZHIL EQU 35H
DIZHIH EQU 36H
DATA01 EQU 37H;显示内存
DATA02 EQU 38H;显示内存
DATA03 EQU 39H;显示内存
DATA04 EQU 3AH;显示内存
DATA05 EQU 3BH;显示内存
DATA06 EQU 3CH;显示内存
DATA07 EQU 3DH;显示内存
DATA08 EQU 3EH;显示内存
DATA001 EQU 3FH;时钟小时十位
DATA002 EQU 40H;
DATA003 EQU 41H;
DATA004 EQU 42H;
DATA005 EQU 43H;
DATA006 EQU 44H;
DATA007 EQU 45H
INTT0:
PUSH ACC
PUSH PSW
CLR TR0
CLR EA
DJNZ R2,ENDINTT0
MOV R2,#10
MOV A,DATA007
CPL ACC.2
MOV DATA007,A
DJNZ R1,ENDINTT0
MOV R2,#10
MOV R1,#2
INC DATA006
NOP
NOP
ENDINTT0:
MOV TCON,#00H
MOV TH0,#3CH
MOV TL0,#0E8H
SETB EA
SETB TR0
POP PSW
POP ACC
RETI
MS40:
MOV R7,#10H
MS2:
MOV R6,#70H
MS1:
DJNZ R6,MS1
DJNZ R7,MS2
RET
DELAY:
MOV R5,#03H
DELAY1:
LCALL MS40
DJNZ R5,DELAY1
RET
MAIN:
MOV SP,#67H
MOV DATA001,#00H
MOV DATA002,#00H
MOV DATA003,#00H
MOV DATA004,#00H
MOV DATA005,#00H
MOV DATA006,#00H
MOV DATA007,#0FBH
MOV R2,#10
MOV R1,#2
MOV TCON,#00H
MOV TMOD,#01H
MOV TH0,#3CH
MOV TL0,#0E8H
SETB TR0
SETB ET0
SETB EA
SETB P3.1
SETB P3.2
SETB F0
MAIN1:
LCALL XIANSHI
LCALL SHIZHONGJS
JNB P3.1,ANJIAN
JNB P3.2,ANJIAN
SETB F0
LJMP MAIN1
ANJIAN:
JNB F0,MAIN1
LCALL MS40
JNB P3.1,ANJIAN1
JNB P3.2,ANJIAN2
LJMP MAIN1
ANJIAN1:
CLR F0
INC DATA002
SETB P3.2
LJMP MAIN1
ANJIAN2:
CLR F0
INC DATA004
SETB P3.1
LJMP MAIN1
XIANSHI:
MOV DPTR,#SHUZI
MOV A,DATA001
MOVC A,@A+DPTR
MOV R0,A
ORL A,#0E1H
MOV P1,A
SETB P3.5
LCALL MS40
MOV A,R0
ORL A,#1EH
; CLR P3.5
MOV P1,A
; SETB P3.5
LCALL MS40
MOV A,DATA002
MOVC A,@A+DPTR
CLR P3.5
MOV R0,A
ORL A,#0E1H
MOV P1,A
SETB P3.4
LCALL MS40
MOV A,R0
ORL A,#1EH
; CLR P3.4
MOV P1,A
; SETB P3.4
LCALL MS40
MOV A,DATA003
MOVC A,@A+DPTR
CLR P3.4
MOV R0,A
ORL A,#0E1H
MOV P1,A
SETB P3.3
LCALL MS40
MOV A,R0
ORL A,#1EH
; CLR P3.3
MOV P1,A
; SETB P3.3
LCALL MS40
MOV A,DATA004
MOVC A,@A+DPTR
CLR P3.3
MOV R0,A
ORL A,#0E1H
MOV P1,A
SETB P3.7
LCALL MS40
MOV A,R0
ORL A,#1EH
; CLR P3.7
MOV P1,A
; SETB P3.7
LCALL MS40
nop
nop
CLR P3.7
MOV P1,DATA007
SETB P3.7
SETB P3.3
LCALL MS40
nop
nop
CLR P3.3
CLR P3.7
RET
SHIZHONGJS:
MOV A,DATA006
CJNE A,#0AH,SHIZHONG1
MOV DATA006,#00H
INC DATA005
SHIZHONG1:
MOV A,DATA005
CJNE A,#06H,SHIZHONG2
MOV DATA005,#00H
INC DATA004
SHIZHONG2:
MOV A,DATA004
CJNE A,#0AH,SHIZHONG3
MOV DATA004,#00H
INC DATA003
SHIZHONG3:
MOV A,DATA003
CJNE A,#06H,SHIZHONG4
MOV DATA003,#00H
INC DATA002
SHIZHONG4:
MOV A,DATA001
CJNE A,#02H,SHIZHONG50
MOV A,DATA002
CJNE A,#04H,SHIZHONG50
MOV DATA002,#00H
MOV DATA001,#00H
SJMP SHIZHONG5
SHIZHONG50:
MOV A,DATA002
CJNE A,#0AH,SHIZHONG5
MOV DATA002,#00H
INC DATA001
SHIZHONG5:
RET
SHUZI:
DB 005H,0DDH,046H,054H,09CH,034H,024H,05DH,004H,014H,0FFH;
LJMP MAIN1
END
自己慢慢看,不懂的问我
我刚刚做了一个,图没有,直接飞的线,这个很简单的
程序可以给你
ORG 0000H
AJMP MAIN
ORG 000BH
AJMP INTT0
ORG 0050H
DATA1 EQU 30H
DATA2 EQU 31H
COMMAND EQU 32H
LI1 EQU 33H
LI2 EQU 34H
DIZHIL EQU 35H
DIZHIH EQU 36H
DATA01 EQU 37H;显示内存
DATA02 EQU 38H;显示内存
DATA03 EQU 39H;显示内存
DATA04 EQU 3AH;显示内存
DATA05 EQU 3BH;显示内存
DATA06 EQU 3CH;显示内存
DATA07 EQU 3DH;显示内存
DATA08 EQU 3EH;显示内存
DATA001 EQU 3FH;时钟小时十位
DATA002 EQU 40H;
DATA003 EQU 41H;
DATA004 EQU 42H;
DATA005 EQU 43H;
DATA006 EQU 44H;
DATA007 EQU 45H
INTT0:
PUSH ACC
PUSH PSW
CLR TR0
CLR EA
DJNZ R2,ENDINTT0
MOV R2,#10
MOV A,DATA007
CPL ACC.2
MOV DATA007,A
DJNZ R1,ENDINTT0
MOV R2,#10
MOV R1,#2
INC DATA006
NOP
NOP
ENDINTT0:
MOV TCON,#00H
MOV TH0,#3CH
MOV TL0,#0E8H
SETB EA
SETB TR0
POP PSW
POP ACC
RETI
MS40:
MOV R7,#10H
MS2:
MOV R6,#70H
MS1:
DJNZ R6,MS1
DJNZ R7,MS2
RET
DELAY:
MOV R5,#03H
DELAY1:
LCALL MS40
DJNZ R5,DELAY1
RET
MAIN:
MOV SP,#67H
MOV DATA001,#00H
MOV DATA002,#00H
MOV DATA003,#00H
MOV DATA004,#00H
MOV DATA005,#00H
MOV DATA006,#00H
MOV DATA007,#0FBH
MOV R2,#10
MOV R1,#2
MOV TCON,#00H
MOV TMOD,#01H
MOV TH0,#3CH
MOV TL0,#0E8H
SETB TR0
SETB ET0
SETB EA
SETB P3.1
SETB P3.2
SETB F0
MAIN1:
LCALL XIANSHI
LCALL SHIZHONGJS
JNB P3.1,ANJIAN
JNB P3.2,ANJIAN
SETB F0
LJMP MAIN1
ANJIAN:
JNB F0,MAIN1
LCALL MS40
JNB P3.1,ANJIAN1
JNB P3.2,ANJIAN2
LJMP MAIN1
ANJIAN1:
CLR F0
INC DATA002
SETB P3.2
LJMP MAIN1
ANJIAN2:
CLR F0
INC DATA004
SETB P3.1
LJMP MAIN1
XIANSHI:
MOV DPTR,#SHUZI
MOV A,DATA001
MOVC A,@A+DPTR
MOV R0,A
ORL A,#0E1H
MOV P1,A
SETB P3.5
LCALL MS40
MOV A,R0
ORL A,#1EH
; CLR P3.5
MOV P1,A
; SETB P3.5
LCALL MS40
MOV A,DATA002
MOVC A,@A+DPTR
CLR P3.5
MOV R0,A
ORL A,#0E1H
MOV P1,A
SETB P3.4
LCALL MS40
MOV A,R0
ORL A,#1EH
; CLR P3.4
MOV P1,A
; SETB P3.4
LCALL MS40
MOV A,DATA003
MOVC A,@A+DPTR
CLR P3.4
MOV R0,A
ORL A,#0E1H
MOV P1,A
SETB P3.3
LCALL MS40
MOV A,R0
ORL A,#1EH
; CLR P3.3
MOV P1,A
; SETB P3.3
LCALL MS40
MOV A,DATA004
MOVC A,@A+DPTR
CLR P3.3
MOV R0,A
ORL A,#0E1H
MOV P1,A
SETB P3.7
LCALL MS40
MOV A,R0
ORL A,#1EH
; CLR P3.7
MOV P1,A
; SETB P3.7
LCALL MS40
nop
nop
CLR P3.7
MOV P1,DATA007
SETB P3.7
SETB P3.3
LCALL MS40
nop
nop
CLR P3.3
CLR P3.7
RET
SHIZHONGJS:
MOV A,DATA006
CJNE A,#0AH,SHIZHONG1
MOV DATA006,#00H
INC DATA005
SHIZHONG1:
MOV A,DATA005
CJNE A,#06H,SHIZHONG2
MOV DATA005,#00H
INC DATA004
SHIZHONG2:
MOV A,DATA004
CJNE A,#0AH,SHIZHONG3
MOV DATA004,#00H
INC DATA003
SHIZHONG3:
MOV A,DATA003
CJNE A,#06H,SHIZHONG4
MOV DATA003,#00H
INC DATA002
SHIZHONG4:
MOV A,DATA001
CJNE A,#02H,SHIZHONG50
MOV A,DATA002
CJNE A,#04H,SHIZHONG50
MOV DATA002,#00H
MOV DATA001,#00H
SJMP SHIZHONG5
SHIZHONG50:
MOV A,DATA002
CJNE A,#0AH,SHIZHONG5
MOV DATA002,#00H
INC DATA001
SHIZHONG5:
RET
SHUZI:
DB 005H,0DDH,046H,054H,09CH,034H,024H,05DH,004H,014H,0FFH;
LJMP MAIN1
END
自己慢慢看,不懂的问我
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询