Method for scanning keyboard circuit
11009967 ยท 2021-05-18
Assignee
Inventors
- Shi-Wei ZHENG (Suzhou, CN)
- ZUO-HUI PENG (Suzhou, CN)
- Li Tong (Suzhou, CN)
- Zhao-Ming Li (Suzhou, CN)
- Jie-Yu WANG (Suzhou, CN)
Cpc classification
G06F3/0202
PHYSICS
International classification
G06F3/023
PHYSICS
G06F3/02
PHYSICS
Abstract
A method for scanning a keyboard circuit is provided. The keyboard circuit includes a keyboard array, output wires, input wires, and a scanning circuit. Each of the output wires is electrically coupled to a corresponding column of key units of the keyboard array, respectively. Each of the input wires is electrically coupled to a corresponding row of key units of the keyboard array, and is provided with a pull-up resistor. The method includes: turning on and connecting open-drain transistors to the ground in a scanning interval to clean charges on the output wires; turning on the open-drain transistors and connecting the open-drain transistors to the ground sequentially in a scanning duration; and receiving detected electrical levels through the input wires, and when one of the detected electrical levels is substantially equal to the electrical level of the ground, determining that the corresponding key unit is pressed.
Claims
1. A method for scanning a keyboard circuit including a keyboard array including a plurality of key units, a plurality of output wires, a plurality of input wires, and a scanning circuit, wherein each of the plurality of output wires is electrically coupled to a corresponding column of key units of a plurality of columns of key units of the keyboard array, respectively, wherein each of the plurality of input wires is electrically coupled to a corresponding row of key units of a plurality of rows of key units of the keyboard array, and is provided with a pull-up resistor, respectively, wherein the scanning circuit is electrically coupled to each of the output wires through a corresponding open-drain transistor of a plurality of open-drain transistors, respectively, and the scanning circuit is electrically coupled to the input wires, the method comprising: turning on the open-drain transistors and connecting the open-drain transistors to a ground by the scanning circuit in a charge-cleaning segment of a scanning interval to clean charges on the output wires; only turning on the open-drain transistors and connecting the open-drain transistors to the ground by the scanning circuit during a respective independent scanning period in a scanning duration in an order of the plurality of columns of key units; and receiving a plurality of detected electrical levels through the input wires by the scanning circuit in the scanning duration, and when one of the detected electrical levels is substantially equal to an electrical level of the ground, determining a corresponding key unit of the key units that is pressed which electrically couples a corresponding output wire of the output wires and a corresponding input wire of the input wires.
2. The method of claim 1, wherein the scanning interval further comprises a non-charge-cleaning segment, wherein the charge-cleaning segment is prior to the non-charge-cleaning segment.
3. The method of claim 1, wherein the scanning interval further comprises a non-charge-cleaning segment, wherein the charge-cleaning segment is following the non-charge-cleaning segment.
4. The method of claim 1, wherein the keyboard array further comprises a plurality of ground key units arranged in one column, wherein each of the plurality of ground key units is electrically coupled between the corresponding input wire of the input wires and the ground, respectively, when pressed, the keyboard scanning method further comprising: turning off the open-drain transistors by the scanning circuit in a first scanning segment of the scanning duration; receiving a plurality of first detected electrical levels through the input wires by the scanning circuit in the first scanning segment, and when one of the first detected electrical levels is substantially equal to the electrical level of the ground, determining that the corresponding ground key unit of the ground key units is pressed; only turning on the open-drain transistors and connecting the open-drain transistors to the ground by the scanning circuit during the respective independent scanning period in a second scanning segment of the scanning duration in the order of the plurality of columns of key units; and receiving a plurality of second detected electrical levels through the input wires by the scanning circuit in the second scanning segment, and when one of the second detected electrical levels is substantially equal to the electrical level of the ground and the corresponding ground key unit of the ground key units is not pressed, determining that a corresponding key unit of the key units is pressed.
5. The method of claim 1, wherein the keyboard array further comprises a plurality of power key units arranged in one column, wherein each of the plurality of power key units is electrically coupled between a corresponding input wire of the input wires and a power source, respectively, when pressed, and each of the input wires is provided with a pull-down resistor, respectively, the keyboard scanning method further comprising: enabling the pull-up resistor and disabling the pull-down resistor, and only turning on the open-drain transistors and connecting the open-drain transistors to the ground during a respective independent scanning period in a first scanning segment of the scanning duration in the order of the plurality of columns of key units; receiving a plurality of first detected electrical levels through the input wires by the scanning circuit in the first scanning segment, and when one of the first detected electrical levels is substantially equal to the electrical level of the ground, determining that a corresponding key unit of the key units is pressed; disabling the pull-up resistor and enabling the pull-down resistor, and turning off the open-drain transistors in a second scanning segment of the scanning duration; and receiving a plurality of second detected electrical levels through the input wires by the scanning circuit in the second scanning segment, and when one of the second detected electrical levels is greater than a preset electrical level, determining that a corresponding power key unit of the power key units is pressed.
6. The method of claim 5, wherein the power key units are electrically coupled to the power source through a current-limiting resistor, a resistance ratio of the pull-down resistor to the current-limiting resistor is greater than a preset value, and the preset electrical level is determined by the resistance ratio.
7. The method of claim 1, wherein the keyboard circuit further comprises an external keyboard array comprising a plurality of external key units having the same number of rows and columns with the keyboard array, and wherein a first branch and a second branch of each of the output wires are electrically coupled to a corresponding column of key units of the key units and a corresponding column of external key units of the external key units, respectively, and each of the input wires is further electrically coupled to a corresponding row of external key units of a plurality of rows of external key units of the external keyboard array, and is provided with a pull-down resistor, respectively; wherein the scanning circuit is further electrically coupled to each of the output wires through a corresponding open-source transistor of a plurality of open-source transistors, respectively, and a source of each of the open-source transistors is electrically coupled to a drain of a corresponding open-drain transistor of the open-drain transistors and a corresponding output wire of the output wires; the keyboard scanning method further comprising: enabling the pull-up resistor and disabling the pull-down resistor, disabling the open-source transistors by the scanning circuit, and only turning on the open-drain transistors and connecting the open-drain transistors to the ground during a respective independent first scanning period in a first scanning segment of the scanning duration in the order of the plurality of columns of key units; receiving a plurality of first detected electrical levels through the input wires by the scanning circuit in the first scanning segment, and when one of the first detected electrical levels is substantially equal to the electrical level of the ground, determining that a corresponding key unit of the key units is pressed to electrically couple the first branch and a corresponding input wire of the input wires; disabling the pull-up resistor and enabling the pull-down resistor, disabling the open-drain transistors by the scanning circuit, and only turning on the open-source transistors and connecting the open-source transistors to a power source during a respective independent second scanning period in a second scanning segment of the scanning duration in the order of the plurality of columns of external key units; and receiving a plurality of second detected electrical levels through the input wires by the scanning circuit in the second scanning segment, and when one of the second detected electrical levels is greater than a preset electrical level, determining that a corresponding external key unit of the external key units is pressed to electrically couple the second branch and the corresponding input wire of the input wires.
8. The method of claim 7, wherein the first branch of each of the output wires comprises a first diode comprising a first anode electrically coupled to the corresponding key unit of the key units and a first cathode electrically coupled to a corresponding open-drain transistor of the open-drain transistors; wherein the second branch comprises a second diode comprising a second anode electrically coupled to a corresponding open-source transistor of the open-source transistors and a second cathode electrically coupled to a corresponding external key unit of the external key units.
9. The method of claim 1, wherein the keyboard circuit further comprises an external keyboard array comprising a plurality of external key units having the same number of rows with the keyboard array and a shift register circuit comprising a plurality of shift registers with an open-drain function electrically coupled to the plurality of columns of external key units correspondingly; the keyboard scanning method further comprising: only turning on the open-drain transistors and connecting the open-drain transistors to the ground by the scanning circuit during a respective independent first scanning period in a first scanning segment of the scanning duration in the order of the plurality of columns of key units; receiving a plurality of first detected electrical levels through the input wires by the scanning circuit in the first scanning segment, and when one of the first detected electrical levels is substantially equal to the electrical level of the ground, determining that a corresponding key unit of the key units is pressed; receiving an output electrical level of one of the output wires corresponding to a last row of key units by the shift register circuit; shifting the output electrical level by the shift register circuit in a second scanning segment of the scanning duration in the order of the plurality of columns of external key units; and receiving a plurality of second detected electrical levels through the input wires by the scanning circuit in the second scanning segment, and when one of the second detected electrical levels is substantially equal to the electrical level of the ground, determining that a corresponding external key unit of the external key units is pressed to electrically couple the shift register circuit and a corresponding input wire of the input wires.
10. The method of claim 9, wherein the shift register circuit receives a clock signal from the scanning circuit to shift the output electrical level based on the clock signal.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1) In order to make the above and other purposes, features, advantages, and embodiments of this disclosure more comprehensible, the description of the drawings is as follows:
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
(11)
(12)
(13)
(14)
DETAILED DESCRIPTION
(15) Reference will now be made in detail to the present embodiments of the invention, examples of which are illustrated in the accompanying drawings.
(16) Wherever possible, the same reference numbers are used in the drawings and the description to refer to the same or like parts.
(17) Reference is made to
(18) The keyboard array 100 includes a plurality of key units 120 arranged in an array. In one embodiment, the key units 120 are arranged in M columns and N rows, where the total amount of the key units 120 is MN.
(19) Each of the output wires OW.sub.1-OW.sub.M is electrically coupled to a corresponding column of key units 120, respectively. Each of the input wires IW.sub.1-IW.sub.N is electrically coupled to a corresponding column of key units 120 of the keyboard array 100, respectively. In one embodiment, the input wires IW.sub.1-IW.sub.N are provided with pull-up resistors RU.sub.1-RU.sub.N, respectively. One end of each of the pull-up resistors RU.sub.1-RU.sub.N is electrically coupled to a power source VCC, and the other end of each of the pull-up resistors RU.sub.1-RU.sub.N is electrically coupled to each of the input wires IW.sub.1-IW.sub.N, respectively, to pull up the electrical level of the input wires IW.sub.1-IW.sub.N.
(20) The scanning circuit 110 is configured to be electrically coupled to the output wires OW.sub.1-OW.sub.M and the input wires IW.sub.1-IW.sub.N, to control the electrical level of the output wires OW.sub.1-OW.sub.M sequentially to perform scanning, and to determine whether the key units 120 is pressed or not via detecting the electrical level of the input wires IW.sub.1-IW.sub.N.
(21) Reference is made to
(22)
(23) In one embodiment, turning on and turning off the open-drain transistors MD may be controlled by a control signal COM generated by the processing circuit 200.
(24) The accumulation of charges on the output wire OW1 may occur due to the parasitic capacitance CC effects.
(25) The operation mechanism of the keyboard circuit 1 will be described in detail below.
(26) Reference is made to
(27) The method 300 may be applied to the keyboard circuit 1 shown in
(28) At step 301, the open-drain transistors MD are turned on and connected to the ground GND by the scanning circuit 110 in a charge-cleaning segment T.sub.CC of a scanning interval T.sub.SI to clean charges on the output wires OW.sub.1-OW.sub.M. In one embodiment, the scanning interval T.sub.SI is used for performing the debounce.
(29) In the example of the key unit 120a shown in
(30) In one embodiment, the scanning interval T.sub.SI further includes a non-charge-clearing segment T.sub.NC. In the embodiment of
(31) At step 302, the open-drain transistors MD are only turned on and connected to the ground GND by the scanning circuit 110 during a respective independent scanning period T.sub.SP1-T.sub.SPM in a scanning duration T.sub.SC in the order of the plurality of columns of key units (for example, the first column, the second column . . . through M.sub.th column).
(32) As shown in
(33) Next, during the scanning period T.sub.SP2, the open-drain transistor MD corresponding to the second column of key units 120 is turned on and connected to the ground GND, to connect the output wire OW.sub.2 to the ground GND. At this time, the open-drain transistors MD corresponding to the first column and the third column to the M.sub.th column of key units 120 are turned off. In this state, the electrical levels of the output wires OW.sub.1 and OW.sub.3-OW.sub.M corresponding to the first column and the third column to the M.sub.th column of key units 120 are in the floating state.
(34) By performing the above through the scanning period T.sub.SPM, each column of the key units 120 may be scanned.
(35) At step 303, the detected electrical levels are received through the input wires IW.sub.1-IW.sub.N by the scanning circuit 110 in the scanning duration T.sub.SC, and when one of the detected electrical levels is substantially equal to the electrical level of the ground GND, the scanning circuit 110 determines that the corresponding key unit of the key units 120 is pressed.
(36) For example, when the key unit 120a shown in
(37) In contrast, when the key unit 120 is not pressed, the output wire OW.sub.1 and the input wire IW.sub.2 are not electrically coupled to each other. The electrical level of the input wire IW.sub.2 is pulled up and is not substantially equal to the electrical level of the ground GND due to the pull-up resistor RU.sub.2.
(38) Thus, the key units 120 of other rows in this column and the key units 120 of other columns are determined by the above way, to achieve the effect of the keyboard scanning.
(39) In one embodiment, the scanning circuit 110 may perform, for example, the above scanning process for two times, and perform the comparison, so that when the key unit is detected to be pressed for two times, the scanning circuit 110 may determine that the key unit is pressed.
(40) Reference is made to
(41) Based on the above, the scanning interval T.sub.SI may include the charge-clearing segment T.sub.CC and the non-charge-clearing segment T.sub.NC. In the embodiment of
(42) In some techniques, the scanning circuit 110 turns off the open-drain transistors MD during the scanning interval T.sub.SI. This design may accumulate the charges on the output wires OW.sub.1-OW.sub.M easily due to the presence of the parasitic capacitance. The accumulated charges may cause that the open-drain transistors MD that is turned on and connected to the ground GND has no time to release the charges in the scanning duration T.sub.SC, so that the input wire that should be in the electrical level of the ground GND after pressing the key unit 120 is in the electrical level of non-ground due to the accumulation of the charges, to affect the determining result.
(43) Accordingly, the method 300 for scanning the keyboard circuit in this disclosure may turn on the open-drain transistors MD and connect the open-drain transistors MD to the ground GND in the charge-cleaning segment T.sub.CC of the scanning interval T.sub.SI to clean the charges on the output wires OW.sub.1-OW.sub.M to prevent the accumulated charges from affecting the results of the keyboard scanning.
(44) Reference is made to
(45)
(46) The keyboard circuit 6 is similar with the keyboard circuit 1 depicted in
(47) In this case, as shown in
(48) In more detail, in the first scanning segment T.sub.SC1, the scanning circuit 110 turns off the open-drain transistors MD corresponding to all output wires OW.sub.1-OW.sub.M.
(49) Next, the scanning circuit 110 receives the first detected electrical levels through the input wires IW.sub.1-IW.sub.N in the first scanning segment T.sub.SC1. In this case, the output wires OW.sub.1-OW.sub.M should be in the floating state due to the turning off of the open-drain transistors MD, theoretically. In contrast, the electrical levels of the input wires IW.sub.1-IW.sub.N are pulled up due to the pull-up resistors RU.sub.1-RU.sub.N.
(50) At this time, if none of the ground key units 600 is pressed, there is no effect on the first detected electrical levels of the input wires IW.sub.1-IW.sub.N. However, each of the ground key units 600 is electrically coupled to the ground GND when pressed, so that the electrical levels of the input wires IW.sub.1-IW.sub.N are pulled to the electrical level of the ground GND.
(51) Therefore, if one of the first detected electrical levels is substantially equal to the electrical level of the ground GND, it may be determined that the corresponding ground key unit of the ground key units 600 is pressed and electrically coupled to the ground GND.
(52) Further, in the second scanning segment T.sub.SC2, the scanning circuit 110 may perform the progressive scanning as shown in
(53) It should be noted that although not specifically shown, the charge-cleaning segment T.sub.CC and the non-charge-cleaning segment T.sub.NC shown in
(54) Reference is made to
(55) The keyboard circuit 7 is similar with the keyboard circuit 1 depicted in
(56) Further, the input wires IW.sub.1-IW.sub.N in this embodiment are further provided with pull-down resistors RD.sub.1-RD.sub.N, respectively. In addition, the pull-up resistors RU.sub.1-RU.sub.N and the pull-down resistors RD.sub.1-RD.sub.N may be enabled or disabled, respectively.
(57) In one embodiment, the pull-up resistors RU.sub.1-RU.sub.N are enabled and disabled through the high state and the low state of the control signal CRU, the pull-down resistor RD.sub.1-RD.sub.N are enabled and disabled through the high state and the low state of the control signal CRD. The control signal CRU and the control signal CRD both are shown in
(58) In this case, as shown in
(59) In the first scanning segment T.sub.SC1, the pull-up resistors RU.sub.1-RU.sub.N are enabled, and the pull-down resistors RD.sub.1-RD.sub.N are disabled. The scanning circuit 110 may perform the progressive scanning as shown in
(60) In the second scanning segment T.sub.SC2, the pull-up resistors RU.sub.1-RU.sub.N are disabled, and the pull-down resistors RD.sub.1-RD.sub.N are enabled. The scanning circuit 110 further turns off all of the open-drain transistors MD and receives a plurality of second detected electrical levels through the input wires IW.sub.1-IW.sub.N. In this case, the output wires OW.sub.1-OW.sub.M should be in the floating state due to the turning off of the open-drain transistors MD, theoretically. In contrast, the electrical levels of the input wires IW.sub.1-IW.sub.N are pulled down due to the pull-down resistors RD.sub.1-RD.sub.N.
(61) At this time, if none of the power key units 700 is pressed, there is no effect on the second detected electrical levels of the input wires IW.sub.1-IW.sub.N. However, each of the power key units 700 is electrically coupled to the power source VCC when pressed, so that the electrical levels of the input wires IW.sub.1-IW.sub.N are pulled to a electrical level which is not the electrical level of the ground GND. In one embodiment, the specific electrical level is determined by the voltage division between the current-limiting resistor RL and the corresponding pull-down resistors RD.sub.1-RD.sub.N.
(62) Thus, the scanning circuit 110 receives the second detected electrical levels through the input wires IW.sub.1-IW.sub.N, and when one of the second detected electrical levels is greater than a preset electrical level, the scanning circuit 110 determines that the corresponding power key unit of the power key units 700 is pressed.
(63) In one embodiment, each of the resistance values of the pull-down resistors RD.sub.1-RD.sub.N is greater than the resistance value of the current-limiting resistor R.sub.L, and the resistance ratio of each of the resistance values of the pull-down resistors RD.sub.1-RD.sub.N to the resistance value of the current-limiting resistor R.sub.L is greater than a preset value. The aforementioned preset electrical level is determined by this resistance ratio. In one embodiment, the resistance ratio of each of the pull-down resistors RD.sub.1-RD.sub.N to the current-limiting resistor R.sub.L may be set so that the preset electrical level is close to the electrical level of the power source VCC. For example, each of the resistance values of the pull-down resistors RD.sub.1-RD.sub.N may be set to 50K ohms, and the resistance value of the current-limiting resistor R.sub.L may be set to 4.7K ohms. However, this disclosure is not limited thereto.
(64) It should be noted that although not specifically shown, the charge-cleaning segment T.sub.CC and the non-charge-cleaning segment T.sub.NC shown in
(65) Reference is made to
(66) The keyboard circuit 8 is similar with the keyboard circuit 1 depicted in
(67) The external keyboard array 800 includes external key units 820 having the same number of rows and columns with the keyboard array 100. In this embodiment, the output wires OW.sub.1-OW.sub.M include first branches OA.sub.1-OA.sub.M and second branches OB.sub.1-OB.sub.M. Each of the output wires OW.sub.1-OW.sub.M is electrically coupled to the corresponding column of the key units 120 by the corresponding first branch of the first branches OA.sub.1-OA.sub.M and electrically coupled to the corresponding column of the external key units 820 by the corresponding second branch of the second branches OB.sub.1-OB.sub.M.
(68) In addition to being electrically coupled to the corresponding row of key units of the rows of key units 120, each of the input wires IW.sub.1-IW.sub.N is also electrically coupled to the corresponding column of external key units of the columns of the external key units 820. In addition to the pull-up resistors RU.sub.1-RU.sub.N, the input wires IW.sub.1-IW.sub.N are further provided with pull-down resistors RD.sub.1-RD.sub.N, respectively.
(69)
(70) It should be noted that the scanning circuit 110 may comprise M open-drain transistors MD and M open-source transistors MS, so that each of the M open-drain transistors MD and each of the M open-source transistors MS are electrically coupled to the first branch and the second branch of the corresponding output wire of the output wires OW.sub.1-OW.sub.M, respectively.
(71) Further, the input wires IW.sub.1-IW.sub.N in this embodiment are further provided with pull-down resistors RD.sub.1-RD.sub.N, respectively. In addition, the pull-up resistors RU.sub.1-RU.sub.N and the pull-down resistors RD.sub.1-RD.sub.N may be enabled or disabled, respectively.
(72) In one embodiment, the pull-up resistors RU.sub.1-RU.sub.N are enabled and disabled through the high state and the low state of the control signal CRU, the pull-down resistor RD.sub.1-RD.sub.N are enabled and disabled through the high state and the low state of the control signal CRD. The control signal CRU and the control signal CRD both are shown in
(73) In this case, as shown in
(74) In the first scanning segment T.sub.SC1, the pull-up resistors RU.sub.1-RU.sub.N are enabled, and the pull-down resistors RD.sub.1-RD.sub.N are disabled. The scanning circuit 110 may perform the progressive scanning as shown in
(75) In the second scanning segment T.sub.SC2, the pull-up resistors RU.sub.1-RU.sub.N are disabled, and the pull-down resistors RD.sub.1-RD.sub.N are enabled. The scanning circuit 110 further performs the progressive scanning in the order of the columns of external key units 820. As shown in
(76) When the scanning circuit 110 performs the scanning for the keyboard array 100, the open-drain transistors MD corresponding to the rows of the key units 120 are only turned on during the respective independent first scanning periods T.sub.SA1-T.sub.SAM. When the scanning circuit 110 performs the scanning for the external keyboard array 800, the open-drain transistors MD corresponding to the rows of the key units 120 are only turned on during the respective independent second scanning periods T.sub.SB1-T.sub.SBM.
(77) In one embodiment, the first branch OA.sub.1 includes a first diode 830. The anode of the first diode 830 is electrically coupled to the corresponding key unit 120a of the key units 120, and the cathode of the first diode 830 is electrically coupled to the corresponding open-drain transistor MD. The second branch OB.sub.1 includes a second diode 840. The anode of the second diode 840 is electrically coupled to the corresponding open-source transistor MS of the open-source transistors MS, and the cathode of the second diode 840 is electrically coupled to the corresponding external key unit 820a of the external key units 820. When the open-drain transistors MD and the open-source transistors MS are operated to pull up or down the first branches OA.sub.1-OA.sub.M and the second branches OB.sub.1-OB.sub.M which may not affect each other.
(78) It should be noted that although not specifically shown, the charge-cleaning segment T.sub.CC and the non-charge-cleaning segment T.sub.NC shown in
(79) Reference is made to
(80) The keyboard circuit 9 is similar with the keyboard circuit 1 depicted in
(81) The external keyboard array 900 includes external key units 920 having the same number of rows with the keyboard array 100. The shift register circuit 910 includes a plurality of shift registers (not shown) with the open-drain function electrically coupled to the plurality of columns of external key units 920 correspondingly.
(82) In this case, two scanning segments of the scanning duration of the scanning circuit 110 perform the scanning for the key units 120 and the external key units 920, respectively. In the first scanning segment, the scanning circuit 110 may perform the progressive scanning as shown in
(83) In one embodiment, the shift register circuit 910 receives a clock signal CLK from the scanning circuit 110 to shift the output electrical level based on the clock signal CLK.
(84) Based on the above, the method for scanning a keyboard circuit in this disclosure may be applied to various types of keyboards, to achieve the effect for effectively scanning the keyboard and recognizing the pressed keys.
(85) Although the present invention has been described in considerable detail with reference to certain embodiments thereof, other embodiments are possible. Therefore, the spirit and scope of the appended claims should not be limited to the description of the embodiments contained herein.
(86) It will be apparent to those skilled in the art that various modifications and variations can be made to the structure of the present invention without departing from the scope or spirit of the invention. In view of the foregoing, it is intended that the present invention cover modifications and variations of this invention provided they fall within the scope of the following claims.