JZ NOKEY2 MOV A,P3 ANL A,#0FH CJNE A,#0EH,NK5 MOV KEYBUF,#4 LJMP DK2
NK5: CJNE A,#0DH,NK6 ;K5键按下 MOV KEYBUF,#5 LJMP DK2
NK6: CJNE A,#0BH,NK7 ;K6键按下 MOV KEYBUF,#6 LJMP DK2
NK7: CJNE A,#07H,NK8 ;K7键按下 MOV KEYBUF,#7 LJMP DK2 NK8: NOP DK2: MOV A,KEYBUF
MOV B,#2
MUL AB ;因为查表里都是字,所以乘2的查表数据
MOV TEMP,A
MOV DPTR,#TABLE ; 指向表头 MOVC A,@A+DPTR ; 查表 MOV STH0,A ;
MOV TH0,A ;将数据高位送TH0 INC TEMP MOV A,TEMP MOVC A,@A+DPTR MOV STL0,A
MOV TL0,A ;将数据低位送TH0 SETB TR0 ;启动定时器T0 DK2A: MOV A,P3 ANL A,#0FH XRL A,#0FH JNZ DK2A
;K8键按下