发表于:2009/5/7 22:50:29
#0楼
ORG 000H
LJMP MAIN
ORG 0003H
LJMP TT0
ORG 0030H
MAIN: MOV SP,#60H
MOV IE,#81H
MOV IP,#01H
MOV TCON,#00H
ZUOYI1: MOV R3,#8
MOV A,#0FEH
ZUOYI: MOV P1,A
RL A
LCALL DISPLAY
DJNZ R3,ZUOYI
RR A
MOV R2,#8
YOUYI: MOV P1,A
RR A
LCALL DISPLAY
DJNZ R2, YOUYI
LJMP ZUOYI1
TT0: PUSH ACC
PUSH PSW
MOV A,#11H
MOV R7,#5
SHANSHUO: MOV P1,A
LCALL DISPLAY
LCALL SHANSHUO1
SHANSHUO1: MOV A,#00H
MOV P1,A
LCALL DISPLAY
DJNZ R7, SHANSHUO
POP PSW
POP ACC
RETI
DISPLAY: MOV R4,#4
DE1: LCALL DISPLAY1
DJNZ R4,DE1
RET
DISPLAY1: MOV R5,#00
MOV R6,#00
DE2: DJNZ R6,$
DJNZ R5,DE2
RET
END
这段代码要表达的意思是P1口的8个发光二极管左移,右移,有中断时8个二极管闪烁共10次
现在运行时能左移右移但不能闪烁,一直亮直到延时时间到
这中间的TT0写成下面这样中断之后P1口发光二极管任不能闪烁
TT0: PUSH ACC
PUSH PSW
MOV A,#11H
MOV R7,#10
SHANSHUO: MOV P1,A
CPL A
LCALL DISPLAY
DJNZ R7, SHANSHUO
POP PSW
POP ACC
RETI
LJMP MAIN
ORG 0003H
LJMP TT0
ORG 0030H
MAIN: MOV SP,#60H
MOV IE,#81H
MOV IP,#01H
MOV TCON,#00H
ZUOYI1: MOV R3,#8
MOV A,#0FEH
ZUOYI: MOV P1,A
RL A
LCALL DISPLAY
DJNZ R3,ZUOYI
RR A
MOV R2,#8
YOUYI: MOV P1,A
RR A
LCALL DISPLAY
DJNZ R2, YOUYI
LJMP ZUOYI1
TT0: PUSH ACC
PUSH PSW
MOV A,#11H
MOV R7,#5
SHANSHUO: MOV P1,A
LCALL DISPLAY
LCALL SHANSHUO1
SHANSHUO1: MOV A,#00H
MOV P1,A
LCALL DISPLAY
DJNZ R7, SHANSHUO
POP PSW
POP ACC
RETI
DISPLAY: MOV R4,#4
DE1: LCALL DISPLAY1
DJNZ R4,DE1
RET
DISPLAY1: MOV R5,#00
MOV R6,#00
DE2: DJNZ R6,$
DJNZ R5,DE2
RET
END
这段代码要表达的意思是P1口的8个发光二极管左移,右移,有中断时8个二极管闪烁共10次
现在运行时能左移右移但不能闪烁,一直亮直到延时时间到
这中间的TT0写成下面这样中断之后P1口发光二极管任不能闪烁
TT0: PUSH ACC
PUSH PSW
MOV A,#11H
MOV R7,#10
SHANSHUO: MOV P1,A
CPL A
LCALL DISPLAY
DJNZ R7, SHANSHUO
POP PSW
POP ACC
RETI