3x3 matrix keyboard scanning principle and scanning program

Introduction to the 3x3 matrix keyboard

Matrix keyboard, 3×3 matrix keyboard, digital tube display corresponding button, dynamic scanning, interrupt implementation.

3x3 matrix keyboard scanning principle and scanning program

The pull-up resistor attribute should be set to “digital”.

3x3 matrix keyboard scanning principle and scanning program

The 9 buttons are arranged in 3 rows and 3 columns. The first row connects one end of each button to form a row line, and the first column connects the other ends of each button to form a column line, so that there are 3 rows and 3 There are a total of 6 lines. We connect these six lines to the 6 IO ports of the STM32. The program scans the keyboard to detect 9 keys.

Regardless of the stand-alone keyboard or the matrix keyboard, the principle that the MCU detects whether it is pressed is the same, that is, whether the I/O port corresponding to the key is low. The independent button has one end fixed to a low level, and the MCU write program is more convenient to detect. Both ends of the matrix keyboard are connected to the I/O port of the MCU. Therefore, it is necessary to manually send a low level through the I/O port of the MCU during the detection. When detecting, first send a column low, the other columns are high (we determine the number of columns at this time), and then immediately detect whether each row has a low level, if a certain behavior is detected low ( At this point we have determined the number of rows), then we can confirm which row of the row is currently pressed, use the same method to send each column a low level, and then poll once to see if each row becomes low. Flat, so that all the buttons can be detected. Of course, we can also set the row line low and scan the column for low level. This is the detection principle and method of the matrix keyboard.

3x3 matrix keyboard scanning principle and scanning program

SETB P1.0; first of all, set one first

SETB P1.1

SETB P1.2

SETB P1.3

SETB P1.4

SETB P1.5

KEY: CLR P1.0; the line is cleared

CLR P1.1 CLR P1.2

JNB P1.3, KEY0; determine if there is a button press

JNB P1.4, KEY0

JNB P1.5, KEY0

SJMP KEY; no button presses back to KEY to continue to check if there is a button press

KEY0: LCALL DELAY ; call delay function

CLR P1.0; P1.0 is cleared, P1.1, P1.2 are set to one

SETB P1.1

SETB P1.2

JNB P1.3, KEY1; P1.3 is zero, then the button is pressed, jump to the button KEY1

JNB P1.4, KEY2

JNB P1.5, KEY3

SETB P1.0; P1.1 is cleared, P1.0, P1.2 is set to CLR P1.1

SETB P1.2

JNB P1.3, KEY4

JNB P1.4, KEY5

JNB P1.5, KEY6

SETB P1.0; P1.2 is cleared, P1.0, P1.1 are set to one

SETB P1.1

CLR P1.2

JNB P1.3, KEY7

JNB P1.4, KEY8

JNB P1.5, KEY9

SJMP KEY; if there is no button press, jump back to the button query program

KEY1: LCALL PRO1; call subroutine of button one

LJMP KEY; return to continue to query whether the button is pressed

KEY2: LCALL PRO2

LJMP KEY

KEY3: LCALL PRO3

LJMP KEY

KEY4: LCALL PRO4

LJMP KEY

KEY5: LCALL PRO5

LJMP KEY

KEY6: LCALL PRO6

LJMP KEY

KEY7: LCALL PRO7

LJMP KEY

KEY8: LCALL PRO8

LJMP KEY

KEY9: LCALL PRO9

LJMP KEY

PRO1: . ; button one processing subroutine

RET ; subroutine return

PRO2:

. RET

PRO3:

RET

PRO4:

RET

PRO5:

RET

PRO6:

RET

PRO7:

RET

PRO8:

RET

PRO9:

RET

Feeder Parts

SMT Feeder types,

1. different smt machines with different smt feeders, but different model of the same brand machine can use the same feeder,like Panasonic Feeder.


2. Base on the size and types of components, smt feeder could be divided into three types : Tube feeder; Tray Feeder; Bulk Feeder.
Tape feeders with the different size such as 8mm, 16mm, 24mm, 32mm, 44mm, 56mm etc.


3. Base on the feeder condition, smt feeder also could be divided into four types: original new SMT feeder parts, used original SMT feeder parts, imitation/copy new SMT feeder parts, imitation/copy used SMT feeder parts,



Original feeder is made by original smt machine production manufacturers. Due to the large demand for smt feeder, currently there are many copy new feeders parts. Our feeders quality is also very great and looking forward to your cooperation!

Feeder Parts,Smt Feeder Parts,Panasonic Feeder Parts,Parts For Panasonic Feeder

Shenzhen Keith Electronic Equipment Co., Ltd. , https://www.aismtks.com