Category:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
0
1
2
3
4
5
6
7
8
9
Position:IcFull.com » IC Electronic information » Category: K

IC Electronic information

Keyboard matrix based on Boolean processing method of interpretation

In Electronic Infomation Category: K | on December 27,2010

Abstract The Boolean processing technology to scan the keyboard matrix interpretation: use of "digital" mode of operation will interpret the whole process of scanning the keyboard matrix down to a series of "bit" of the operation; scan interpretation process does not key terms, there is no key return the corresponding eigenvalue; order to facilitate the circuit board design layout, constitute the input of the keyboard matrix lines can be concentrated in the mouth of the same P, it can be freely distributed in different P mouth. The keyboard matrix scanning simple, efficient, understanding more crisp and IRFP250 datasheet and accurate.

Introduction

traditional types of electronic textbooks and IRFP250 price and professional literature data available, the MCU to do the scanning keyboard matrix interpretation, mostly by line by line by line scan key terms, key features of the corresponding amount of return, look-up table and IRFP250 suppliers and other data-processing approaches to scan interpretation. Have set for this key when seeking to support the value of saving the original value of the row, column values of the buffer registers and so on, some closed to ensure each key only once a MCU processing, tend to run medium-close button in the post-release interpretation of its key before processing. This interpretation is quite the scanning keyboard, CPU time, reducing the CPUs efficiency. This reveals a novel treatment based on Boolean matrix interpretation of the keyboard method. The following combination of icon and to 6 × 5 Interpretation of the keyboard matrix is described.

1 Program Structure

keyboard matrix based on interpretation of Boolean processing methods, that is the interpretation of the keyboard matrix scanning process can be attributed to a series of Boolean "bit" of the operation. Understanding the process of scanning includes the following steps: definition of the flag; keyboard scan matrix output lines; check whether the key is pressed; query key s flag; eliminate jitter delay; query which corresponds to said input port level change; query which corresponds to output port scanning level; which key corresponds to the explanation for the specific treatment; interpret key flag set, the process shown in Figure 1.

2 steps described

2.1 defines the flag

take full advantage of the current bit MCU operation of the internal RAM can be resources to define the use of directive systems involved in the flag. As revealed by directive defines the first write-only files in the source program is not going to produce executable object code and, therefore, the definition of flag "operation" in the program flow diagram of Figure 1 in the no statements.


Figure 1 keyboard matrix scanning program flow diagram

2.2 keyboard matrix output line scan

output line scanning process is also changing the output line-by-line through the port level to achieve, as shown in Figure 2. Input lines are in the high normal state of all ports; output line-by-cycle output low, that is, any time there is only one port outputs low; by pressing the connect button is it possible to pull Low input lines corresponding to the port level.


Figure 2 keyboard matrix circuit

If the system is equipped with digital display circuit the circuit shown in Figure 3. Input lines are usually are in a high state of; output line-by-cycle output is high, after the scan line by inverse components became low; connected by the key pressed, the same low corresponding input port line level. This will scan the keyboard output line a bit with digital display combined scanner, and also be able to save the keyboard scan separately, the keyboard scan into the system scan shows a large loop.


Figure 3 with a digital bit matrix circuit

2.3 determine whether the key Press

whether the key is pressed on the keyboard, by scanning the natural input of a query to determine status. A key is pressed, the keyboard scan input port will be changed accordingly. If the input port shown in Figure 2, is concentrated in the mouth with a Pn (where, n = 0,1,2, ...), it can be used on the mouth of the Pn byte of data to determine whether the press the OK button Activity; they can use in turn the mouth of the several ports Pn.y Pn conducted to determine whether the query bit key is pressed, where, y = 0,1,2,3,4.

If the input is not a centralized, easy to design and messy wiring mouth spread P0, P2 ... ... Pn mouth mouth mouth on such a different P, it can only turn to the port bits of the input change of state to determine whether the query key is pressed. If a key is to check to turn to the interpretation of the keyboard matrix scanning procedure; if no key is pressed, the clear interpretation of a key flag to logic 0, Reading to prepare for the next button.

2.4 Interpretation of query key flag

check check key is pressed first key is the interpretation of the state flag is logic 0 or logic 1; if the description of this logic 0 Interpretation keys had not been by the consumer after the delay jitter on the keyboard matrix for further output, input line query to determine which key, and make the appropriate treatment.

