Matrix keyboard detection and the difference between independent keys

This time I went on to say the last time and talk about composite buttons and matrix keyboards.

Let's talk about the matrix keyboard first, because I write the combination key code is written on the basis of the matrix keyboard, of course, write a combination key on a separate key is more simple. So when your matrix keyboard's key combination is written, your key combination on the individual keys will also be written.

The detection of the matrix keyboard is quite different from the individual keys, but the essence is still the same.

Take a look at the schematic of the matrix keyboard:

Matrix keyboard schematic

Since the two ports of each key in the matrix keyboard are connected to the IO port, we must control the MCU to add different levels at each end of each independent button in the software.

[Note]: The independent button is very simple and it is grounded directly at one end.

It can be seen from the above schematic diagram that the high-order four-bit control row and the fourth-bit control column of P1 port; so we can write P1 = 0X0F or write P1 = 0XF0, so that we can add on each independent key. Different levels.

Code writing process and independent keys, the first step is to detect the key press, according to the schematic above, the matrix keyboard detects whether the key is pressed as long as the value assigned to the P1 port 0X0F, and then detect whether the P1 port value is still 0X0F .

After the elimination of the jitter, the method of eliminating the jitter is still the same, the delay can be a period of time, as shown in the figure:

MCU matrix keyboard eliminates jitter

After that, it is determined which button is pressed.

Note: The complexity of matrix keyboards is complicated here.

There are two ways to determine which button is pressed in the end:

1, progressive scan

The progressive scan means to scan which button in the first row is pressed. If the second row is not scanned again, see if a key in the second row is pressed, if the pressed one is not found yet. Press the key, then continue to scan the third and fourth lines to know which key was found. This code is relatively simple to implement, and this scanning method is not very common and inefficient, so I will not write it here.

2, row scanning

Row scanning refers to scanning all rows first, determining which row of keys are pressed, and then scanning all columns to find out which column has the key pressed, so that only two scans can be determined Which button was pressed.

The specific code is implemented as follows:

1, line scan:

SCM matrix keyboard line scan

2, column scan:

Microcontroller Matrix Keyboard Column Scan

Finally do not forget to release the key detection:

Microcontroller matrix keyboard key release detection

This matrix keyboard's writing is complete, the following combination of keys, write the seventh article when I gave it a name for the composite button, and now I feel not very good, or call combination keys.

The key combination means that when you hold down one key and press another key at the same time, there will be different effects. For example: Ctrl + C is a copy, Shift + number keys can knock out special characters and so on.

The code writing idea is: When holding down the first button, as long as the button is not released, it can detect the button that can be combined with it, and achieve different effects according to different combinations of buttons.

code show as below:

Microcontroller Matrix Keyboard Combination Keys

We look at the code carefully to understand.

Cassette Type PLC Splitter

PLC splitter is a type of optical power management device that is fabricated using silica optical waveguide technology. It features small size, high reliability, wide operating wavelength range and good channel-to channel uniformity, and is widely used in PON networks to realize optical signal power splitting.


Bwinners provides whole series of 1×N and 2×N splitter products that are tailored for specific applications. All products meet GR-1209-CORE and GR-1221-CORE requirements. Fiber Optic Splitter Plc, Fiber Optic Cable Splitter, Optical Splitter, Mini Type Plc Splitter, Cassette Type Plc Splitter, Insertion Module Plc are available.


Features:

Low insertion loss and low PDL
Various coupling ratio
Environment stable
Single mode and multimode available
High Reliability and Stability
High Channel counts
Wide wavelength range
Customized packaging and configuration


Applications:
FTTx Construction

Fiber Optical communication system

Fiber Optical access networks

Fiber Sensor
Fiber CATV networks
Local area networks

Cassette Fiber Plc Splitter,Gpon Splitter Cassette,Plc Splitter Cassette Box,Optical Splitter Cassette Type

Sijee Optical Communication Technology Co.,Ltd , https://www.sijee-optical.com