ELECTRONIC DEVICE AND CONTROL METHOD THEREOF

The present disclosure provides electronic device and control method thereof. The electronic device includes input circuit and processor. The input circuit includes key switches arranged in array. The processor is coupled to the key switches through column lines and row lines and is configured to: detect part of the row lines and part of the column lines coupled to at least one turned-on key switch; assign one of the part of the row lines and the part of the column lines as scan line group, and assign the other of the part of the row lines and the part of the column lines as return line group; input corresponding scan signal to corresponding scan line of the scan line group; and detect whether the return line group outputs the corresponding scan signal, to confirm position of the at least one turned-on key switch.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims priority to Taiwan Application Serial Number 110118936, filed May 25, 2021, which is herein incorporated by reference in its entirety.

BACKGROUND

Field of Invention

This disclosure relates to the electronic device and control method thereof, and in particular to the electronic device, which has multiple keys, and control method thereof.

Description of Related Art

For device having multiple keys, it is traditional to confirm whether there is a key being pressed by sequentially scanning each column line. However, traditional scanning method is prone to following problems:

1. When the amount of the column lines is too many, the scan time is relatively long, thereby affecting the scan cycle and the power consumption of the device;

2. When the column lines or the row lines have too much impedance and the charge/discharge time is prolonged consequentially, the signal reading time should be prolonged, thereby affecting the scan cycle and the power consumption of the device.

SUMMARY

An aspect of present disclosure relates to an electronic device. The electronic device includes an input circuit and a processor. The input circuit includes a plurality of key switches arranged in an array, wherein each of the key switches is configured to change from a turned-off state into a turned-on state in response to a user input. The processor is coupled to the key switches through a plurality of column lines and a plurality of row lines and is configured to: detect a part of the row lines and a part of the column lines coupled to at least one turned-on key switch; assign one of the part of the row lines and the part of the column lines as a scan line group, and assign the other of the part of the row lines and the part of the column lines as a return line group; input a corresponding scan signal of a plurality of scan signals to a corresponding scan line of the scan line group; and detect whether the return line group outputs the corresponding scan signal, to confirm a position of the at least one turned-on key switch.

Another aspect of present disclosure relates to a control method applied to an electronic device, wherein the electronic device includes a processor and an input circuit including a plurality of key switches arranged in an array, and each of the key switches is configured to change from a turned-off state into a turned-on state in response to a user input. The control method includes: by the processor, detecting a part of a plurality of row lines and a part of a plurality of column lines coupled to at least one turned-on key switch; by the processor, assigning one of the part of the row lines and the part of the column lines as a scan line group, and assigning the other of the part of the row lines and the part of the column lines as a return line group; by the processor, inputting a corresponding scan signal of a plurality of scan signals to a corresponding scan line of the scan line group; and by the processor, detecting whether the return line group outputs the corresponding scan signal, to confirm a position of the at least one turned-on key switch.

DETAILED DESCRIPTION

The embodiments are described in detail below with reference to the appended drawings to better understand the aspects of the present disclosure. However, the provided embodiments are not intended to limit the scope of the disclosure, and the description of the structural operation is not intended to limit the order in which they are performed. Any device that has been recombined by components and produces an equivalent function is within the scope covered by the disclosure.

The terms used in the entire specification and the scope of the patent application, unless otherwise specified, generally have the ordinary meaning of each term used in the field, the content disclosed herein, and the particular content.

The terms “coupled” or “connected” as used herein may mean that two or more elements are directly in physical or electrical contact, or are indirectly in physical or electrical contact with each other. It can also mean that two or more elements interact with each other.

Referring toFIG.1,FIG.1is a block diagram of an electronic device100in accordance with some embodiments of the present disclosure. The electronic device100includes a processor110, an input circuit120, a plurality of row lines R and a plurality of column lines C. In some embodiments, the electronic device100can be, for example but not limited to, computer with multiple keys, mobile device, remote controller or phone. In particular, the input circuit120includes a plurality of key switches SW arranged in an array, to compose multiple keys of the electronic device100.

In structure, the processor110is coupled to multiple first terminals of a same row of the key switches SW through a corresponding row line R and is coupled to multiple second terminals of the same row of the key switches SW through each of the column lines C. The row lines R and the column lines C are vertically intersected. Each of the key switches SW is arranged between a corresponding row line R and a corresponding column line C.

Referring toFIG.2together,FIG.2is a circuit diagram of the input circuit120of the electronic device100in accordance with some embodiments of the present disclosure. For simplification of description,FIG.2only illustrates 8 row lines R[0]-R[7], 7 column lines C[0]—C[6] and 56 key switches SW[0,0]-SW[7,6], but the present disclosure is not limited herein. As shown inFIG.2, the row line R[0] is coupled to 7 first terminals of the same row of 7 key switches SW[0,0]-SW[0,6], and the column lines C[0]—C[6] are coupled to 7 second terminals of the same row of 7 key switches SW[0,0]-SW[0,6]. The arrangement of other rows of the key switches SW can be deduced by analogy, and therefore the descriptions thereof are omitted herein.