s flag if the key is a logical 1, then the interpretation of this has been a key, no need to waste CPU time for the scanning process directly from the key returned. This enables the key once for each closed, MCU treatment effect only once. Changed the traditional closing time of each order to ensure the keys, MCU processing only once, the program must wait until after the release of its interpretation of key shortcomings.

2.5 eliminate jitter delay

when a key is awareness, the query key s flag to 0 to eliminate jitter delay set and its auxiliary bit flag eliminate delay jitter into treatment. Delay jitter elimination specific to adjustable delay jitter elimination backup procedures; it can draw on the system of counting a large number of cycles or the use of MCU internal timer interrupt latency jitter to achieve the cancellation, and do not set specific time delay procedures CPU-time. End delay jitter elimination eliminate jitter delay flag is cleared and auxiliary spaces.

2.6 query line level input which there is a change

all input ports are usually high, after inquiries by the consumer delay jitter of the input line of the keyboard matrix whether the level is low. If a port has not been pulled down, then this key is invalid (probably some kind of interference caused by the "jitter"), then return directly.

if the order of the query as input Pn.y a port which the port level is low, it indicates that this key is valid, will jump to cross-check with the relevant port line the output line.

2.7 scan lines which output the output active level

Figure 2 shows the keyboard matrix circuit, the output port and input port Pn.y Pm.x directly connected by a key intersection. When the button is pressed the input port which is low level determined, then the jump to check Pm.x (Pm.0, Pm.1, Pm.2, Pm.3, Pm.4, Pm.5 ) six port which the port output low, which in turn determine the specific key is pressed, jump to a few key numbers to explain treatment. Low any time the port scan output only, and only low line scan output port that Pm.x before the mouth of the column input Pn.y low level. At this time, the effective cross the line key is pressed, the column corresponding ports are low.

51 if the use of a typical MCU assembler instruction to write the specific keys to interpret the matrix, then there is:

Key_scan: JNB Pn.y, Key_matrix_j

; when the input port Pn.y (y = 0,1,2,3,4) is pulled low, jump to the Key_matrix_j (j = y)

LJMPReturn < P>; if the port has not been pulled down Pn.y one is returned

Key_matrix_j: JNBPm.x, Key_gloze_i

; When a port is pulled know Pn.y low, then check Pm.x (x = 0,1,2,3,4,5) which port scan to determine the specific output is a low key number i, then jump to Key_gloze_i (i = 1,2 , 3, ..., 29,30) i number of keys to the interpretation of corresponding processing

LJMPReturn

Key_gloze_1: ...; 1 number key to explain treatment

LJMPReturn

Key_gloze_2: ...; 2 number key to explain treatment

LJMPReturn

...

Key_gloze_29: ...; 29 number key to explain treatment < / P>

LJMPReturn

Key_gloze_30: ...; 30 number key to explain treatment

Return: RET; keyboard matrix scanning interpretation of return

< / P>


Figure 4 keyboard matrix scan down the tree

described above assembly language interpretation of the keyboard matrix scanning process with the aid of Figure 4 to more vividly explained. Figure 4 shows, each Pn.y (y = 0,1,2,3,4) port with the Pm.x (x = 0,1,2,3,4,5) of the six ports are associated , and each port line and Pm.x Pn.y 6 port lines are revealing either a line intersects a key (i number), combined with the above procedure, if the input port Pn.0 be pulled down, and is the port Pm.1 valid scan output low, there are (JNBPn.0, Key_matrix_0) instruction to jump to Key_matrix_0, then check the output port (JNBPm.1, Key_gloze_6) jump to Key_gloze_6, that is to be the first query to Pn.0 down and then jump to Key_matrix_0 → Pm.1 scan output query to jump to Key_gloze_6 → revealing low is 6 and given the corresponding key is pressed, the interpretation of treatment. And so on.

If the keyboard matrix circuit shown in Figure 3, the scan output port Pm.x not directly with the input port Pn.y cross, but after a bit drivers for the digital display RP group pieces and then cross into the port Pn.y. To this end, the scan output port is not a low effective, but rather by the inverting output high and then a low level components, the same will be with them through the key input port line low cross. Therefore, the input port in the query shown in Figure 2 are the same, while effective in the query scan output port and Figure 2 is somewhat different.

