|
ORG 0000H
SJMP MAIN
ORG 0003H
SJMP ZZ
ORG 0013H
SJMP FZ
ORG 0030H
MAIN:
CLR IT0 ;开中断 INT0, INT1
CLR IT1
SETB EX0
SETB EX1
SETB EA
MOV A,#00000001B ;流水灯
LL:
RL A
MOV P1,A
ACALL DELAY1
SJMP LL
ZZ:
MOV R3,#0FFH
LOOP1: JNB p3.0,ZZT
INC R3
MOV A,R3
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P1,A
LCALL DELAY
CJNE A,#06H,LOOP1
FZ: ;反转
MOV R4,#0FFH
LOOP2:
INC R4
MOV A,R4
MOV DPTR,#TAB1
MOVC A,@A+DPTR
MOV P1,A
LCALL DELAY
CJNE A,#03H,LOOP2
TAB: DB 03h,09h,0ch,06h
TAB1: DB 06h,0Ch,09h,03h
DELAY: MOV R5,#50 ;延时步进电机
D3: MOV R2,#25
DJNZ R2,$
DJNZ R5,D3
RET
DELAY1: MOV R3,#20 ; 延时0.2秒流水灯延时
D1: MOV R4,#20
D2: MOV R5,#248
DJNZ R5,$
DJNZ R4,D2
DJNZ R3,D1
RET
END
试了很多方法都无法跳回主函数 请专家帮忙
|
|