In some embodiments, each of the key switches SW is in a turned-off state when being idle (for example, when not being pressed by the user). When the user presses the key of the electronic device100, the key switch SW corresponding to the key being pressed would change from the turned-off state into a turned-on state in response to a user input (e.g., a pressing action), so as to form a loop with the processor110through the corresponding row line R and the corresponding column line C. Other key switches SW corresponding to other keys not being pressed are still in the turned-off state, so that the processor110is unable to receive/transmit signal through the corresponding row lines R and the corresponding column lines C.

In the present embodiment, the key switches SW can be implemented by a mechanical switch or a membrane switch, and the processor110can be implemented by a microprocessor. However, the present disclosure is not limited herein.

Referring toFIG.3,FIG.3is a flow diagram of a control method200in accordance with some embodiments of the present disclosure. The control method200can be executed by the processor110of the electronic device100ofFIG.1, so that the processor110can determine whether each key of the electronic device100is pressed. In some embodiments, the control method200includes operations S201-S205. For convenience of description, the control method200would be described below with reference toFIGS.2and4A-4C.

In the embodiment ofFIG.2, the user presses 3 keys corresponding to 3 key switches SW[2,4], SW[3,3] and SW[4,4] in a scan cycle (e.g., 4 ms), so that 3 key switches SW[2,4], SW[3,3] and SW[4,4] are changed from the turned-off state into the turned-on state in response to the user input.

Referring toFIG.4Atogether,FIG.4Ais a schematic diagram of signals in the electronic device100during a scan period. In operation S201, the processor110simultaneously inputs a plurality of first detection signals Sd1to the input circuit120through the column lines C[0]—C[6], and receives the first detection signals Sd1through 3 row lines R[2]-R[4]. Accordingly, the processor110detects 3 row lines R[2]-R[4] coupled to the turned-on key switches SW[2,4], SW[3,3] and SW[4,4] (that is, detect a part of the row lines coupled to at least one turned-on key switch). In the present embodiment, the amount (e.g., 7) of the first detection signals Sd1is equal to the amount of the column lines C.

Referring toFIG.4Btogether,FIG.4Bis a schematic diagram of signals in the electronic device100during the scan period. In operation S202, the processor110simultaneously inputs a plurality of second detection signals Sd2to the input circuit120through the row lines R[0]-R[7], and receives the second detection signals Sd2through 2 column lines C[3]—C[4]. Accordingly, the processor110detects 2 column lines C[3]—C[4] coupled to the turned-on key switches SW[2,4], SW[3,3] and SW[4,4] (that is, detect a part of the column lines coupled to the at least one turned-on key switch). In the present embodiment, the amount (e.g., 8) of the second detection signals Sd2is equal to the amount of the row lines R.

In operation S203, the processor110compares the amount of the row lines R which are coupled to the turned-on key switches SW (e.g., the key switches SW[2,4], SW[3,3] and SW[4,4] ofFIG.2) and the amount of the column lines C which are coupled to the turned-on key switches SW. In the embodiment ofFIG.2, the amount of the row lines R which are coupled to the turned-on key switches SW is 3, and the amount of the column lines C which are coupled to the turned-on key switches SW is 2. Accordingly, the processor110obtains the result that the amount of the column lines C which are coupled to the turned-on key switches SW is smaller.

Then, in operation S204, the processor110assigns one with smaller amount as a scan line group, and assigns one with larger amount as a return line group. Referring toFIG.4C,FIG.4Cis a schematic diagram of signals in the electronic device100during the scan period. As shown inFIG.4C, the processor110assigns the column lines C[3]—C[4] as two scan lines SL[0]-SL[1], and assigns the row lines R[2]-R[4] as 3 return lines RL[0]-RL[2].

In operation S205, the processor110sequentially inputs a corresponding scan signal to the scan lines SL, and detects whether the return lines RL output the corresponding scan signal to confirm the specific position of the turned-on key switch SW. The terms “corresponding scan signal” as used herein may mean that the scan signal which is inputted to one specific scan line SL (for example, the scan signals Sc[0] and Sc[1] ofFIG.4Care the scan signals which are inputted to the scan lines SL[0] and SL[1] respectively). It can be appreciated that different scan lines SL can receive same or different scan signals. In the present embodiment, the scan signals (e.g., the scan signals Sc[0] and Sc[1] ofFIG.4C) inputted to each of the scan lines SL are same. In particular, as shown inFIG.4C, the processor110first inputs the scan signal Sc[0] to the scan line SL[0], and receives the scan signal Sc[0] through the return line RL[1] only. Accordingly, the processor110determines that there is one turned-on key switch SW[3,3] at the position of 4thcolumn and 4throw. Then, the processor110inputs the scan signal Sc[1] to the scan line SL[1], and receives the scan signal Sc[1] through the return lines RL[0] and RL[2]. Accordingly, the processor110determines that there are two turned-on key switches SW[2,4] and SW[4,4] at the position of 5thcolumn and 3rdrow and the position of 5thcolumn and 5throw respectively. In such way, the processor110can obtain the state of each key of the electronic device100according to the positions of the turned-on key switches SW[2,4], SW[3,3] and SW[4,4].

