哦,又麻烦各位老兄帮我看看.程序是这样工作的,如果不要按下按钮每个功能都是重复几下就自动转到下一个功能去,但是按下按钮后就暂停了. 我的源程序是这样的如下 ,麻烦各位老兄帮我看我哪里不对了呢, 谢谢
ORG 0000H
AJMP AAQQ
ORG 0030H
AAQQ: MOV R1,#1
JMP MAINAA
ANA: MOV P3,#0FFH ;按键扫描子程序
MOV A,#0FFH
MOV P3,A
MOV A,P3
CJNE A,#0FFH,AWW
jmp A7
AWW: ACALL DEL10MS
CJNE A,#0FFH,AW
JMP A7
AW: POP ACC
POP ACC
INC R1
A1: CJNE R1,#2,A3
LJMP MAIN2 ;转功能2
A3: CJNE R2,#3,A4
LJMP MAIN3 ;转功能3
A4: CJNE R2,#4,A5
LJMP DISA ;转功能4
A5: CJNE R2,#5,A6
LJMP DIS11 ; 转功能5
A6: CJNE R2,#6,A7
MOV R1,#1
LJMP DIS1 ;转功能6
A7: RET
MAINAA: MOV R0,#0
MAINA: MOV P1,#7FH ;功能一(涨潮退潮)
ACALL DEL
call ana
MOV P1,#3FH
ACALL DEL
MOV P1,#1FH
ACALL DEL
call ana
MOV P1,#0FH
ACALL DEL
MOV P1,#7H
ACALL DEL
call ana
MOV P1,#3H
ACALL DEL
MOV P1,#1H
ACALL DEL
call ana
MOV P1,#00H
ACALL DEL
MOV P0,#0FEH
ACALL DEL
call ana
MOV P0,#0FCH
ACALL DEL
MOV P0,#0F8H
ACALL DEL
call ana
MOV P0,#0F0H
ACALL DEL
MOV P0,#0E0H
ACALL DEL
call ana
MOV P0,#0C0H
ACALL DEL
MOV P0,#80H
ACALL DEL
call ana
MOV P0,#00H
ACALL DEL
MOV P2,#7FH
ACALL DEL
call ana
MOV P2,#3FH
ACALL DEL
MOV P2,#1FH
ACALL DEL
call ana
MOV P2,#0FH
ACALL DEL
MOV P2,#7H
ACALL DEL
call ana
MOV P2,#3H
ACALL DEL
MOV P2,#1H
ACALL DEL
call ana
MOV P2,#00H
ACALL DEL;
ACALL DEL
call ana
MOV P2,#01H
ACALL DEL
MOV P2,#3H
ACALL DEL
call ana
MOV P2,#7H
ACALL DEL
MOV P2,#0FH
ACALL DEL
call ana
MOV P2,#1FH
ACALL DEL
MOV P2,#3FH
ACALL DEL
call ana
MOV P2,#7FH
ACALL DEL
MOV P2,#0FFH
ACALL DEL
call ana
ACALL DEL
MOV P0,#80H
ACALL DEL
call ana
MOV P0,#0C0H
ACALL DEL
MOV P0,#0E0H
ACALL DEL
call ana
MOV P0,#0F0H
ACALL DEL
MOV P0,#0F8H
ACALL DEL
call ana
MOV P0,#0FCH
ACALL DEL
MOV P0,#0FEH
ACALL DEL
call ana
MOV P0,#0FFH
ACALL DEL;
MOV P1,#00H
ACALL DEL
call ana
MOV P1,#1H
ACALL DEL
MOV P1,#3H
ACALL DEL
call ana
MOV P1,#7H
ACALL DEL
MOV P1,#0FH
ACALL DEL
call ana
MOV P1,#1FH
ACALL DEL
MOV P1,#3FH
ACALL DEL
call ana
MOV P1,#7FH
MOV P2,#0FFH
MOV P0,#0FFH
ACALL DEL
MOV P1,#0FFH
MOV P2,#0FFH
MOV P0,#0FFH
ACALL DELA
INC R0
call ANA
CJNE R1,#2,Q1
AJMP MAINA
Q1: CJNE R0,#6,QQ
JMP MAIN22
QQ: AJMP MAINA
MAIN22: MOV R0,#0 ;第二功能(同时亮灭)
MAIN2: MOV P1,#00H MOV P2,#00H
MOV P0,#00H
ACALL DELA
Lcall ana
MOV P1,#0FFH
MOV P2,#0FFH
MOV P0,#0FFH
ACALL DELA
Lcall ana
INC R0
CJNE R1,#3,Q2
JMP MAIN2
Q2: CJNE R0,#26,MAIN2
MOV R0,#0
MAIN3: MOV P1,#00H ;第三功能(交替亮灭)
MOV P2,#00H
MOV P0,#0FFH
ACALL DELAA
call ana
MOV P0,#00H
MOV P1,#0FFH
MOV P2,#0FFH
ACALL DELAA
CALL ANA
CJNE R1,#4,Q3
JMP MAIN3
Q3: CJNE R0,#16,MAIN3
MOV R0,#0
MOV P1,#0FFH
MOV P2,#0FFH
MOV P0,#0FFH
ACALL DELA
Lcall ana
DISA: MOV P1,#6DH ;第四功能(隔灯追逐)
MOV P2,#0DBH
MOV P0,#0B6H
ACALL DEL
Lcall ana
MOV P1,#0B6H
MOV P2,#06DH
MOV P0,#06DH
ACALL DEL
Lcall ana
MOV P1,#0DBH
MOV P2,#0B6H
MOV P0,#0DBH
ACALL DELA
Lcall ana
MOV P1,#0FFH
MOV P2,#0FFH
INC R0
call ana
CJNE R1,#5,Q4
LJMP DISA
Q4: CJNE R0,#15,DISA
NOP
MOV P1,#0FFH
MOV P2,#0FFH
MOV P0,#0FFH
MOV R0,#0
DIS11: MOV P1,#0FEH; 第五功能(单灯绕圈----慢)
ACALL DEL
MOV P1,#0FDH
ACALL DEL
Lcall ana
MOV P1,#0FBH
ACALL DEL
MOV P1,#0F7H
ACALL DEL
Lcall ana
MOV P1,#0EFH
ACALL DEL
MOV P1,#0DFH
ACALL DEL
Lcall ana
MOV P1,#0BFH
ACALL DEL
MOV P1,#7FH
ACALL DEL
Lcall ana
MOV P1,#0FFH
DIS21:
MOV P2,#0FEH
ACALL DEL
MOV P2,#0FDH
ACALL DEL
Lcall ana
MOV P2,#0FBH
ACALL DEL
MOV P2,#0F7H
ACALL DEL
Lcall ana
MOV P2,#0EFH
ACALL DEL
MOV P2,#0DFH
ACALL DEL
Lcall ana
MOV P2,#0BFH
ACALL DEL
MOV P2,#7FH
ACALL DEL
Lcall ana
DIS01: MOV P2,#0FFH
MOV P0,#7FH
ACALL DEL
MOV P0,#0BFH
ACALL DEL
Lcall ana
MOV P0,#0DFH
ACALL DEL
MOV P0,#0EFH
ACALL DEL
Lcall ana
MOV P0,#0F7H
ACALL DEL
MOV P0,#0FBH
ACALL DEL
Lcall ana
MOV P0,#0FDH
ACALL DEL
MOV P0,#0FEH
ACALL DEL
Lcall ana
MOV P0,#0FFH
ACALL DELA
INC R0
Lcall ana
CJNE R1,#6,QQQ
QA: AJMP DIS11
QQQ: CJNE R0,#12,QA
MOV R0,#0
DIS1: MOV P1,#0FEH; 第六功能(单灯绕圈----快)
ACALL DELQ
MOV P1,#0FDH
ACALL DELQ
call ana
MOV P1,#0FBH
ACALL DELQ
MOV P1,#0F7H
ACALL DELQ
call ana
MOV P1,#0EFH
ACALL DELQ
MOV P1,#0DFH
ACALL DELQ
call ana
MOV P1,#0BFH
ACALL DELQ
MOV P1,#7FH
ACALL DELQ
call ana
DIS2: MOV P1,#0FFH
MOV P2,#0FEH
ACALL DELQ
call ana
MOV P2,#0FDH
ACALL DELQ
MOV P2,#0FBH
ACALL DELQ
call ana
MOV P2,#0F7H
ACALL DELQ
MOV P2,#0EFH
ACALL DELQ
call ana
MOV P2,#0DFH
ACALL DELQ
MOV P2,#0BFH
ACALL DELQ
call ana
MOV P2,#7FH
ACALL DELQ
call ana
DIS0: MOV P2,#0FFH
MOV P0,#7FH
ACALL DELQ
MOV P0,#0BFH
ACALL DELQ
call ana
MOV P0,#0DFH
ACALL DELQ
MOV P0,#0EFH
ACALL DELQ
call ana
MOV P0,#0F7H
ACALL DELQ
MOV P0,#0FBH
ACALL DELQ
call ana
MOV P0,#0FDH
ACALL DELQ
MOV P0,#0FEH
ACALL DELQ
call ana
MOV P0,#0FFH
ACALL DELA
INC R0
call ana
CJNE R1,#7,QQQQQ
GD: JMP DIS1
QQQQQ: CJNE R0,#15,GD
AJMP MAINAA
DELA: MOV R7,#01H ;以下是延时子程序
DELA1: MOV R6,#0AFH
DELA2: MOV R5,#0FFH
DELA3: DJNZ R5,DELA3
DJNZ R6,DELA2
DJNZ R7,DELA1
RET
DEL: MOV R7,#01H
DEL1: MOV R6,#0AFH
DEL2: MOV R5,#0FFH
DEL3: DJNZ R5,DEL3
DJNZ R6,DEL2
DJNZ R7,DEL1
RET
DELAA: MOV R7,#02H
DELAA1: MOV R6,#0AFH
DELAA2: MOV R5,#0FFH
DELAA3: DJNZ R5,DELAA3
DJNZ R6,DELAA2
DJNZ R7,DELAA1
INC R0
RET
DELAAA: MOV R7,#2FH
DELAA1A: MOV R6,#0FFH
DELAA2A: MOV R5,#0FFH
DELAA3A: DJNZ R5,DELAA3A
DJNZ R6,DELAA2A
DJNZ R7,DELAA1A
INC R0
RET
DELQ: MOV R7,#01H
DEL1Q: MOV R6,#1FH
DEL2Q: MOV R5,#9FH
DEL3Q: DJNZ R5,DEL3Q
DJNZ R6,DEL2Q
DJNZ R7,DEL1Q
RET
DEL10MS: MOV R7,#0FFH
DEL11: MOV R6,#0FFH
DEL22: DJNZ R6,DEL22
DJNZ R7,DEL10MS
RET
END