Classic case sharing: comparative analysis of two keyboard scanning methods

Speaking of keyboard scanning, I believe that the first reaction of most people is the matrix matrix scanning, so that we can get as many buttons as possible with a relatively limited IO port. Keyboard scanning is a basic processing method of single-chip technology. The single-chip computer courses in the school will have corresponding chapters to elaborate. As long as the methods described in the textbook are used, generally more reliable keyboard scanning circuits and programs can be designed.

The keyboard scanning method on the textbook (see the following figure 2) can not be said to be perfect, comprehensively from the aspects of easy-to-understand, cost, and difficulty of the program, it should be a good method, giving the impression that there is not much improvement. Space, at least I think so.

However, some time ago, a keyboard scan matrix circuit drawn by a Taiwanese friend (see Figure 2 below) allowed me to see my own thinking and there are still many places that are bound by my so-called "experience".

From the hardware connection, there is no obvious difference between the two methods. The connection method is even more complicated. However, if you combine the program of keyboard scanning, you will find that the connection method is really better.

I didn't include the pull-up resistors for the two connections, let's see what the difference between the two connections is:

Connection 2:

The conventional sweep key processing circuit that we are familiar with assumes that the keyboard row and column IO port numbers are H1/H2/H3 and V1/V2/V3, respectively, and the sweep key process is generally as follows.

2.1. H1 is set to output, H2/H3 and V1/V2/V3 are set to input

2.2. H1 outputs 1 and 0 respectively, and reads the V1/V2/V3 state. If the Vy state is consistent with H1, the key of the intersection of H1 and Vy is considered to be pressed.

2.3. H2 is set to output, H1/H3 and V1/V2/V3 are set as inputs

2.4. H2 outputs 1 and 0 respectively, and reads the V1/V2/V3 state. If the Vy state is consistent with H2, the key of the intersection of H2 and Vy is considered to be pressed.

2.5. H3 is set to output, H1/H2 and V1/V2/V3 are set as inputs

2.6. H3 outputs 1 and 0 respectively, and reads the V1/V2/V3 state. If the Vy state is consistent with H3, the key of the intersection of H3 and Vy is considered to be pressed.

Connection one:

The new scan key processing circuit assumes that the keyboard row and column IO port numbers are H1/H2/H3 and V1/V2/V3, respectively, and the keystroke process is generally as follows.

1.1. H1/H2/H3 and V1/V2/V3 are both set to input

1.2. Read the H1/H2/H3 and V1/V2/V3 states. If the states read by Hx and Vy are both 0, the key of the intersection of Hx and Vy is considered to be pressed.

From the above process, it can be seen that the program code of the first method is much simpler, which can reduce the amount of code of the scan key and speed up the time of the scan key processing. It is better to stand from the software point of view than the second method. Later, I reflected on why the traditional processing methods in our textbooks did not use the connection method. Although the software is simpler, the hardware layout is complicated. The traditional buttons only have two wires. The connection method requires three wires. Therefore, the traditional buttons can not be achieved, but now many electronic products are made of conductive rubber or pots, so the connection becomes feasible.

Note: These two circuits may form incorrect button logic for the case where three buttons are simultaneously pressed.

Butterfly Valves

Butterfly valves can be used to control the flow of air, water, steam, various corrosive media, mud, oil, liquid metal, radioactive media and other types of fluids.

The butterfly valve is a kind of regulating valve with simple structure, which can be used for the switching control of medium in low pressure pipeline. It mainly plays the role of cutting off and throttling on the pipeline. The butterfly valve opening and closing piece is a disc shaped butterfly plate, which rotates around its own axis in the valve body to achieve the purpose of opening and closing or adjustment.

Common parameters of butterfly valve:

Valve body material: stainless steel, carbon steel, cast iron, alloy

Shape: square, round
Bonnet: customizable
Stem: customizable

Nominal pressure (MPa): 0.25
Test pressure (MPa): 0.4
Sealing test: 0.275
Working pressure (MPa): 0.25
Applicable medium: non corrosive saturated water vapor
Applicable temperature ℃: ≤ 120 and ≤ 200
Flange connection size standard: DN80 DN100 DN120 DN160 DN200

Oil valves,Transformer Butterfly Valve,Transformer Valve,Round Cast Iron Butterfly Valve

Henan New Electric Power Co.,Ltd. , https://www.newelectricpower.com

This entry was posted in on