阵列键盘原理图,源代码以及proteus程序
单片机汇编语言源程序如下:
- ORG 0000H
- START: MOV P3,#00H
- ACALL DAY1S
- MOV P3,#0FFH
- ACALL DAY1S
- MOV P3,#00H
- ACALL DAY1S
- MOV P3,#0FFH
- ACALL DAY1S
- TEST:
- MOV P1,#0F0H
- MOV A,P1
- ANL A,#0FH
- CJNE A, #00H,HAVE
-
- SJMP TEST
- HAVE:
- MOV A,#01H
- NEXT:
- MOV B,A
- MOV P1,A
- READ:
- MOV A,P1
- ANL A,#0F0H
-
- CJNE A,#00H,YES
- MOV A,B
- RL A
- CJNE A,#10H,NEXT
- YES:
- ACALL DAY
- AREAD:
- MOV A,P1
- ANL A,#0F0H
-
- MOV R2,A
- MOV A, B
- ANL A,#0FH
- ORL A,R2
- YES1:
- MOV B,A
- LJMP AJM
- AJM:
- MOV R1,#00H
- AJM1: MOV DPTR,#BTNTAB
- MOV A, R1
- MOVC A, @A+DPTR
- CJNE A,B,NEXTKEY
- MOV DPTR,#LEDTAB
- MOV A,R1
- MOVC A,@A+DPTR
- MOV P3,A
- LJMP TEST
- NEXTKEY:
- INC R1
- CJNE R1,#10H,AJM1
- LJMP TEST
-
- DAY: MOV R6,#20
- DL2: MOV R7,#7DH
- DL1: NOP;
- NOP;
- DJNZ R7,DL1
- DJNZ R6,DL2
- RET
- DAY1S: MOV R0,#32H
- DAY1S1:
- ACALL DAY
- DJNZ R0,DAY1S1
- RET
- BTNTAB: DB 11H,21H,41H,81H
- DB 12H,22H,42H,82H
- DB 14H,24H,44H,84H
- DB 18H,28H,48H,88H
- LEDTAB: DB 0C0H,0F9H,0A4H,0B0H, 99H, 92H, 82H,0F8H
- DB 80H, 90H, 88H, 83H, 0C6H,0A1H, 86H,8EH,0FFH
- END
复制代码
所有资料51hei提供下载:
阵列键盘完成版.zip
(47.64 KB, 下载次数: 14)
|