In some embodiments, each scan cycle includes a scan period (that is, a period for executing operations S201-S205) and a sleep period. Generally speaking, when the processor110finishes the scan operation (that is, the scan period is ended) in one scan cycle, it can enter the sleep period. In some embodiments, in order to avoid the scan result being affected by physical bounce generated because the key is pressed, the processor110would confirm the scan result only when obtaining the same scan result in three consecutive scan cycles. The scan result of each scan cycle can be stored in storage (e.g., memory) of the electronic device100for the processor110to compare the scan results of different scan cycles.

In other embodiments, the processor110does not execute operations S203-S204. After operation S202, the processor110directly assigns the row lines R[2]-R[4] coupled to the turned-on key switches SW[2,4], SW[3,3] and SW[4,4] as 3 scan lines, and directly assigns the column lines C[3]—C[4] coupled to the turned-on key switches SW[2,4], SW[3,3] and SW[4,4] as 2 return lines. Then, the processor110executes operation S205. In operation S205, the processor110sequentially inputs the corresponding scan signal to 3 scan lines, and detects whether 2 return lines output the corresponding scan signal to confirm the specific positions of the turned-on key switches SW[2,4], SW[3,3] and SW[4,4].

In particular, the processor110first inputs the corresponding scan signal to the first scan line (i.e., the row line R[2]), and receives the corresponding scan signal through the second return line (i.e., the column line C[4]) only. Accordingly, the processor110determines that there is one turned-on key switch SW[2,4] at the position of 5thcolumn and 3rdrow. The processor110then inputs the corresponding scan signal to the second scan line (the row line R[3]), and receives the corresponding scan signal through the first return line (i.e., the column line C[3]) only. Accordingly, the processor110determines that there is one turned-on key switch SW[3,3] at the position of 4thcolumn and 4throw. Finally, the processor110inputs the corresponding scan signal to the third scan line (the row line R[4]), and receives the corresponding scan signal through the second return line (i.e., the column line C[4]) only. Accordingly, the processor110determines that there is one turned-on key switch SW[4,4] at the position of 5thcolumn and 5throw. In such way, the processor110can obtain the state of each key of the electronic device100according to the positions of the turned-on key switches SW[2,4], SW[3,3] and SW[4,4].

It can be appreciated that in the embodiment that operation S203-S204are not executed, after operation S202, the processor110can also directly assign the column lines C[3]—C[4] coupled to the turned-on key switches SW[2,4], SW[3,3] and SW[4,4] as 2 scan lines, and directly assigns the row lines R[2]-R[4] coupled to the turned-on key switches SW[2,4], SW[3,3] and SW[4,4] as 3 return lines. The scan operation thereof is similar to those of the above embodiments, and therefore the descriptions thereof are omitted herein.

Referring toFIG.5,FIG.5is a circuit diagram of the electronic device100in accordance with other embodiments of the present disclosure. For simplification of description,FIG.5only illustrates 6 row lines R[0]-R[5], 2 column lines C[0]—C[1] and 12 key switches SW[0,0]-SW[5,1], but the present disclosure is not limited herein. In the embodiment ofFIG.5, the processor110executes operation S201and S202, and detects that there are 1 column line C[0] and 3 row lines R[2]-R[4] coupled to the turned-on key switches SW[2,0], SW[3,0] and SW[4,0]. Accordingly, the processor110can omit subsequent operations S203-S205, and directly confirms the specific positions of the turned-on key switches SW[2,0], SW[3,0] and SW[4,0]. In other words, when one of the amount of the row lines R couple to the turned-on key switches SW and the amount of the column lines C coupled to the turned-on key switches SW is 1, the processor110can directly confirm the specific positions of the turned-on key switches SW, so as to dramatically reduce the scan time and scan number.

In comparison with the traditional scan method which sequentially scans each row of the key switch, the electronic device100of the present disclosure first detects the approximate area where the turned-on key switches are in the switch array, and then performs the scan operation on the detected area to confirm the specific positions of the turned-on key switches. In such way, the electronic device100of the present disclosure can shorten the scan period of each scan cycle. In the condition that the scan cycle is fixed, the sleep period can be relatively increased to reduce the power consumption of the electronic device100, thereby achieving the effect of power saving (which is especially important for wireless electronic device).

Some electronic devices are limited by their structure (for example, circuits printed with carbon ink) to have long charge/discharge time, thereby often being unable to read signals because the scan cycle is too short. In the condition that the scan cycle is fixed, the electronic device100of the present disclosure can provide enough signal reading time due to the simplification of scan operation, so that the signal can be stably read.

In addition, since the scan frequency can be increased (that is, the scan cycle is shortened) due to the shortened scan period, the control method200of the present disclosure is also applicable to the electronic devices requiring low latency.