急求单片机电子时钟设计,电路图,汇编程序

2024-11-03 02:22:09
推荐回答(1个)
回答1:

ORG 0000H
SJMP MAIN
ORG 000BH
SJMP TIMERI
ORG 0013H
SJMP INT1
ORG 0030H
MAIN: MOV TMOD ,#02H
MOV TL0 ,#6
MOV TH0 ,#6
SETB ET0
SETB EA
SETB TR0
SETB EX1
MOV R2,#0
MOV R3,#0
MOV R4,#0
MOV R5,#0
MOV R6,#0
LOOP: ACALL DISP
SJMP LOOP
TIMERI: INC R2
CJNE R2 ,#200 ,EXT
MOV R2 ,#0
INC R3
CJNE R3 ,#40 ,EXT
MOV R3 ,#0
INC R4
CJNE R4 ,#60,EXT
MOV R4 ,#0
INC R5
CJNE R5 ,#60 ,EXT
MOV R5 ,#0
INC R6
CJNE R6 ,#24 ,EXT
MOV R6,#0
EXT: RETI
INT1: CLR TR0
MOV R4 ,#00H

ACALL KEY
SETB TR0
RETI
KEY: ACALL DISP
JB P1.0 ,KEY1
JNB P1.0,$
INC R6
CJNE R6 ,#24 ,KEY
MOV R6 ,#0
SJMP KEY

KEY1: JB P1.1 , KEY2
JNB P1.1, $
INC R5
CJNE R5 ,#60 ,KEY
MOV R5 ,#0

SJMP KEY
KEY2: JB P1.2 , KEY
JNB P1.2 ,$

RET
DISP:
MOV DPTR ,#TB
MOV A ,R4
MOV B ,#10
DIV AB
XCH A ,B
MOVC A , @A+DPTR
MOV P0 ,A
MOV P2 ,#00000001B
ACALL TT
XCH A ,B
MOVC A, @A+DPTR
MOV P0 ,A
MOV P2 ,#00000010B
ACALL TT

MOV A ,R5
MOV B ,#10
DIV AB
XCH A ,B
MOVC A,@A+DPTR
ORL A ,#80H
MOV P0 ,A
MOV P2 ,#00000100B
ACALL TT
XCH A ,B
MOVC A ,@A+DPTR
MOV P0 ,A
MOV P2 ,#00001000B
ACALL TT

MOV A ,R6
MOV B ,#10
DIV AB
XCH A ,B
MOVC A,@A+DPTR
ORL A ,#80H
MOV P0 ,A
MOV P2 ,#00010000B
ACALL TT
XCH A ,B
MOVC A ,@A+DPTR
MOV P0 ,A
MOV P2 ,#00100000B
ACALL TT
RET
TT: MOV 70H ,#100
T: MOV 71H ,#40
DJNZ 71H ,$
DJNZ 70H ,T
RET
TB: DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH
51的啊,咋可能没反映,老早以前就写的,肯定可以用。P0,P2显示就可以。