89C51单片机9个按键的行列式键盘输入电路

若行线为P1.0~P1.2,列线为P1.5~P1.7,试画出只有9个按键的行列式键盘输入电路,并编写按键扫描程序
 
图片1
KEY: MOV P1,#11100000B
MOV A,P1
CPL A
ANL A,#111000000B
JZ GORET
KEY1: JB P1.5,KEY2
MOV 30H,#00H
KEY2: JB P1.6,KEY3
MOV 30H,#01H
KEY3: JB P1.7,GORET
MOV 31H,#02H
KEY4: MOV P1,#00000111B
MOV A,P1
CPL A
ANL A,#00000111B
JZ GORET
JB P1.0,KEY5
MOV A,30H
KEY5: JB P1.1,KEY6
MOV A,#3
ADD A,30H
KEY6: JB P1.2,GORET
MOV A,#6
ADD A,30H
KEY7: ADD A,#4
MOV DPTR,#TAB
JMP @A+DPTR
TAB: LCALL WORK0
RET
LCALL WORK1
RET
LCALL WORK2
RET
LCALL WORK3
RET
LCALL WORK4
RET
LCALL WORK5
RET
LCALL WORK6
RET
LCALL WORK7
RET
LCALL WORK8
【89C51单片机9个按键的行列式键盘输入电路】GORET: RET

    推荐阅读