独立式按键显示键号
ORG 0000H
SJMP START
ORG 000BH
CPL P3.7
MOV TH0, 30H
MOV TL0, 31H
RETI
START:
INC TMOD
MOV IE, #82H
M_LOOP:
CLR A
JNB P1.0, K0
JNB P1.1, K1
JNB P1.2, K2
JNB P1.3, K3
JNB P1.4, K4
JNB P1.5, K5
JNB P1.6, K6
JNB P1.7, K7
SJMP M_LOOP
K7: INC A
K6: INC A
K5: INC A
K4: INC A
K3: INC A
K2: INC A
K1: INC A
K0: CLR TR0
PUSH ACC
ADD A, #(D - $ - 2)
MOVC A, @A + PC
MOV P0, A
POP ACC
RL A
PUSH ACC
ADD A, #(M - $ - 3)
MOVC A, @A + PC
MOV 30H, A
MOV TH0, A
POP ACC
ADD A, #(M - $ - 2)
MOVC A, @A + PC
MOV 31H, A
MOV TL0, A
SETB TR0
SJMP M_LOOP
M: DW 64580, 64684, 64777, 64820, 64898, 64968, 65030, 65058
D: DB 0C0H,0F9H,0A4H,0B0H, 99H, 92H, 82H,0F8H, 80H, 90H
END
|