本设计已通过多次调试,很好用!
OK EQU 20H
RING EQU 22H
ORG 0000H
LJMP MAIN
ORG 0003H
LJMP INTER0
ORG 000BH
LJMP TIMER0
;ORG 0013H
;LJMP INT1
ORG 001BH
LJMP TIMER1
ORG 0030H
MAIN: MOV R1,#30
MOV R2,#60
MOV TMOD,#11H
MOV TH0,#0F0H
MOV TL0,#0FFH
MOV TH1,#3CH
MOV TL1,#0B0H
SETB EA
SETB ET0
SETB ET1
SETB EX0
SETB EX1
CLR OK
CLR RING
SETB TR1
SETB TR1
TIMER0: MOV TH0,#0ECH
MOV TL0,#0FFH
JNB RING,OUT
CPL P3.6
OUT: RETI
TIMER1: MOV TH1,#3CH
MOV TL1,#0B0H
INC R0
RETI
L0: MOV P1,#0FFH
MOV A,P1
CJNE A,#0FEH,L1
ACALL TRUE1
L1: MOV P1,#0FFH
MOV A,P1
CJNE A,#0FDH,L2
ACALL TRUE2
L2: MOV P1,#0FFH
MOV A,P1
CJNE A,#0FCH,$+3
ACALL TRUE3
TRUE1: MOV A,R2 ;ACALL BARK
MOV R6,A
MOV R3,#01H
CLR OK
ACALL TIMER1
TRUE2: MOV A,R2 ;ACALL BARK
MOV R6,A
MOV R3,#01H
CLR OK
AJMP TIMER1
TRUE3: MOV A,R2; ACALL BARK
MOV R6,A
MOV R3,#01H
CLR OK
AJMP TIMER1
DISPLAY:MOV DPTR, #DATA1
MOV A,R3
MOVC A,@A+DPTR
MOV P2,#0FEH
MOV P0,A
ACALL DELAY
MOV DPTR,#DATA2
MOV A,R5
MOVC A,@A+DPTR
MOV P2,#0FDH
MOV P0,A
ACALL DELAY
MOV A,R4
MOVC A,@A+DPTR
MOV P2,#0FBH
MOV P0,A
ACALL DELAY
INC R3
RET
DELAY:MOV R7,#50
DEL1: MOV R6,#91
DEL2: MOV R5,#100
DJNZ R5,$
DJNZ R6,DEL2
DJNZ R7,DEL1
RET
INTER0:
DATA1: DB 00H,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH,00H,71H
DATA2: DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH,00H,71H
END
2021-06-30 13:21:39
518KB
三路抢答器
1