89C51单片机9个按键的行列式键盘输入电路
扫描二维码
随时随地手机看文章
若行线为P1.0~P1.2,列线为P1.5~P1.7,试画出只有9个按键的行列式键盘输入电路,并编写按键扫描程序
图片1
KEY:MOVP1,#11100000B
MOVA,P1
CPLA
ANLA,#111000000B
JZGORET
KEY1:JBP1.5,KEY2
MOV30H,#00H
KEY2:JBP1.6,KEY3
MOV30H,#01H
KEY3:JBP1.7,GORET
MOV31H,#02H
KEY4:MOVP1,#00000111B
MOVA,P1
CPLA
ANLA,#00000111B
JZGORET
JBP1.0,KEY5
MOVA,30H
KEY5:JBP1.1,KEY6
MOVA,#3
ADDA,30H
KEY6:JBP1.2,GORET
MOVA,#6
ADDA,30H
KEY7:ADDA,#4
MOVDPTR,#TAB
JMP@A+DPTR
TAB:LCALLWORK0
RET
LCALLWORK1
RET
LCALLWORK2
RET
LCALLWORK3
RET
LCALLWORK4
RET
LCALLWORK5
RET
LCALLWORK6
RET
LCALLWORK7
RET
LCALLWORK8
GORET:RET