设计按键
时间:10-02
整理:3721RD
点击:
怎么用按键控制这个程序
用汇编怎么写程序,要一按按键,就则行这个程序。
ORG 0000H
SJMP MAIN
ORG 0040H
MAIN : MOV R2,#00H
MOV R3,#24H
LP1 : MOV A,R2
MOV DPTR,#TAB1
MOVC A,@A+DPTR
MOV P1,A
INC R2
CALL D200ms
DJNZ R3,LP1
MOV R4,#00H
LP2 : MOV A,R4
MOV R5,#20H
MOV DPTR,#TAB2
MOVC A,@A+DPTR
MOV P1,A
INC R4
CALL D200ms
DJNZ R5,LP2
TAB1 : DB 0FFH,7FH,0BFH,0DFH,0EFH,0F7H,0FBH,0FDH,0FEH,7EH,0BEH,0DEH,0EEH,0F6H,0FAH,0FCH,7CH,0BCH,0DCH,0ECH,0F4H,0F8H,78H,0B8H,0D8H,0E8H,0F0H,70H,0B0H
DB 0D0H,0E0H,60H,0A0H,0C0H,40H,80H,00H
TAB2 : DB 00H,80H,40H,0C0H,0A0H,60H,0E0H,0D0H,0B0H,70H,0F0H,0E8H,0D8H,0B8H,78H,0F8H,0F4H,0ECH,0DCH,0BCH,7CH,0FCH,0FAH,0F6H,0EEH,0DEH,0BEH,7EH,0FEH,0FDH
DB 0FBH,0F7H,0EFH,0DFH,0BFH,7FH,0FFH
D200ms: MOV R6,#20 ;200ms
D10ms : MOV R1,#40 ; 10ms
DL: MOV R7,#123
DJNZ R7,$
DJNZ R1,DL
DJNZ R6,D10ms
RET
END
用汇编怎么写程序,要一按按键,就则行这个程序。
ORG 0000H
SJMP MAIN
ORG 0040H
MAIN : MOV R2,#00H
MOV R3,#24H
LP1 : MOV A,R2
MOV DPTR,#TAB1
MOVC A,@A+DPTR
MOV P1,A
INC R2
CALL D200ms
DJNZ R3,LP1
MOV R4,#00H
LP2 : MOV A,R4
MOV R5,#20H
MOV DPTR,#TAB2
MOVC A,@A+DPTR
MOV P1,A
INC R4
CALL D200ms
DJNZ R5,LP2
TAB1 : DB 0FFH,7FH,0BFH,0DFH,0EFH,0F7H,0FBH,0FDH,0FEH,7EH,0BEH,0DEH,0EEH,0F6H,0FAH,0FCH,7CH,0BCH,0DCH,0ECH,0F4H,0F8H,78H,0B8H,0D8H,0E8H,0F0H,70H,0B0H
DB 0D0H,0E0H,60H,0A0H,0C0H,40H,80H,00H
TAB2 : DB 00H,80H,40H,0C0H,0A0H,60H,0E0H,0D0H,0B0H,70H,0F0H,0E8H,0D8H,0B8H,78H,0F8H,0F4H,0ECH,0DCH,0BCH,7CH,0FCH,0FAH,0F6H,0EEH,0DEH,0BEH,7EH,0FEH,0FDH
DB 0FBH,0F7H,0EFH,0DFH,0BFH,7FH,0FFH
D200ms: MOV R6,#20 ;200ms
D10ms : MOV R1,#40 ; 10ms
DL: MOV R7,#123
DJNZ R7,$
DJNZ R1,DL
DJNZ R6,D10ms
RET
END
很简单,直接按复位键就是了
谢谢啊啊
啊 啊啊啊啊啊啊啊啊啊啊