MOV TH0,A ;将数据高位送TH0 INC TEMP MOV A,TEMP MOVC A,@A+DPTR MOV STL0,A
MOV TL0,A ;将数据低位送TH0 SETB TR0 ;启动定时器T0 DK3A: MOV A,P3 ANL A,#0FH XRL A,#0FH JNZ DK3A
CLR TR0 ;NOKEY3: MOV P3,#0FFH ; CLR P3.7 ; MOV A,P3 ANL A,#0FH XRL A,#0FH JZ NOKEY4
LCALL DELY10MS ; MOV A,P3 ANL A,#0FH XRL A,#0FH JZ NOKEY4 MOV A,P3 ANL A,#0FH CJNE A,#0EH,NK13 MOV KEYBUF,#12 LJMP DK4
NK13: CJNE A,#0DH,NK14 ; K13 MOV KEYBUF,#13 LJMP DK4
NK14: CJNE A,#0BH,NK15 ;K14 MOV KEYBUF,#14 LJMP DK4
关闭定时器T0
设置P3口为输入模式 清0 P3.7,按键的第四行扫描延时10ms 键按下 键按下