发表于:2010/11/16 15:45:36
#0楼
哪位高手能帮忙改个程序?
ORG 0000H
AJMP MAIN
ORG 0003H
AJMP LOP
ORG 0013H
AJMP LOP1
MAIN:MOV P1,#3FH
MOV P2,#3FH
MOV IP,#0E4H
SETB EA
SETB EX0
SETB EX1
AJMP $
LOP:MOV R2,#6H
MOV P1,#3FH
MOV R3,#0H
MOV R4,#1H
LOOP2:MOV R1,#0AH
MOV DPTR,#TAB
LOOP:MOV A,R3
MOVC A,@A+DPTR
MOV P2,A
LCALL DELAY
INC DPTR
DJNZ R1,LOOP
MOV DPTR,#TAB1
LOOP1:MOV A,R4
MOVC A,@A+DPTR
MOV P1,A
INC DPTR
INC R4
DJNZ R2,LOOP2
MOV P1,#7DH
MOV P2,#3FH
LCALL DELAY
AJMP LOP
RETI
LOP1:AJMP $
RETI
DELAY : MOV R5,#10
DEY1:MOV R6,#200
DEY2:MOV R7,#250
DEY3:DJNZ R7,$
DJNZ R6,DEY2
DJNZ R5,DEY1
RET
TAB:DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH
TAB1:DB 3FH,06H,5BH,4FH,66H,6DH
END
我想更改此程序功能从59倒计时到0,按下开关1中断停止,按下开关2重新计时。电路如下图所示:
ORG 0000H
AJMP MAIN
ORG 0003H
AJMP LOP
ORG 0013H
AJMP LOP1
MAIN:MOV P1,#3FH
MOV P2,#3FH
MOV IP,#0E4H
SETB EA
SETB EX0
SETB EX1
AJMP $
LOP:MOV R2,#6H
MOV P1,#3FH
MOV R3,#0H
MOV R4,#1H
LOOP2:MOV R1,#0AH
MOV DPTR,#TAB
LOOP:MOV A,R3
MOVC A,@A+DPTR
MOV P2,A
LCALL DELAY
INC DPTR
DJNZ R1,LOOP
MOV DPTR,#TAB1
LOOP1:MOV A,R4
MOVC A,@A+DPTR
MOV P1,A
INC DPTR
INC R4
DJNZ R2,LOOP2
MOV P1,#7DH
MOV P2,#3FH
LCALL DELAY
AJMP LOP
RETI
LOP1:AJMP $
RETI
DELAY : MOV R5,#10
DEY1:MOV R6,#200
DEY2:MOV R7,#250
DEY3:DJNZ R7,$
DJNZ R6,DEY2
DJNZ R5,DEY1
RET
TAB:DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH
TAB1:DB 3FH,06H,5BH,4FH,66H,6DH
END
我想更改此程序功能从59倒计时到0,按下开关1中断停止,按下开关2重新计时。电路如下图所示: