TWI487279B - Scanning circuit for keyboard and method and electronic device using the same - Google Patents

Scanning circuit for keyboard and method and electronic device using the same Download PDF

Info

Publication number
TWI487279B
TWI487279B TW098143999A TW98143999A TWI487279B TW I487279 B TWI487279 B TW I487279B TW 098143999 A TW098143999 A TW 098143999A TW 98143999 A TW98143999 A TW 98143999A TW I487279 B TWI487279 B TW I487279B
Authority
TW
Taiwan
Prior art keywords
column
input
electrically connected
button
level state
Prior art date
Application number
TW098143999A
Other languages
Chinese (zh)
Other versions
TW201123719A (en
Inventor
ren-wen Huang
Jun Zhang
Lin-Kun Ding
Tsung Jen Chuang
Original Assignee
Hon Hai Prec Ind Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hon Hai Prec Ind Co Ltd filed Critical Hon Hai Prec Ind Co Ltd
Priority to TW098143999A priority Critical patent/TWI487279B/en
Publication of TW201123719A publication Critical patent/TW201123719A/en
Application granted granted Critical
Publication of TWI487279B publication Critical patent/TWI487279B/en

Links

Landscapes

  • Input From Keyboards Or The Like (AREA)

Description

鍵盤掃描電路和方法及電子設備Keyboard scanning circuit and method and electronic device

本發明涉及一種電子設備,特別涉及一種鍵盤掃描電路及方法。The present invention relates to an electronic device, and more particularly to a keyboard scanning circuit and method.

鍵盤是電腦、PDA(個人數位助理)、移動電話等電子產品中主要的人機對話輸入設備。鍵盤藉由內部的矩陣掃描電路對鍵盤上的按鍵進行掃描,從而確定按鍵的位置。現有矩陣鍵盤掃描電路大多使用單片機I/O埠來進行鍵盤掃描。隨著電子產品功能的增加,要完成複雜多樣的控制功能,需要鍵盤提供足夠的按鍵。由於按鍵的增加常會導致用於進行鍵盤掃描的I/O埠的增加,例如有N*M個按鍵,就需要N+M個I/O埠,這樣就導致鍵盤掃描電路佔用過多的I/O埠資源,從而增加鍵盤的成本。The keyboard is the main human-machine dialogue input device in electronic products such as computers, PDAs (personal digital assistants), and mobile phones. The keyboard scans the keys on the keyboard by an internal matrix scanning circuit to determine the position of the keys. Most existing matrix keyboard scanning circuits use a single-chip I/O port for keyboard scanning. As the functionality of electronic products increases, to complete complex and diverse control functions, the keyboard needs to provide enough keys. Since the increase of the button often leads to an increase in the I/O埠 for keyboard scanning, for example, N*M buttons require N+M I/O埠, which causes the keyboard scanning circuit to take up too much I/O.埠 Resources, which increases the cost of the keyboard.

有鑒於此,有必要提供一種用少量的I/O埠實現多按鍵之鍵盤掃描電路。In view of this, it is necessary to provide a keyboard scanning circuit that implements a multi-button with a small amount of I/O 。.

此外,還有必要提供一種鍵盤掃描方法以及一種採用該鍵盤掃描電路之電子設備。In addition, it is also necessary to provide a keyboard scanning method and an electronic device using the keyboard scanning circuit.

一種鍵盤掃描電路,用於與一具有複數輸入輸出埠的控制器相連,該鍵盤掃描電路包括N條行線、M條列線、M-2個單向導通開關管、M-2個第一電阻、及一個第二電阻,其中N為自然數,M為大於或等於3的自然數。該N條行線分別與該控制器的N個輸入埠電性連接。該M條列線中的第一條列線一端可藉由N個按鍵與N條行線電性連接,另一端接地。該M條列線中的第M條列線一端可藉由N個按鍵與N條行線電性連接,同時還與M-2個單嚮導通開關管的第一端電性連接,另一端藉由第二電阻接地。該M條列線中的其餘M-2條列線一端可藉由N個按鍵與N條行線電性連接,同時還分別與M-2個單嚮導通開關管的第二端電性連接,並分別藉由M-2個第一電阻與一電源電性連接,另一端與該控制器的M-2個輸出埠電性連接。該單嚮導通開關管在其第一端電壓小於第二端電壓時導通。A keyboard scanning circuit is connected to a controller having a plurality of input and output ports, the keyboard scanning circuit comprising N row lines, M column lines, M-2 single-conducting switch tubes, M-2 first a resistor, and a second resistor, wherein N is a natural number and M is a natural number greater than or equal to 3. The N row lines are electrically connected to the N inputs of the controller. One end of the first one of the M column lines can be electrically connected to the N row lines by N buttons, and the other end is grounded. One end of the Mth column line of the M column line can be electrically connected to the N line lines by N buttons, and is also electrically connected to the first end of the M-2 single-conducting switch tubes, and the other end is electrically connected. Grounded by a second resistor. One of the remaining M-2 column lines of the M column lines can be electrically connected to the N line lines through N buttons, and is also electrically connected to the second ends of the M-2 single-conducting switch tubes respectively. And electrically connected to a power source by M-2 first resistors, and the other end is electrically connected to M-2 outputs of the controller. The one-way switch is turned on when the voltage of the first terminal is lower than the voltage of the second terminal.

一種應用於鍵盤掃描電路的鍵盤掃描方法,藉由設置輸出埠的電平狀態來進行每一列的掃描,讀取輸入埠的電平狀態,進而判斷鍵盤按鍵,包括以下步驟:A keyboard scanning method applied to a keyboard scanning circuit, which performs scanning of each column by setting the level state of the output port, reads the level state of the input port, and further determines the keyboard button, and includes the following steps:

讀取該N個輸入埠的初始電平狀態;Reading the initial level state of the N input ports;

設置M-2個輸出埠均為高電平,再次讀取N個輸入埠的電平狀態;Set M-2 outputs to be high level, and read the level state of N input ports again;

判斷該N個輸入埠是否有電平狀態發生變化;Determining whether the N input 有 has a level state change;

若發生變化,記錄變化的輸入埠並確定被按下的按鍵位於第一列,且為與變化的輸入埠對應的按鍵;If there is a change, record the changed input 埠 and determine that the pressed button is in the first column and is the button corresponding to the changed input ;;

若未發生變化,設置M-2個輸出埠中的第i個輸出埠為低電平,並保持其他輸出埠為高電平不變,再次讀取N個輸入埠的電平狀態,其中i為2到M-2間的自然數;If there is no change, set the ith output M of M-2 output 埠 to low level, and keep the other output 埠 high level, and read the level state of N input 再次 again, where i a natural number between 2 and M-2;

判斷該N個輸入埠是否有電平狀態發生變化;Determining whether the N input 有 has a level state change;

若發生變化,記錄變化的輸入埠並判斷是否第一列的按鍵被按下,若不是,確定被按下的按鍵位於第i列,且為與變化的輸入埠對應的按鍵;If there is a change, record the changed input 埠 and determine whether the button of the first column is pressed, if not, determine that the pressed button is located in the ith column, and is the button corresponding to the changed input ;;

若未發生變化,設置M-2個輸出埠為低電平,再次讀取N個輸入埠的電平狀態;If there is no change, set M-2 output 埠 to low level, and read the level state of N input 再次 again;

判斷該N個輸入埠是否有電平狀態發生變化;Determining whether the N input 有 has a level state change;

若發生變化,記錄變化的輸入埠,並判斷是否為第一列的按鍵被按下,若不是,確定被按下的按鍵位於第M列,且為與變化的輸入埠對應的按鍵。If there is a change, record the changed input 埠 and determine if the button in the first column is pressed. If not, it is determined that the pressed button is in the Mth column and is the button corresponding to the changed input 埠.

一種電子設備,包括一控制器、複數按鍵及一鍵盤掃描電路,該控制器包括N個輸入埠及M個輸出埠,該鍵盤掃描電路包括N條行線、M條列線、M-2個單嚮導通開關管、M-2個第一電阻、及一個第二電阻,其中N為自然數,M為大於或等於3的自然數;該N條行線與該M條列線以陣列形式排列,形成N*M交叉點;該複數按鍵設置於該N*M交叉點上,其一端與對應行線電性連接,另一端與對應列線電性連接;該N條行線分別與該控制器的N個輸入埠電性連接;該M條列線中的第一條列線一端藉由相應按鍵與對應行線電性連接,另一端接地;該M條列線中的第M條列線一端藉由相應按鍵與對應行線電性連接,同時還與M-2個單嚮導通開關管的第一端電性連接,另一端藉由第二電阻接地;該M條列線中的其餘M-2條列線一端藉由相應按鍵與對應行線電性連接,同時還分別與M-2個單嚮導通開關管的第二端電性連接,並分別藉由M-2個第一電阻與一電源電性連接,另一端與該控制器的M-2個輸出埠電性連接;該單嚮導通開關管在其第一端電壓小於第二端電壓時導通。An electronic device includes a controller, a plurality of buttons, and a keyboard scanning circuit. The controller includes N input ports and M output ports. The keyboard scanning circuit includes N row lines, M column lines, and M-2 a single-conducting switch, M-2 first resistors, and a second resistor, wherein N is a natural number and M is a natural number greater than or equal to 3; the N row lines and the M column lines are in an array Arranging to form an N*M intersection; the plurality of buttons are disposed on the N*M intersection, one end of which is electrically connected to the corresponding row line, and the other end is electrically connected to the corresponding column line; the N row lines respectively The N inputs of the controller are electrically connected; one end of the first column line of the M column lines is electrically connected to the corresponding row line by a corresponding button, and the other end is grounded; the Mth line of the M column lines One end of the column line is electrically connected to the corresponding row line by corresponding buttons, and is also electrically connected to the first end of the M-2 single-conducting switch tubes, and the other end is grounded by the second resistor; the M columns are in the line One of the remaining M-2 line lines is electrically connected to the corresponding line by the corresponding button, and is also separately connected with M-2. The second end of the switch is electrically connected, and is electrically connected to a power source by M-2 first resistors, and the other end is electrically connected to M-2 outputs of the controller; the single-conducting switch The tube is turned on when its first terminal voltage is less than the second terminal voltage.

採用上述鍵盤掃描電路利用N個輸入埠實現掃描N*M個按鍵,減少了鍵盤對輸入埠資源的佔用,並且實現了複數按鍵的掃描。同時,藉由一種該掃描電路採用的掃描方法。The above keyboard scanning circuit realizes scanning N*M keys by using N input ports, which reduces the occupation of the input resources by the keyboard, and realizes scanning of the plurality of keys. At the same time, a scanning method employed by the scanning circuit is used.

請參閱圖1,其為一種較佳實施方式的鍵盤掃描電路200的電路圖。該鍵盤掃描電路200可利用一控制器10,例如單片機的N個輸入埠K1 ~Kn 、M-2個輸出埠W2~W(m-1)對N*M個按鍵S1-1 ~Sn-m 進行掃描識別。Please refer to FIG. 1, which is a circuit diagram of a keyboard scanning circuit 200 of a preferred embodiment. The keyboard scanning circuit 200 can utilize a controller 10, such as N inputs 埠K 1 ~K n of the single chip microcomputer, M-2 outputs 埠W2~W(m-1), and N*M buttons S 1-1 ~ S nm is scanned for recognition.

該鍵盤掃描電路200包括N條行線L1~Ln、M條列線P1~Pm、M-2個二極體D2 ~Dm-1 、M-2個第一電阻R2~R(m-1)及一個第二電阻Rs,其中N為自然數,M為大於或等於3的自然數。M條列線與N條行線交錯排列,形成N*M個交叉點。N*M個交叉點分別對應放置該N*M個按鍵S1-1 ~Sn-m 。N*M個按鍵S1-1 ~Sn-m 的一端分別與對應行線電性連接,另一端分別與對應的列線電性連接。在本實施方式中,N個輸入埠K1~Kn及M-2個輸出埠W2~W(m-1)為一控制器10上的輸入輸出埠,藉由控制器10可設定輸入輸出埠W2~W(m-1)的電平狀態。The keyboard scanning circuit 200 includes N row lines L1~Ln, M column lines P1~Pm, M-2 diodes D 2 ~D m-1 , M-2 first resistors R2~R(m- 1) and a second resistor Rs, where N is a natural number and M is a natural number greater than or equal to 3. The M column lines are alternately arranged with the N line lines to form N*M intersections. The N*M intersections respectively place the N*M buttons S 1-1 ~S nm . One end of the N*M buttons S 1-1 ~S nm is electrically connected to the corresponding row line, and the other end is electrically connected to the corresponding column line. In the present embodiment, the N inputs 1K1~Kn and the M-2 outputs 埠W2~W(m-1) are input/output ports 一 on the controller 10, and the controller 10 can set the input/output 埠W2. The level state of ~W(m-1).

第一條列線P1一端藉由N個按鍵S1-1 ~Sn-1 與N條行線L1~Ln連接,另一端接地。第M條列線的一端藉由N個按鍵S1-m ~Sn-m 與N條行線L1~Ln連接,同時還與M-2個二極體D2 ~Dm-1 的陰極電性連接,另一端藉由第二電阻Rs接地。其餘M-2條列線P2~P(m-1)的一端分別藉由藉由N個按鍵與N條行線L1~Ln連接,同時還分別與M-2個二極體D2 ~Dm-1 的陽極電性連接,並藉由第一電阻R2~R(m-1)與一電壓源Vcc電性連接。其餘M-2條列線P2~P(m-1)的另一端與輸出埠W2~W(m-1)電性連接。One end of the first column line P1 is connected to the N row lines L1 to Ln by N buttons S 1-1 to Sn -1 , and the other end is grounded. One end of the Mth column line is connected to the N row lines L1~Ln by N buttons S 1-m ~S nm , and also with the cathode electrical properties of M-2 diodes D 2 ~D m-1 Connected, the other end is grounded by the second resistor Rs. One end of the remaining M-2 column lines P2~P(m-1) is connected to the N line lines L1~Ln by N buttons, and also respectively with M-2 diodes D 2 ~D The anode of m-1 is electrically connected, and is electrically connected to a voltage source Vcc by the first resistors R2 R R(m-1). The other ends of the remaining M-2 column lines P2~P(m-1) are electrically connected to the output ports W2~W(m-1).

第一電阻R2~R(m-1)的阻值相同或相近,且遠小於第二電阻Rs的阻值,以使得第二電阻Rs與一個第一電阻對電壓源Vcc的輸出電壓進行分壓後,第二電阻Rs上的電壓可被控制器10識別為高電平。The resistances of the first resistors R2 R R(m-1) are the same or similar, and are much smaller than the resistance of the second resistor Rs, so that the second resistor Rs and a first resistor divide the output voltage of the voltage source Vcc Thereafter, the voltage on the second resistor Rs can be recognized by the controller 10 as a high level.

二極體D2 ~Dm-1 具有單嚮導通的特點,當輸出埠W2~W(m-1)中至少一個為高電平時,與輸出埠W2~W(m-1)對應的二極體D2 ~Dm-1 導通。由於第一電阻R2~R(m-1)遠小於第二電阻Rs,使得第二電阻Rs兩端的電壓降遠大於第一電阻R2~R(m-1)兩端的電壓降,即控制器10識別第M列按鍵S1-m ~Sn-m 的一端與高電平連接。因此在掃描第一到第M-1列的過程中,排除第M列對輸入埠K1 ~Kn 的影響。The diode D 2 ~D m-1 has a one-way conduction characteristic. When at least one of the outputs 埠W2~W(m-1) is at a high level, the two corresponding to the output 埠W2~W(m-1) The polar body D 2 ~D m-1 is turned on. Since the first resistor R2 R R (m-1) is much smaller than the second resistor Rs, the voltage drop across the second resistor Rs is much larger than the voltage drop across the first resistor R2 R R ( m - 1 ), that is, the controller 10 One end of the M column button S 1-m ~S nm is identified to be connected to a high level. Therefore, in the process of scanning the first to the M-1th columns, the influence of the Mth column on the input 埠K 1 ~K n is excluded.

在執行按鍵掃描程式時,藉由設置輸出埠W2~W(m-1)的電平狀態對鍵盤掃描電路200進行列掃描,同時讀取輸入埠K1 ~Kn 的電平狀態,判斷是否有按鍵按下。為了清楚地描述鍵盤掃描程式,以下該電平狀態的變化均是相對於輸入埠K1 ~Kn 的初始電平狀態而言。首先讀取輸入埠K1 ~Kn 初始電平狀態。然後,掃描第一列:設置輸出埠W2~W(m-1)均為高電平狀態,再次讀取輸入埠K1 ~Kn 的電平狀態,並判斷輸入埠K1 ~Kn 是否有電平狀態發生改變。若發生改變,記錄變化的輸入埠並確定按鍵為第一列按鍵被按下,且為與變化的輸入埠對應的按鍵。When the key scan program is executed, the keyboard scan circuit 200 is subjected to column scan by setting the level state of the output 埠W2~W(m-1), and the level state of the input 埠K 1 to K n is read at the same time, and it is judged whether or not There is a button press. In order to clearly describe the keyboard scanning program, the following changes in the level state are relative to the initial level states of the inputs 埠K 1 to K n . First, the initial level state of the input 埠K 1 ~K n is read. Then, scan the first column: set the output 埠W2~W(m-1) to the high level state, read the level state of the input 埠K 1 ~K n again, and judge whether the input 埠K 1 ~K n is The level has changed. If a change occurs, record the changed input and determine that the button is pressed for the first column of buttons and is the button corresponding to the changed input 埠.

若未發生變化,依次掃描第二到第M-1列:設置輸出埠W2~W(m-1)中第i個輸出埠為低電平,同時保持其他輸出埠為高電平不變,再次讀取輸入埠K1 ~Kn 的電平狀態。判斷輸入埠K1 ~Kn 是否有電平狀態發生改變。若發生變化,記錄變化的輸入埠並判斷是否第一列的按鍵被按下。判斷是否是第一列的按鍵被按下的方法與掃描第一列的方法相似:將第i個輸出埠切換為高電平,再次讀取輸入埠K1 ~Kn 狀態,其中,i為2到M-1中的自然數。如果輸入埠K1 ~Kn 的電平狀態發生變化,判斷為第一列的按鍵被按下,且為與變化的輸入埠對應的按鍵。如果輸入埠K1 ~Kn 的電平狀態未發生變化,判斷不是第一列的按鍵被按下。若不是第一列的按鍵被按下,確定被按下的按鍵位於第i列,且為與變化的輸入埠對應的按鍵。If there is no change, scan the second to the M-1th column in turn: set the output 埠W2~W(m-1), the ith output 埠 is low, while keeping the other output 高电平 high level, The level state of the input 埠K 1 ~K n is read again. It is judged whether or not the input 埠K 1 to K n has a level state change. If there is a change, record the changed input and determine if the button in the first column is pressed. The method of determining whether the button of the first column is pressed is similar to the method of scanning the first column: switching the ith output 埠 to a high level, and reading the state of the input 埠K 1 ~K n again, where i is 2 to the natural number in M-1. If the level state of the input 埠K 1 to K n changes, it is determined that the button of the first column is pressed, and is a button corresponding to the changed input 埠. If the level state of the input 埠K 1 ~K n has not changed, it is judged that the key of the first column is not pressed. If the button of the first column is not pressed, it is determined that the pressed button is located in the ith column and is the button corresponding to the changed input 埠.

若未發生變化,掃描第M列:設置輸出埠W2~W(m-1)均為低電平狀態,依次讀取輸入埠K1 ~Kn 的電平狀態。判斷輸入埠K1 ~Kn 是否有電平狀態發生改變。若發生變化,記錄變化的輸入埠,並判斷是否第一到第M-1列的按鍵被按下。其中,判斷是否為第一列的按鍵被按下的方法與上面描述的相同,判斷是否為第二到第M-1列的按鍵被按下的方法與掃描第二到第M-1列的方法相同:依次設置M-2個輸出埠中的一個為低電平,其餘為高電平,如果輸入埠K1 ~Kn 的電平狀態未發生改變,則判斷不是第二列到第M-1列的按鍵被按下,如果在第i個輸出埠為低電平時,輸入埠K1 ~Kn 的電平狀態發生變化,則確定被按下的按鍵位於第i+1列,且為與變化的輸入埠對應的按鍵。若判斷不是,確定被按下的按鍵位於第M列,且為與變化的輸入埠對應的按鍵。If there is no change, scan the Mth column: set the output 埠W2~W(m-1) to the low state, and read the level state of the input 埠K 1 ~K n in turn. It is judged whether or not the input 埠K 1 to K n has a level state change. If there is a change, record the change input 埠 and judge whether the keys of the first to the M-1th column are pressed. Wherein, the method of determining whether the button of the first column is pressed is the same as described above, and determining whether the button of the second to the M-1th column is pressed and scanning the second to the M-1th column The method is the same: one of the M-2 output ports is set to be low level, and the rest is high level. If the level state of the input 埠K 1 ~K n does not change, it is judged that it is not the second column to the Mth. - The button of the -1 column is pressed. If the level of the input 埠K 1 ~K n changes when the ith output 埠 is low, it is determined that the pressed button is located in the (i+1)th column, and The button corresponding to the changed input 埠. If the determination is not, it is determined that the pressed button is located in the Mth column and is the button corresponding to the changed input port.

在實際操作中,由於控制器10的掃描速度非常快,掃描第M列時,可以直接排除第二列到第M-1列的干擾。即:省略判斷是否為第二到第M-1列的按鍵被按下的步驟,在排除不是第一列的按鍵被按下後即可確定被按下的按鍵位於第M列。In actual operation, since the scanning speed of the controller 10 is very fast, when the Mth column is scanned, the interference from the second column to the M-1th column can be directly excluded. That is, the step of judging whether the keys of the second to the M-1th columns are pressed is omitted, and it is determined that the pressed key is located in the Mth column after the button that is not the first column is excluded.

請參閱圖2,其為N=M=4時的一較佳實施例的鍵盤掃描電路201的電路圖。該鍵盤掃描電路201包括4條行線L1~L4、4條列線P1~P4、2個二極體D2 ~D3 、2個第一電阻R2~R3及一個第二電阻Rs。4條列線與4條行線交錯排列,形成4*4個交叉點。4*4個交叉點分別對應放置該4*4個按鍵S1-1 ~S4-4 。4*4個按鍵S1-1 ~S4-4 的一端分別與對應行線電性連接,另一端分別與對應的列線電性連接。在本實施方式中,4個輸入埠K1~K4及2個輸出埠W2~W3為一控制器10上的輸入輸出埠,藉由控制器10可設定輸入輸出埠W2~W3的電平狀態。Please refer to FIG. 2, which is a circuit diagram of a keyboard scanning circuit 201 of a preferred embodiment when N=M=4. The keyboard scanning circuit 201 includes four row lines L1 to L4, four column lines P1 to P4, two diodes D 2 to D 3 , two first resistors R2 to R3 and one second resistor Rs. The four column lines are interleaved with the four line lines to form 4*4 intersections. The 4*4 intersections respectively place the 4*4 buttons S 1-1 ~S 4-4 . One end of the 4*4 buttons S 1-1 ~S 4-4 is electrically connected to the corresponding row line, and the other end is electrically connected to the corresponding column line. In the present embodiment, the four inputs 1K1 to K4 and the two outputs 埠W2 to W3 are input/output ports on the controller 10, and the controller 10 can set the level states of the input/output ports 2W2 to W3.

第一條列線P1一端藉由4個按鍵S1-1 ~S4-1 與N條行線L1~L4連接,另一端接地。第4條列線的一端藉由4個按鍵S1-4 ~S4-4 與N條行線L1~L4連接,同時還與2個二極體D2 ~D3 的陰極電性連接,另一端藉由第二電阻Rs接地。其餘M-2條列線P2~P3的一端分別藉由藉由4個按鍵與4條行線L1~L4連接,同時還分別與2個二極體D2 ~D3 的陽極電性連接,並藉由第一電阻R2~R3與一電壓源Vcc電性連接。其餘2條列線P2~P3的另一端與輸出埠W2~W3電性連接。One end of the first column line P1 is connected to the N line lines L1 to L4 by four buttons S 1-1 to S 4-1 , and the other end is grounded. One end of the fourth column line is connected to the N line lines L1 to L4 by four buttons S 1-4 to S 4-4 , and is also electrically connected to the cathodes of the two diodes D 2 to D 3 . The other end is grounded by a second resistor Rs. One ends of the remaining M-2 column lines P2 to P3 are respectively connected to the four row lines L1 to L4 by four buttons, and are also electrically connected to the anodes of the two diodes D 2 to D 3 respectively. And electrically connected to a voltage source Vcc by the first resistors R2 R R3. The other ends of the remaining two column lines P2 to P3 are electrically connected to the output ports 2W2 to W3.

第一電阻R2~R3的阻值相同或相近,且遠小於第二電阻Rs的阻值,以使得第二電阻Rs與一個第一電阻對電壓源Vcc的輸出電壓進行分壓後,第二電阻Rs上的電壓可被控制器10識別為高電平。The resistances of the first resistors R2 R R3 are the same or similar, and are much smaller than the resistance of the second resistor Rs, so that the second resistor Rs and a first resistor divide the output voltage of the voltage source Vcc, and the second resistor The voltage on Rs can be recognized by controller 10 as being high.

在執行按鍵掃描程式時,如果按鍵S3-3 被按下,其掃描過程為:為了清楚地描述鍵盤掃描程式,以下所述電平狀態的變化均是相對於輸入埠K1 ~K4 的初始電平狀態而言。When the button scanning program is executed, if the button S 3-3 is pressed, the scanning process is: in order to clearly describe the keyboard scanning program, the following level state changes are relative to the input 埠K 1 ~K 4 In terms of the initial level state.

首先讀取輸入埠K1 ~K4 初始電平狀態。然後,掃描第一列:設置輸出埠W2~W3均為高電平狀態,再次讀取輸入埠K1 ~K4 的電平狀態,並判斷輸入埠K1 ~K4 是否有電平狀態發生改變。First, the initial level state of the input 埠K 1 ~K 4 is read. Then, scan the first column: set the output 埠W2~W3 to the high level state, read the level state of the input 埠K 1 ~K 4 again, and judge whether the input 埠K 1 ~K 4 has a level state change.

若輸入埠K1 ~K4 電平狀態未發生變化,掃描第二列:設置輸出埠W2為低電平,同時保持輸出埠W3為高電平不變,再次讀取輸入埠K1 ~K4 的電平狀態。判斷輸入埠K1 ~K4 是否有電平狀態發生改變。If the input 埠K 1 ~K 4 level state has not changed, scan the second column: set the output 埠W2 to the low level, while keeping the output 埠W3 at the high level, read the input 埠K 1 ~K again. The level status of 4 . It is judged whether or not the input 埠K 1 to K 4 has a level state change.

若輸入埠K1 ~K4 電平狀態未發生變化,設置輸出埠W3輸出埠為低電平,同時保持輸出埠W2為高電平不變,再次讀取輸入埠K1 ~K4 的電平狀態。判斷輸入埠K1 ~K4 是否有電平狀態發生改變。若輸入埠K3 的電平狀態發生變化,進一步判斷是否是第一列的按鍵被按下。判斷是否是第一列的按鍵被按下的方法與掃描第一列的方法相似:將輸出埠W3切換為高電平,再次讀取輸入埠K1 ~K4 狀態,若輸入埠K1 ~K4 的電平狀態未發生變化,判斷不是第一列的按鍵被按下。若不是第一列的按鍵被按下,確定被按下的按鍵位於第三列,且為與變化的輸入埠K3 對應的按鍵S3-3 被按下。If the input 埠K 1 ~K 4 level state has not changed, set the output 埠W3 output 埠 to low level, while keeping the output 埠W2 at the high level, read the input 埠K 1 ~K 4 again . Flat state. It is judged whether or not the input 埠K 1 to K 4 has a level state change. If the level state of the input 埠K 3 changes, it is further determined whether the button of the first column is pressed. The method of judging whether the button of the first column is pressed is similar to the method of scanning the first column: switching the output 埠W3 to the high level, and reading the input 埠K 1 ~K 4 state again, if the input 埠K 1 ~ The level state of K 4 has not changed, and it is judged that the button of the first column is not pressed. If the button of the first column is not pressed, it is determined that the pressed button is in the third column, and the button S 3-3 corresponding to the changed input 埠K 3 is pressed.

請參看圖3,其為圖1中鍵盤掃描電路的掃描方法300的流程圖。掃描程式啟動後,控制器10開始對輸入埠K1 ~Kn 進行掃描。Please refer to FIG. 3, which is a flowchart of a scanning method 300 of the keyboard scanning circuit of FIG. 1. After the scanner is started, the controller 10 starts scanning the inputs 1K 1 ~K n .

步驟301,讀取輸入埠K1 ~Kn 的初始電平狀態。為了清楚地描述鍵盤掃描方法300,以下所述電平狀態的變化均是相對於所述初始電平狀態而言。In step 301, the initial level state of the input 埠K 1 ~K n is read. In order to clearly describe the keyboard scanning method 300, the changes in the level states described below are all relative to the initial level state.

步驟302,設置輸出埠W2~W(m-1)均為高電平,再次讀取輸入埠K1 ~Kn 的電平狀態。In step 302, the output 埠W2~W(m-1) is set to a high level, and the level state of the input 埠K 1 ~K n is read again.

步驟303,判斷輸入埠K1 ~Kn 是否有電平狀態發生變化,若無變化,則執行步驟304;若有變化,則執行步驟314。In step 303, it is determined whether the input state 埠K 1 ~K n has a level state change. If there is no change, step 304 is performed; if there is a change, step 314 is performed.

步驟304,設置輸出埠W2~W(m-1)中第i個為低電平,並且保持其他輸出埠狀態為高電平不變,再次讀取輸入埠K1 ~Kn 的電平狀態。i從2~(m-1)依次取值。Step 304, setting the output 埠W2~W(m-1) to the ith state to be the low level, and keeping the other output 埠 state to the high level, and reading the level state of the input 埠K 1 ~K n again. . i takes values from 2 to (m-1) in order.

步驟305判斷輸入埠K1 ~Kn 是否有電平狀態發生變化,若有變化,則執行步驟306;若無變化,則執行步驟308。Step 305 determines whether the input state 埠K 1 ~K n has a level change. If there is a change, step 306 is performed; if there is no change, step 308 is performed.

步驟306,將第i個輸出埠W2~W(m-1)切換為高電平,再次讀取輸入埠K1 ~Kn 的電平狀態。Step 306, the i-th output port W2 ~ W (m-1) is switched to the high level, the input port reads the K ~ K n level state 1 again.

步驟307,判斷輸入埠K1 ~Kn 是否有電平狀態發生變化,若有變化,則執行步驟314;若無變化,則執行步驟315。Step 307, it is determined whether the input state 1K 1 ~ K n has a level state change, if there is a change, step 314 is performed; if there is no change, step 315 is performed.

步驟308,設置輸出埠W2~W(m-1)均為低電平,再次讀取輸入埠K1 ~Kn 的電平狀態。In step 308, the output 埠W2~W(m-1) is set to a low level, and the level state of the input 埠K 1 ~K n is read again.

步驟309,判斷輸入埠K1 ~Kn 是否有電平狀態發生變化,若有變化,則執行步驟310;若無變化,則本次鍵盤掃描結束。In step 309, it is determined whether the input state 埠K 1 ~K n has a level state change. If there is a change, step 310 is performed; if there is no change, the keyboard scan ends.

步驟310,設置輸出埠W2~W(m-1)均為高電平,再次讀取輸入埠K1 ~Kn 的電平狀態。In step 310, the output 埠W2~W(m-1) is set to a high level, and the level state of the input 埠K 1 ~K n is read again.

步驟311,判斷輸入埠K1 ~Kn 是否有電平狀態發生變化,若無變化,則執行步驟312;若有變化,執行步驟314。In step 311, it is determined whether the input state 埠K 1 ~K n has a level state change. If there is no change, step 312 is performed; if there is a change, step 314 is performed.

步驟312,依次將輸出埠W2~W(m-1)切換為高電平,再次讀取輸入埠K1 ~Kn 的電平狀態。Step 312, the output port sequentially W2 ~ W (m-1) is switched to the high level, the input port reads the K ~ K n level state 1 again.

步驟313,判斷輸入埠K1 ~Kn 是否有電平狀態發生變化,若有變化,則執行步驟315;若無變化,執行步驟316。In step 313, it is determined whether the input state 埠K 1 ~K n has a level state change. If there is a change, step 315 is performed; if there is no change, step 316 is performed.

步驟314,記錄變化埠並確定按鍵為第一列,且為與變化埠對應的按鍵被按下。In step 314, the change is recorded and the button is determined to be the first column, and the button corresponding to the change 被 is pressed.

步驟315,記錄變化埠並確定按鍵為低電平輸出埠對應列,且為與變化埠對應的按鍵。In step 315, the change 埠 is recorded and the button is determined to be a low level output 埠 corresponding column, and is a button corresponding to the change 埠.

步驟316,記錄變化埠並確定按鍵為第M列,且為與變化埠對應的按鍵。本次鍵盤掃描結束。In step 316, the change is recorded and the button is determined to be the Mth column, and is the button corresponding to the change 埠. This keyboard scan ends.

在其他實施例中,步驟312~313可省略,步驟311需改為:判斷輸入埠K1 ~Kn 是否有電平狀態發生變化,若無變化,則執行步驟316;若有變化,執行步驟314。In other embodiments, steps 312-313 may be omitted, and step 311 needs to be changed to: determine whether the input 埠K 1 ~K n has a level state change, if there is no change, perform step 316; if there is a change, perform steps 314.

請參看圖4,其為圖2中鍵盤掃描電路的掃描方法400的流程圖。掃描程式啟動後,控制器10開始對輸入埠K1 ~K4 進行掃描。Please refer to FIG. 4, which is a flowchart of a scanning method 400 of the keyboard scanning circuit of FIG. 2. After the scan program starts, the controller 10 starts to scan the input port K 1 ~ K 4.

步驟401,讀取輸入埠K1 ~K4 的初始電平狀態。為了清楚地描述鍵盤掃描方法400,以下所述電平狀態的變化均是相對於所述初始電平狀態而言。In step 401, the initial level state of the input 埠K 1 ~K 4 is read. In order to clearly describe the keyboard scanning method 400, the changes in the level states described below are all relative to the initial level state.

步驟402,設置輸出埠W2~W3均為高電平,再次讀取輸入埠K1 ~K4 的電平狀態。Step 402 sets the output port W2 ~ W3 are high, the input port reads the level state K 1 ~ K 4 again.

步驟403,判斷輸入埠K1 ~K4 是否有電平狀態發生變化,若無變化,則執行步驟404;若有變化,則執行步驟414。In step 403, it is determined whether the input state 埠K 1 ~ K 4 has a level change. If there is no change, step 404 is performed; if there is a change, step 414 is performed.

步驟404,設置輸出埠W2~W3中第i個為低電平,並且保持其他輸出埠狀態為高電平不變,再次讀取輸入埠K1 ~K4 的電平狀態。i從2~3依次取值。In step 404, the ith of the output 埠W2~W3 is set to a low level, and the other output 埠 state is kept at a high level, and the level state of the input 埠K 1 ~K 4 is read again. i takes values from 2 to 3 in order.

步驟405判斷輸入埠K1 ~K4 是否有電平狀態發生變化,若有變化,則執行步驟406;若無變化,則執行步驟408。Step 405 determines whether the input 埠K 1 ~ K 4 has a change in the level state. If there is a change, step 406 is performed; if there is no change, step 408 is performed.

步驟406,將第i個輸出埠W2~W3切換為高電平,再次讀取輸入埠K1 ~K4 的電平狀態。Step 406, the i-th output port W2 ~ W3 is switched to the high level, the input port reads the level state K 1 ~ K 4 again.

步驟407,判斷輸入埠K1 ~K4 是否有電平狀態發生變化,若有變化,則執行步驟414;若無變化,則執行步驟415。In step 407, it is determined whether the input 埠K 1 ~ K 4 has a level change. If there is a change, step 414 is performed; if there is no change, step 415 is performed.

步驟408,設置輸出埠W2~W3均為低電平,再次讀取輸入埠K1 ~K4 的電平狀態。Step 408 sets the output port W2 ~ W3 are low, the input port reads the level state K 1 ~ K 4 again.

步驟409,判斷輸入埠K1 ~K4 是否有電平狀態發生變化,若有變化,則執行步驟410;若無變化,則本次鍵盤掃描結束。In step 409, it is determined whether the input state 埠K 1 ~ K 4 has a level change. If there is a change, step 410 is performed; if there is no change, the keyboard scan ends.

步驟410,設置輸出埠W2~W3均為高電平,再次讀取輸入埠K1 ~K4 的電平狀態。Step 410 sets the output port W2 ~ W3 are high, the input port reads the level state K 1 ~ K 4 again.

步驟411,判斷輸入埠K1 ~K4 是否有電平狀態發生變化,若無變化,則執行步驟412;若有變化,執行步驟414。In step 411, it is determined whether the input state 埠K 1 ~ K 4 has a level change. If there is no change, step 412 is performed; if there is a change, step 414 is performed.

步驟412,依次將輸出埠W2~W3切換為高電平,再次讀取輸入埠K1 ~K4 的電平狀態。Step 412, the output port sequentially W2 ~ W3 is switched to the high level, the input port reads the level state K 1 ~ K 4 again.

步驟413,判斷輸入埠K1 ~K4 是否有電平狀態發生變化,若有變化,則執行步驟415;若無變化,執行步驟416。In step 413, it is determined whether the input state 埠K 1 ~ K 4 has a level change. If there is a change, step 415 is performed; if there is no change, step 416 is performed.

步驟414,記錄變化埠並確定按鍵為第一列,且為與變化埠對應的按鍵被按下。In step 414, the change is recorded and the button is determined to be the first column, and the button corresponding to the change 被 is pressed.

步驟415,記錄變化埠並確定按鍵為低電平輸出埠對應列,且為與變化埠對應的按鍵。In step 415, the change 埠 is recorded and the button is determined to be a low level output 埠 corresponding column, and is a button corresponding to the change 埠.

步驟416,記錄變化埠並確定按鍵為第4列,且為與變化埠對應的按鍵。本次鍵盤掃描結束。At step 416, the change is recorded and the button is determined to be the fourth column and is the button corresponding to the change 埠. This keyboard scan ends.

綜上所述,本發明符合發明專利要件,爰依法提出專利申請。惟,以上所述僅為本發明之較佳實施方式,舉凡熟悉本案技藝之人士,在援依本案創作精神所作之等效修飾或變化,皆應包含於以下之申請專利範圍內。In summary, the present invention complies with the requirements of the invention patent and submits a patent application according to law. The above descriptions are only preferred embodiments of the present invention, and those skilled in the art will be able to include equivalent modifications or variations in the spirit of the present invention.

200‧‧‧鍵盤掃描電路200‧‧‧Keyboard scanning circuit

10‧‧‧控制器10‧‧‧ Controller

K1~Kn‧‧‧輸入埠K 1 ~K n ‧‧‧Input埠

W2~W(m-1)‧‧‧輸出埠W2~W(m-1)‧‧‧ Output埠

S1 - 1~Sn - m‧‧‧按鍵S 1 - 1 ~S n - m ‧‧‧ button

L1~Ln‧‧‧行線L1~Ln‧‧‧ line

P1~Pm‧‧‧列線P1~Pm‧‧‧ line

D2~Dm - 1‧‧‧二極體D 2 ~D m - 1 ‧‧‧ diode

R2~R(m-1)‧‧‧第一電阻R2~R(m-1)‧‧‧first resistance

Rs‧‧‧第二電阻Rs‧‧‧second resistance

Vcc‧‧‧電壓源Vcc‧‧‧ voltage source

201‧‧‧鍵盤掃描電路201‧‧‧Keyboard scanning circuit

K1~K4‧‧‧輸入埠K 1 ~K 4 ‧‧‧Input埠

W2~W3‧‧‧輸出埠W2~W3‧‧‧ Output埠

S1 - 1~S4 - 4‧‧‧按鍵S 1 - 1 ~S 4 - 4 ‧‧‧ button

L1~L4‧‧‧行線L1~L4‧‧‧ line

P1~P4‧‧‧列線P1~P4‧‧‧ column line

D2~D4 - 1‧‧‧二極體D 2 ~D 4 - 1 ‧‧‧ Dipole

R2~R3‧‧‧第一電阻R2~R3‧‧‧First resistance

圖1為一種較佳實施方式之鍵盤掃描電路圖。1 is a circuit diagram of a keyboard scanning circuit of a preferred embodiment.

圖2為輸入埠為4時,一較佳實施方式之鍵盤掃描電路圖。2 is a circuit diagram of a keyboard scanning circuit of a preferred embodiment when the input port is 4.

圖3為圖1中鍵盤掃描電路之掃描方法之流程圖。3 is a flow chart of a scanning method of the keyboard scanning circuit of FIG. 1.

圖4為圖2中鍵盤掃描電路之掃描方法之流程圖。4 is a flow chart of a scanning method of the keyboard scanning circuit of FIG. 2.

200‧‧‧鍵盤掃描電路 200‧‧‧Keyboard scanning circuit

10‧‧‧控制器 10‧‧‧ Controller

K1~Kn‧‧‧輸入埠 K 1 ~K n ‧‧‧Input埠

W2~W(m-1)‧‧‧輸出埠 W2~W(m-1)‧‧‧ Output埠

S1-1~Sn-m‧‧‧按鍵 S 1-1 ~S nm ‧‧‧ button

L1~Ln‧‧‧行線 L1~Ln‧‧‧ line

P1~Pm‧‧‧列線 P1~Pm‧‧‧ line

D2~Dm-1‧‧‧二極體 D 2 ~D m-1 ‧‧‧ Diode

R2~R(m-1)‧‧‧第一電阻 R2~R(m-1)‧‧‧first resistance

Rs‧‧‧第二電阻 Rs‧‧‧second resistance

Vcc‧‧‧電壓源 Vcc‧‧‧ voltage source

Claims (10)

一種鍵盤掃描電路,該鍵盤掃描電路包括N個輸入埠、M-2個輸出埠、N條行線、M條列線、M-2個單嚮導通開關管、M-2個第一電阻、及一個第二電阻,其中N為自然數,M為大於或等於3的自然數;該N條行線分別與N個輸入埠電性連接;該M條列線中的第一條列線一端藉由N個按鍵與N條行線電性連接,另一端接地;該M條列線中的第M條列線一端藉由N個按鍵與該N條行線電性連接,同時還與M-2個單嚮導通開關管的第一端電性連接,另一端藉由第二電阻接地;該M條列線中的其餘M-2條列線的一端藉由該N個按鍵與N條行線電性連接,同時還分別與M-2個單嚮導通開關管的第二端電性連接,並分別藉由該M-2個第一電阻與一電源電性連接,另一端與M-2個輸出埠電性連接;該單嚮導通開關管在第一端電壓小於第二端電壓時導通。A keyboard scanning circuit comprising N input ports, M-2 output ports, N row lines, M column lines, M-2 single-conducting switch tubes, M-2 first resistors, And a second resistor, wherein N is a natural number, and M is a natural number greater than or equal to 3; the N row lines are electrically connected to the N input turns respectively; and the first one of the M column lines is at one end The N terminals are electrically connected to the N row lines, and the other end is grounded. One end of the Mth column line of the M column lines is electrically connected to the N row lines by N buttons, and is also connected with M. - the first end of the two single-conducting switch tubes is electrically connected, and the other end is grounded by a second resistor; one end of the remaining M-2 column lines of the M column lines is by the N buttons and N strips The line is electrically connected, and is also electrically connected to the second end of the M-2 single-conducting switch tubes respectively, and is electrically connected to a power source by the M-2 first resistors, and the other end is connected with M - 2 output electrical connections; the single-conducting switching transistor is turned on when the first terminal voltage is less than the second terminal voltage. 如申請專利範圍第1項所述之鍵盤掃描電路,其中該單嚮導通開關管為二極體,該二極體用於在M-2個輸出埠中至少一個為高電平時,將與第M列連接的按鍵的一端設置為高電平。The keyboard scanning circuit of claim 1, wherein the one-way switching transistor is a diode, and the diode is used when at least one of the M-2 output ports is at a high level One end of the button connected to the M column is set to a high level. 如申請專利範圍第1項所述之鍵盤掃描電路,其中該N條行線和M條列線一一對應且交叉形成N*M交叉點,該N*M個交叉點上放置N*M按鍵,每個按鍵的一端與對應行線電性連接,另一端與對應列線電性連接。The keyboard scanning circuit of claim 1, wherein the N row lines and the M column lines are in one-to-one correspondence and intersect to form an N*M intersection, and the N*M buttons are placed on the N*M intersections. One end of each button is electrically connected to the corresponding row line, and the other end is electrically connected to the corresponding column line. 如申請專利範圍第1項所述之鍵盤掃描電路,其中該M-2個第一電阻的阻值相等,並小於第二電阻的阻值。The keyboard scanning circuit of claim 1, wherein the resistance of the M-2 first resistors is equal and less than the resistance of the second resistor. 一種應用於申請專利範圍第1項所述鍵盤掃描電路之鍵盤掃描方法,該鍵盤掃描方法包括以下步驟:
讀取該N個輸入埠的初始電平狀態;
設置該M-2個輸出埠均為高電平,再次讀取該N個輸入埠的電平狀態;
判斷該N個輸入埠是否有電平狀態發生變化;
若該N個輸入埠的電平狀態發生變化,記錄電平狀態發生變化的輸入埠,並確定被按下的按鍵位於第一列,且為與變化的輸入埠對應的按鍵;
若該N個輸入埠的電平狀態未發生變化,設置M-2個輸出埠中的第i個輸出埠為低電平,並保持其他輸出埠為高電平不變,再次讀取該N個輸入埠的電平狀態,其中i為2到M-2間的自然數;
判斷該N個輸入埠是否有電平狀態發生變化;
若該N個輸入埠的電平狀態發生變化,記錄電平狀態發生變化的輸入埠並判斷是否第一列的按鍵被按下,若不是,確定被按下的按鍵位於第i列,且為與變化的輸入埠對應的按鍵;
若該N個輸入埠的電平狀態未發生變化,設置M-2個輸出埠為低電平,再次讀取該N個輸入埠的電平狀態;
判斷該N個輸入埠是否有電平狀態發生變化;
若該N個輸入埠的電平狀態發生變化,記錄電平狀態發生變化的輸入埠,並判斷是否為第一列的按鍵被按下,若不是,確定被按下的按鍵位於第M列,且為與變化的輸入埠對應的按鍵。
A keyboard scanning method applied to a keyboard scanning circuit according to claim 1 of the patent application, the keyboard scanning method comprising the following steps:
Reading the initial level state of the N input ports;
Setting the M-2 outputs to be high level, and reading the level state of the N input ports again;
Determining whether the N input 有 has a level state change;
If the level state of the N input ports changes, an input port whose level state changes is recorded, and it is determined that the pressed button is located in the first column, and is a button corresponding to the changed input port;
If the level state of the N input ports does not change, set the ith output M of the M-2 output ports to be low level, and keep the other outputs 高电平 high level, and read the N again. The level state of the input 埠, where i is a natural number between 2 and M-2;
Determining whether the N input 有 has a level state change;
If the level state of the N input ports changes, the input level of the level change state is recorded and it is determined whether the button of the first column is pressed. If not, it is determined that the pressed button is located in the ith column, and a button corresponding to the changed input 埠;
If the level state of the N input ports does not change, set M-2 outputs to be low level, and read the level state of the N input ports again;
Determining whether the N input 有 has a level state change;
If the level state of the N input ports changes, an input port whose level state changes is recorded, and it is determined whether the button of the first column is pressed, and if not, it is determined that the pressed button is located in the Mth column. And it is a button corresponding to the changed input 埠.
如申請專利範圍第5項所述之鍵盤掃描方法,其中該判斷是否第一列的按鍵被按下的步驟進一步包括以下步驟:
設置M-2個輸出埠均為高電平,再次讀取該N個輸入埠的狀態;
判斷該N個輸入埠是否有電平狀態發生變化;
若該N個輸入埠的電平狀態未發生改變,記錄電平狀態發生變化輸入埠且確定被按下的按鍵位於第一列,且為與變化的輸入埠對應的按鍵;
若該N個輸入埠的電平狀態發生改變,確定不是第一列的按鍵被按下。
The keyboard scanning method of claim 5, wherein the step of determining whether the button of the first column is pressed further comprises the following steps:
Set M-2 outputs to be high level, and read the state of the N input ports again;
Determining whether the N input 有 has a level state change;
If the level state of the N input ports does not change, the recording level state changes input, and determines that the pressed button is located in the first column and is a button corresponding to the changed input port;
If the level state of the N input ports changes, it is determined that the keys that are not in the first column are pressed.
如申請專利範圍第5項所述之鍵盤掃描方法,其中當設置M-2個輸出埠為低電平、判斷該N個輸入埠的電平狀態有變化、並判斷不是第一列的按鍵被按下時,進一步判斷是否第二到第M-1列的按鍵被按下,若不是,確定被按下的按鍵位於第M列,且為與變化的輸入埠對應的按鍵。The keyboard scanning method according to claim 5, wherein when the M-2 outputs are set to a low level, the level state of the N input ports is determined to be changed, and the keys that are not in the first column are determined to be When pressed, it is further determined whether the keys of the second to the M-1th column are pressed, and if not, it is determined that the pressed key is located in the Mth column and is the key corresponding to the changed input 埠. 如申請專利範圍第7項所述之鍵盤掃描方法,該判斷是否第二到第M-1列的按鍵被按下進一步包括以下步驟:
依次設置M-2個輸出埠中的一個為低電平,其餘為高電平,若若N個輸入埠的電平均為高電平,則判斷不是第二列到第M-1列的按鍵被按下。
According to the keyboard scanning method described in claim 7, the determining whether the buttons of the second to the M-1th columns are pressed further comprises the following steps:
One of the M-2 output ports is set to a low level in turn, and the rest is a high level. If the levels of the N input ports are both high, it is determined that the buttons are not in the second column to the M-1 column. Was pressed.
一種電子設備,包括一控制器、複數按鍵及一鍵盤掃描電路,該控制器包括N個輸入埠及M個輸出埠,其特徵在於:該鍵盤掃描電路包括N條行線、M條列線、M-2個單嚮導通開關管、M-2個第一電阻、及一個第二電阻,其中N為自然數,M為大於或等於3的自然數;該N條行線與該M條列線以陣列形式排列,形成N*M交叉點;該複數按鍵設置於該N*M交叉點上,其一端與對應行線電性連接,另一端與對應列線電性連接;該N條行線分別與該控制器的N個輸入埠電性連接;該M條列線中的第一條列線一端藉由相應按鍵與對應行線電性連接,另一端接地;該M條列線中的第M條列線一端藉由相應按鍵與對應行線電性連接,同時還與M-2個單嚮導通開關管的第一端電性連接,另一端藉由第二電阻接地;該M條列線中的其餘M-2條列線一端藉由相應按鍵與對應行線電性連接,同時還分別與M-2個單嚮導通開關管的第二端電性連接,並分別藉由M-2個第一電阻與一電源電性連接,另一端與該控制器的M-2個輸出埠電性連接;該單嚮導通開關管在第一端電壓小於第二端電壓時導通。An electronic device includes a controller, a plurality of buttons, and a keyboard scanning circuit. The controller includes N input ports and M output ports, wherein the keyboard scanning circuit includes N row lines and M column lines. M-2 single-conducting switch tubes, M-2 first resistors, and a second resistor, wherein N is a natural number, M is a natural number greater than or equal to 3; the N row lines and the M columns The lines are arranged in an array to form an N*M intersection; the plurality of buttons are disposed on the N*M intersection, one end of which is electrically connected to the corresponding row line, and the other end is electrically connected to the corresponding column line; the N lines The wires are respectively electrically connected to the N inputs of the controller; one end of the first column line of the M column lines is electrically connected to the corresponding row line by a corresponding button, and the other end is grounded; the M column lines are in the middle One end of the Mth column line is electrically connected to the corresponding row line by the corresponding button, and is also electrically connected to the first end of the M-2 single-conducting switch tubes, and the other end is grounded by the second resistor; One end of the remaining M-2 column lines in the line line is electrically connected to the corresponding line line by corresponding buttons, and is also respectively associated with M - The second ends of the two single-directional switch tubes are electrically connected, and are electrically connected to a power source by M-2 first resistors, and the other end is electrically connected to the M-2 outputs of the controller. The one-way switch is turned on when the first terminal voltage is lower than the second terminal voltage. 如申請專利範圍第9項所述之電子設備,其中該M-2個第一電阻的阻值均小於第二電阻的阻值。The electronic device of claim 9, wherein the resistance of the M-2 first resistors is less than the resistance of the second resistor.
TW098143999A 2009-12-21 2009-12-21 Scanning circuit for keyboard and method and electronic device using the same TWI487279B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW098143999A TWI487279B (en) 2009-12-21 2009-12-21 Scanning circuit for keyboard and method and electronic device using the same

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW098143999A TWI487279B (en) 2009-12-21 2009-12-21 Scanning circuit for keyboard and method and electronic device using the same

Publications (2)

Publication Number Publication Date
TW201123719A TW201123719A (en) 2011-07-01
TWI487279B true TWI487279B (en) 2015-06-01

Family

ID=45046797

Family Applications (1)

Application Number Title Priority Date Filing Date
TW098143999A TWI487279B (en) 2009-12-21 2009-12-21 Scanning circuit for keyboard and method and electronic device using the same

Country Status (1)

Country Link
TW (1) TWI487279B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI800839B (en) * 2021-05-25 2023-05-01 群光電子股份有限公司 Electronic device and control method thereof
TWI806519B (en) * 2022-03-24 2023-06-21 群光電子股份有限公司 Electronic device and key scan method thereof

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI568196B (en) * 2015-08-17 2017-01-21 光寶電子(廣州)有限公司 Scaning circuit of keyboard, keyboard and scaning method thereof

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5070330A (en) * 1989-01-12 1991-12-03 Acer Incorporated Keyboard scanning matrix
TW200516503A (en) * 2003-11-13 2005-05-16 Mitac Int Corp Keyboard scanning device
US6980135B2 (en) * 2002-01-11 2005-12-27 Alcor Micro, Corp. Logic circuit using hardware to process keyboard scanning
US20080088589A1 (en) * 2006-10-13 2008-04-17 Hon Hai Precision Industry Co., Ltd. Scanning circuit and method for keyboard

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5070330A (en) * 1989-01-12 1991-12-03 Acer Incorporated Keyboard scanning matrix
US6980135B2 (en) * 2002-01-11 2005-12-27 Alcor Micro, Corp. Logic circuit using hardware to process keyboard scanning
TW200516503A (en) * 2003-11-13 2005-05-16 Mitac Int Corp Keyboard scanning device
US20080088589A1 (en) * 2006-10-13 2008-04-17 Hon Hai Precision Industry Co., Ltd. Scanning circuit and method for keyboard

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI800839B (en) * 2021-05-25 2023-05-01 群光電子股份有限公司 Electronic device and control method thereof
TWI806519B (en) * 2022-03-24 2023-06-21 群光電子股份有限公司 Electronic device and key scan method thereof

Also Published As

Publication number Publication date
TW201123719A (en) 2011-07-01

Similar Documents

Publication Publication Date Title
CN102075194B (en) Circuit and method for scanning keyboard and electronic equipment
US8780048B2 (en) Membrane keyboard scan circuit, scan method and keyboard having the same
US8471733B2 (en) Two-wire connection to a key matrix in a mobile device
KR100541557B1 (en) Memory module and impedance calibration method thereof
CN101995956B (en) Keyboard, keyboard scanning circuit and method
JP4955724B2 (en) Touch panel and touch detection method
US20080088589A1 (en) Scanning circuit and method for keyboard
TW200947291A (en) Sensing apparatus and scanning actuation method thereof
US7838863B2 (en) Semiconductor devices having resistive memory elements
TWI487279B (en) Scanning circuit for keyboard and method and electronic device using the same
US20150006920A1 (en) Keyboard circuit
CN113628671A (en) Sensing two multi-level memory cells to determine multiple data values
US20170117038A1 (en) Resistfv memory and operating method for performing a forming operation thereof
US20130249714A1 (en) Keypad module and detecting method for keypad matrix
US7888610B2 (en) Keypad and method for identifying keystrokes of a keypad
TWM403696U (en) Input device capable of eliminating ghost key
US5831556A (en) Pin-reduced low power keyboard scanner
US20130257633A1 (en) Method for keyboard scanning and a keyboard applying the same
WO2018207353A1 (en) Writing apparatus and method for complementary resistive switch
JPH0562409B2 (en)
CN106909245A (en) Touch chip and its driving method
US10318058B2 (en) Control circuit for resistive film touch panel
US10817075B2 (en) Keyboard control system and computer input system allowing a single pin to correspond to a single key when pressed on the keyboard key
TWI806519B (en) Electronic device and key scan method thereof
KR100442370B1 (en) Key scan apparatus and method for mobile communication terminal

Legal Events

Date Code Title Description
MM4A Annulment or lapse of patent due to non-payment of fees