51 Matrix Matrix Keyboard Driver Implementation

Use this matrix keyboard to input MCU and insert P1.0~P1.6 of P1 port.

What I want to ask is when:

Press the P0.0 output of port 1 P0 high;

Press the 2 key P0.1 output high;

......

It's up to 8 keys.

There is also a requirement that when a key is pressed, it is delayed by 5 seconds and the other keys are locked, and after 5 seconds, it is returned to the starting point. Assembly language

;================================================= ====

As follows:

ORG 0000H

START:

MOV P0, #255

MOV P1, #255

CLR P1.0

NOP

JNB P1.4, K1

JNB P1.5, K2

JNB P1.6, K3

MOV P1, #255

CLR P1.1

NOP

JNB P1.4, K4

JNB P1.5, K5

JNB P1.6, K6

MOV P1, #255

CLR P1.2

NOP

JNB P1.4, K7

JNB P1.5, K8

JNB P1.6, K9

SJMP START

K1: CLR P0.0

SJMP DELAY

K2: CLR P0.1

SJMP DELAY

K3: CLR P0.2

SJMP DELAY

K4: CLR P0.3

SJMP DELAY

K5: CLR P0.4

SJMP DELAY

K6: CLR P0.5

SJMP DELAY

K7: CLR P0.6

SJMP DELAY

K8: CLR P0.7

DELAY:

MOV R5, #10

DJNZ R7, $

DJNZ R6, $ - 2

DJNZ R5, $-4

LJMP START

END

If you need to press the button to control the high level, change the CLR in the above program to SETB.

Then put: MOV P0, #255

Changed to: MOV P0, #0

Commercial Switches

Managed Switches,Cctv Ip System Switch,10 Ports Managed Industrial Switch,12 Port Industrial Ethernet Switch

Shenzhen Scodeno Technology Co.,Ltd , https://www.scodenonet.com

Posted on