circuit structure shown in Figure 2, which the query port scan output low, there is:

JNBPm.x, Key_gloze_i;

Figure 3 shows circuit structure is what the query port scan output high level, then:

JBPm.x, Key_gloze_i;

shown in Figure 4, if the input is pulled low Pn.2 , and is valid scan output port Pm.3 high, there was the first query to Pn.2 further inquiries to the Pm.3 low → high → revealing scan output is 18, and given the corresponding key is pressed explanation of treatment. And so on. Jump specific procedure shown in Figure 5, showing the position of the query process is to jump.


Figure 5 keyboard matrix scanning program to jump chart

2.8 implementation of the deal specifically with the corresponding keys

output line is the line for line, with the input line is the intersection of the column line is unique, so to determine which output port to which the input port, will determine Which specific key (i key) is pressed, you can give the key to the interpretation of the corresponding treatment. Throughout the process, which is not necessary to distinguish between the number keys, which is a function key. Interpretation of each key is equivalent, is the number keys to directly give the corresponding numerical processing is a direct function key on the function of the specific interpretation given.

2.9 Interpretation key flag is set

closing time to ensure each key only once MCU processing, interpretation of each key button after the Interpretation will be set to logic 1 flag . Interpretation of the key flag set, each key can be disposed of after the explanation, it can eliminate jitter in the delay after a single general set. Regardless of the number keys, the key interpretation of flag is used in the same.

In fact, the introduction of the key interpretation of flags, not just the control key MCU each time only for a closed deal, but also for those who have control of a lasting bond according to multiple processing (such as used Some data progressive or regressive continuous setting, etc.).

3 Principles Review

this paper, based on interpretation of the Boolean method of dealing with the keyboard matrix. The principle is as follows:

in the keyboard matrix scan, first check whether the key pressed. If no key press, the clear interpretation of the first flag to return keys; if key is pressed, then re-check flag is the key to interpretation of logic 0 or logic 1. If it is logic 1, indicating that the interpretation of this key has been, can be scanned directly from the key handler to return; If it is logic 0, indicating that interpretation of this key has not been, delay jitter cancellation is enabled. Delay jitter elimination after inquiries by the keyboard matrix input lines are pulled down each port is. If a port has not been pulled down, then this key is invalid, it may be some disturbance caused by the "jitter" from the key scan process immediately returned; if the query to one of the port level is low , and it indicates that this keyboard is effective, will jump queries that intersect with them effective output scan lines, and to determine specifically which key is pressed, and explain the jump to give the corresponding treatment. Explain the treatment, the home key s flag to logic 1 and then return to complete the interpretation of a keyboard matrix scan.

no matter how many keys the keyboard matrix, the scan button to set a specific total number of queries required for S-bit will not be greater than the number of rows and columns x and y of; but less than 2 times that 2 ≤ S ≤ x + y. If the above 6 × 5 matrix, up to the total number of queries required to place S = 5 +6 = 11. 30 key is pressed when the first query to the last one Pn.4 port level is low, then jump to the effective query is the last line of Pm.5 scan output port; but at least the total number of queries required to place S = 1 + 1 = 2. When the 1st key is pressed, the first query to a Pn.0 port level is low, then jump out a query to the effective scanning line 1 Pm.0 port.

Conclusion

Boolean bit operation processing using the keyboard matrix interpretation, applicable to all MCU-based intelligent instrument in the interpretation of the keyboard matrix. The use of Boolean bit operation, has changed the traditional approach with the data bytes. Understanding the process of scanning, there is no key terms, no keys to return the corresponding eigenvalue, but also save the time for finding the key to support preservation of the original value row value, column value of the buffer register, etc., there are only bits of action queries. Constitute the input of the keyboard matrix lines can be continuous, it can be discontinuous. When the circuit design layout, which facilitate a port which port to use for keyboard matrix input lines. In other words, input line can be freely distributed in different P mouth, this flexible and convenient way is the traditional way of dealing with the key can not reach; but also changed the traditional closing time to ensure that each key is only treated as one MCU , to wait until after the release of its key key to explain handling practices. The keyboard matrix scan seems simple, efficient, interpretation of the keyboard matrix is more crisp, accurate.

IRFP250 datasheetIRFP250 suppliersIRFP250 Price

Related technical information

All right reserved:icfull.com © 2010-2016 Certificate