Key detection device, method, storage medium and processor

CN116680130BActive Publication Date: 2026-09-08GUANGZHOU SIX CIRCLE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210169956.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-23
Publication Date
2026-09-08
Estimated Expiration
2042-02-23

AI Technical Summary

Technical Problem

[0005]本发明实施例提供了一种按键检测装置、方法、存储介质和处理器,以至少解决由于相邻按键之间的噪声容限低,导致设备控制单元对相邻按键误识别的技术问题

Benefits of technology

[0018] In this embodiment of the invention, by adding a comparator and a gating switch to filter the voltage input to the microcontroller unit, the maximum input voltage of the device is increased without changing the serial buttons. This achieves the technical effect of improving the noise tolerance between adjacent buttons, thereby solving the technical problem that the device control unit misidentifies adjacent buttons due to the low noise tolerance between adjacent buttons.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116680130B_ABST
    Figure CN116680130B_ABST
Patent Text Reader

Abstract

The application discloses a kind of key detection device, method, storage medium and processor.Therein, the device includes: first resistance, between direct current power supply and the key circuit of target device, wherein, multiple resistances contained in key circuit are connected in series;Comparator, the first input end of comparator is connected with key circuit, the second input end inputs preset voltage, and the output end is connected with the general input and output end of controller;Gate switch, the control end of gate switch is connected with the output end of comparator, the input end is connected with key circuit, and the output end is connected with two branches, and the output branch is determined according to the output of comparator;Controller, controller is used to determine the target key that is turned on in key circuit based on the voltage value collected by the sampling end of controller and the state of general input and output end.This application solves the technical problem that adjacent key noise tolerance is low, leading to adjacent key misidentification of equipment control unit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electronic information, and more specifically, to a key detection device, method, storage medium, and processor. Background Technology

[0002] To achieve multi-button response with fewer hardware interfaces or connecting cables, various products with buttons typically use serial buttons as the button input method. The steering wheel control buttons in automobiles are a typical application scenario. By connecting multiple resistors in series and connecting buttons in parallel at each node, a specific voltage is generated when different buttons are pressed. The MCU (Microcontroller Unit) of the automobile steering wheel control detects the different voltages through an ADC interface shared by all buttons and identifies the different buttons.

[0003] However, the noise margin of adjacent buttons is low, often less than half of the input voltage after it is evenly divided. Considering the various situations in actual circuit applications, such as the inability to completely divide the resistor values, power supply noise and jitter, ADC sampling deviation, and protection circuit settings, it is easy to encounter situations where adjacent buttons are incorrectly identified.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] This invention provides a key detection device, method, storage medium, and processor to at least solve the technical problem that the device control unit misidentifies adjacent keys due to the low noise tolerance between adjacent keys.

[0006] According to one aspect of the present invention, a key detection device is provided, comprising: a first resistor connected between a DC power supply and a key circuit of a target device, wherein a plurality of resistors included in the key circuit are connected in series; a comparator having a first input terminal connected to the key circuit, a second input terminal of the comparator receiving a preset voltage, and an output terminal of the comparator connected to a general-purpose input / output terminal of a controller, wherein the preset voltage is used to characterize the sampling voltage of the controller; a gating switch having a control terminal connected to the output terminal of the comparator, an input terminal of the gating switch connected to the key circuit, a first output terminal of the gating switch connected to the sampling terminal of the controller via a first branch, and a second output terminal of the gating switch connected to the sampling terminal of the controller via a second branch, wherein the gating switch is used to control the input terminal of the gating switch to be connected to either the first output terminal or the second output terminal of the gating switch based on the input voltage of the control terminal of the gating switch, wherein the resistance of the first branch is different from the resistance of the second branch; wherein the controller is used to determine the target key that is connected in the key circuit based on the voltage value collected by the sampling terminal of the controller and the state of the general-purpose input / output terminal.

[0007] Optionally, the comparator in the device is used to obtain the key voltage input to the first input terminal of the comparator, and in response to the key voltage being less than a preset voltage, controls the output terminal of the comparator to output a low level, and in response to the key voltage being greater than the preset voltage, controls the output terminal of the comparator to output a high level.

[0008] Optionally, the gating switch in the device is used to control the input terminal of the gating switch to be connected to the first output terminal of the gating switch in response to the input voltage of the control terminal of the gating switch being low; and to control the input terminal of the gating switch to be connected to the second output terminal of the gating switch in response to the input voltage of the control terminal of the gating switch being high.

[0009] Optionally, the first branch of the device includes a wire connected between the first output terminal of the gating switch and the sampling terminal of the controller; the second branch includes a second resistor, the first terminal of which is grounded, and the second terminal of which is connected to the second output terminal of the gating switch and the sampling terminal of the controller.

[0010] Optionally, the second branch further includes a diode, the anode of which is connected to the second terminal of the second resistor and the second output terminal of the gating switch, and the cathode of which is connected to the sampling terminal of the controller.

[0011] Optionally, the controller in the device is also used to determine the state of the general-purpose input / output terminals based on the voltage value at the output of the comparator.

[0012] Optionally, the target device of the device includes: vehicle steering wheel control.

[0013] According to another aspect of the present invention, a key detection method is also provided, comprising: acquiring a key voltage of a key circuit of a target device, wherein the key voltage is used to characterize the voltage obtained by voltage division of the key circuit, and the key circuit includes a plurality of resistors connected in series; comparing the key voltage with a preset voltage to obtain a comparison result, wherein the preset voltage is used to characterize the sampling voltage of a controller; and outputting a first voltage or a second voltage to the controller based on the comparison result, wherein the first voltage is determined based on the key voltage, the second voltage is determined based on the key voltage and the resistance value of the target circuit, and the target key that is conducting in the key circuit is determined by the controller based on the comparison result and the input voltage of the controller.

[0014] Optionally, outputting a first voltage or a second voltage to the controller based on the comparison result includes: outputting a first voltage in response to a comparison result that the key voltage is less than a preset voltage; and outputting a second voltage in response to a comparison result that the key voltage is greater than a preset voltage.

[0015] Optionally, the first voltage is the bond voltage.

[0016] According to another aspect of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored program, wherein, when the program is running, it controls the device where the computer-readable storage medium is located to perform the above-described key detection method.

[0017] According to another aspect of the present invention, a processor is also provided, wherein the above-described key detection method is executed when the program runs.

[0018] In this embodiment of the invention, by adding a comparator and a gating switch to filter the voltage input to the microcontroller unit, the maximum input voltage of the device is increased without changing the serial buttons. This achieves the technical effect of improving the noise tolerance between adjacent buttons, thereby solving the technical problem that the device control unit misidentifies adjacent buttons due to the low noise tolerance between adjacent buttons. Attached Figure Description

[0019] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0020] Figure 1 This is a schematic diagram of a commonly used key detection device based on existing technology;

[0021] Figure 2 This is a structural block diagram of a key detection device according to an embodiment of the present invention;

[0022] Figure 3 This is a schematic diagram of a key detection device according to an embodiment of the present invention;

[0023] Figure 4 This is a flowchart of a key detection method according to an embodiment of the present invention. Detailed Implementation

[0024] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0026] Figure 1 This is a schematic diagram of a commonly used key detection device based on existing technology, such as... Figure 1 As shown, the button circuit has eight resistors connected in series, with each resistor connected in parallel to one button. When different buttons are pressed, the MCU receives different voltages and responds accordingly. When the user presses button K8, the ADC interface detects a sampling voltage V. ADC At its maximum, because the voltage detected by the ADC interface cannot exceed the maximum sampling voltage limit, V is at this time. ADC The maximum sampling voltage has been reached, due to the maximum input voltage V of the entire system. cc The inability to improve this means that the noise margin between the eight buttons cannot be increased. The small noise margin between adjacent buttons can easily lead to errors in voltage detection by the ADC interface, which in turn can cause the system to incorrectly determine the button selected by the user.

[0027] For example, the maximum ADC sampling voltage of a typical MCU is 1.8V or 3.3V; let's take 3.3V as the system input voltage V. cc The series-connected button area has 8 buttons and 9 voltage nodes. Assuming an ideal situation, the voltage difference between each node is approximately 3.9V / 9 ≈ 0.37V, then the noise margin between adjacent buttons is half of this voltage difference, i.e., 0.37 / 2 = 0.185V. In other words, even in an ideal situation, the noise margin between each button is only 0.185V. This noise margin is too small. Considering various practical problems such as the imperfectly equal resistor values ​​in actual circuit applications, power supply noise and jitter, ADC sampling deviation, and the need for protection circuits, buttons with extremely low noise margins may exist, easily leading to button recognition errors and preventing the addition of more buttons to achieve more functions.

[0028] According to an embodiment of the present invention, an embodiment of a button detection device suitable for automotive steering wheel control is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0029] To avoid the problem of the system misidentifying adjacent keys due to low noise tolerance of the keys, embodiments of this application provide a key detection device. Figure 2 This is a structural block diagram of a key detection device according to an embodiment of the present invention, such as... Figure 2 As shown, the device includes: a DC power supply 22, a first resistor 24, a comparator 26, a selection switch 28, and a controller 210.

[0030] The first resistor is connected between the DC power supply and the button circuit of the target device, wherein the button circuit contains multiple resistors connected in series.

[0031] The target device mentioned above can be a car steering wheel control, but it is not limited to this; it can also be other devices that include button circuitry.

[0032] Figure 3 This is a schematic diagram of a key detection device according to an embodiment of the present invention. To more clearly illustrate the key detection device, the following will use... Figure 3 For example, as shown, for Figure 2 To elaborate further, Figure 3 Chinese R com1 It is the first resistor, V cc It is a DC power supply, K n It is a multi-function button in the button circuit, R n This refers to the button resistor in a button circuit; n is typically a natural number, and V... comp It is a comparator, V adc It is the key voltage, R com2 D1 is the second resistor, D2 is the diode, and the MCU is the controller of the key detection device. The MCU includes an ADC voltage sampling interface, a VCC power supply interface, and a GPIO general-purpose input / output interface. ADC It is the sampled voltage acquired by the ADC voltage sampling interface. Switch is a selection switch, which includes the SW control interface and the CH1 voltage input interface.

[0033] The comparator has its first input terminal connected to the button circuit, its second input terminal receiving a preset voltage, and its output terminal connected to the controller's general-purpose input / output terminals. The preset voltage is used to characterize the controller's sampling voltage.

[0034] The above comparator V compAs a voltage selector, it can be based on the key voltage V. adc Determine the output level; preset voltage V ref Generally, the maximum sampling voltage of the MCU's ADC interface is used; for example, if the sampling range of the ADC interface is 0 to 3.3V, then V... ref =3.3V.

[0035] A gating switch is used to control the input terminal of a comparator to the output terminal of a key circuit. The first output terminal of the gating switch is connected to the sampling terminal of the controller via a first branch, and the second output terminal of the gating switch is connected to the sampling terminal of the controller via a second branch. The gating switch is used to control the input terminal of the gating switch to conduct with either the first or second output terminal based on the input voltage of the control terminal of the gating switch. The resistance of the first branch is different from that of the second branch.

[0036] The above-mentioned gating switch Switch can be adjusted according to the comparator V. comp The output level determines whether to output the key voltage V from the first or second output terminal. adc And the key voltage V adc Voltage division is performed according to the selected branch parameters, where the branch parameters refer to the resistance value of that branch.

[0037] The controller is used to determine the target button that is turned on in the button circuit based on the voltage value collected by the controller's sampling terminal and the state of the general-purpose input and output terminals.

[0038] When the entire circuit is connected, after the user selects a button in the button circuit, the controller uses comparator V... comp Based on the output of the strobe switch (Swit), the target button in the button circuit is determined and a corresponding response is made.

[0039] By adding comparator V comp The Switch filters the voltage input to the microcontroller unit, increasing the maximum input voltage of the device without changing the series buttons. This improves the noise tolerance between adjacent buttons, thus solving the problem of misidentification of adjacent buttons by the device control unit due to low noise tolerance between adjacent buttons.

[0040] Optionally, in one embodiment of the present invention, the comparator of the aforementioned device is further configured to obtain comparator V. comp The key voltage V input at the first input terminal adc , in response to the key voltage V adc If the voltage is less than the preset voltage, control comparator V. comp The output terminal outputs a low level in response to the key voltage V. adcIf the voltage is greater than the preset voltage, control comparator V. comp The output terminal outputs a high level.

[0041] When the user presses the button, the key value voltage V will be... adc With preset voltage V ref Compare the values; if the key voltage V... adc Less than the preset voltage V ref Then comparator V comp Output low level; if key voltage V adc Greater than the preset voltage V ref Then comparator V comp The output is high-level, typically 1 for high level and 0 for low level; the specific value is not limited. The general-purpose input / output (GPIO) ports of the controller MCU can determine the corresponding response state based on the received level value. The MCU then uses the determined response state and the received sampled voltage V... ADC This allows us to determine the key that the user pressed.

[0042] For example, take a preset voltage V ref =3.3V, if the key value voltage V after the user presses the button adc= 1.5V, then the comparator V at this time comp When the output is low (0), the controller determines that the system is currently in a low-level response state, and combines this with the received sampled voltage V. ADC Determine the key pressed by the user; if the key value voltage V after the user presses the key... adc= 4.5V, then the comparator V at this time comp When the output is high (1), the controller determines that the system is currently in a high-level response state, and combines this with the received sampled voltage V. ADC Determine the key pressed by the user.

[0043] Optionally, in one embodiment of the present invention, the sampling voltage V ADC Composed of a gating switch Switch and a comparator V comp Output level and key voltage V adc It is determined that the gating switch Switch in the aforementioned device is used to control the input terminal of the gating switch Switch to be connected to the first output terminal of the gating switch Switch in response to the input voltage of the control terminal of the gating switch Switch being low; and to control the input terminal of the gating switch Switch to be connected to the second output terminal of the gating switch Switch in response to the input voltage of the control terminal of the gating switch Switch being high.

[0044] The control interface SW of the strobe switch is connected to the comparator V. comp At the output terminal, the selector switch Switch responds accordingly based on the voltage level. When the voltage level received by Switch is low, the first output terminal is selected to output the key voltage V.acd The first output terminal is connected to the first branch; when the level received by SW is high, the second output terminal is selected to output the key voltage V. acd The second output terminal is connected to the second branch.

[0045] Optionally, in one embodiment of the present invention, the first branch includes: a wire connected between the first output terminal of the gating switch Switch and the sampling terminal of the controller; the second branch includes: a second resistor, the first terminal of the second resistor being grounded, and the second terminal of the second resistor being connected to the second output terminal of the gating switch Switch and the sampling terminal of the controller.

[0046] like Figure 3 As shown, the first branch is generally a single wire. The administrator can also add a resistor R to the first branch to correct the sampling voltage V collected by the controller MCU's ADC interface. ADC Whether to set a resistor R is up to the administrator and is not specifically limited; the second branch includes a second resistor R. com2 The other end of the second resistor is grounded to correct the sampling voltage V acquired by the ADC interface of the controller MCU. ADC The second branch also includes diode D1 and second resistor R. com2 The diode is connected in parallel. The anode of the diode is connected to the second terminal of the second resistor and the second output terminal of the strobe switch. The cathode of the diode is connected to the sampling terminal of the controller to offset the voltage bias, correct the voltage received by the controller MCU, and protect the circuit.

[0047] If comparator V comp If the output is low, the swatch switch (Swit) selects the first branch, and the sampling voltage V... ADC =Key voltage V adc If comparator V comp If the output is high, the swatch switch (Swit) selects the second branch, and the sampling voltage V... ADC It is obtained by voltage division by the second resistor.

[0048] By setting a second resistor in the second branch, the key voltage V, which is higher than the maximum sampling voltage, is reduced. adc By dividing the voltage into a sampleable range and then sampling with the ADC, the effect of the maximum sampling voltage on the key voltage V is reduced. adc The limitation, in other words, the DC voltage V cc The value can be nearly doubled, and the portion above the maximum sampling voltage can be divided into the normal sampling range by the second resistor. If the number of buttons is not changed, it is equivalent to doubling the noise margin between each button.

[0049] Optionally, in one embodiment of the invention, the controller is further configured to base the controller on comparator V.comp The voltage value at the output terminal determines the state of the general-purpose input / output terminal.

[0050] If comparator V comp The output is low, so the state of the controller's general-purpose input / output terminal is 0; if the comparator V comp The output is high, indicating that the controller's general-purpose input / output state is 1. The controller then determines the input / output state based on the general-purpose input / output state and the sampled voltage V received from the ADC interface. ADC The value determines the target key pressed by the user.

[0051] As shown in Table 1 below:

[0052] Table 1

[0053]

[0054] Table 1 shows the formula for calculating the ADC sampling voltage, where R... ser This refers to the current resistance value of the entire button circuit after the user presses the button; in the formula, / / refers to calculating the total resistance value of two resistors connected in parallel, for example, R. com2 / / R ser =(R com2 +R ser ) / (R com2 *R ser ).

[0055] Table 2

[0056]

[0057] Table 2 shows the correspondence between sampling voltage, level value, and button press. As shown in Table 2, the comparator V is set... comp After the swatch switch is activated, the same ADC sampling voltage can correspond to two states: low level and high level. The controller can determine the situation based on the level received by the GPIO. The controller can improve the noise margin of each button within the limit of the maximum sampling voltage.

[0058] For example, assuming the maximum sampling voltage is 3.3V, and the button circuit has 8 buttons, under ideal conditions, the DC voltage V cc The value can be taken as 6.6V at this time. If the key value voltage V of button 2 is... adc The voltage is 1.5V, and the comparator V is... comp When the output is low, the controller's sampling voltage is 1.5V. According to Table 2, the buttons with a low output and a sampling voltage of 1.5V are identified, and the button pressed by the user is determined to be button 2. If the key value voltage V of button 6... adc The voltage is 4.5V, and the comparator V is... compThe output is high-level. After voltage division in the second branch, if the controller's sampling voltage is 1.5V, according to Table 2, the controller looks up the buttons with a high-level sampling voltage of 1.5V, determining that the user pressed button 6. The button ultimately determined by the controller is the result of both the sampling voltage and the GPIO state. The same sampling voltage corresponds to different buttons under different GPIO states, improving the efficiency of the DC power supply. cc The value of is determined, which also increases the noise tolerance between each button, thus avoiding the problem of the controller misidentifying buttons due to the noise tolerance between buttons being too small.

[0059] According to an embodiment of the present invention, a method for detecting buttons is provided. This method can be executed by the button detection device in the above embodiment. The specific implementation scheme and preferred application scenarios are the same as those in the above embodiment, and will not be repeated here. Figure 4 This is a flowchart of a key detection method according to an embodiment of the present invention, such as... Figure 4 As shown, the method includes the following steps:

[0060] Step S402: Obtain the key value voltage of the key circuit of the target device, wherein the key value voltage is used to characterize the voltage obtained by voltage division of the key circuit, and the key circuit includes multiple resistors connected in series.

[0061] Step S404: Compare the key voltage with the preset voltage to obtain a comparison result, wherein the preset voltage is used to characterize the sampling voltage of the controller.

[0062] The above preset voltage is the preset voltage V. ref The key voltage V adc Compared with the preset voltage, if the key voltage V adc Less than the preset voltage V ref

[0063] Step S406: Output a first voltage or a second voltage to the controller based on the comparison result. The first voltage is determined based on the key value voltage, and the second voltage is determined based on the key value voltage and the resistance value of the target circuit. The target button that is turned on in the button circuit is determined by the controller based on the comparison result and the controller's input voltage.

[0064] like Figure 3 As shown, there is no resistor in the first branch, and the first voltage at this time is the key voltage V. acd The second branch contains a second resistor, and the second voltage is generated by the second resistor relative to the key voltage V. adc The result is obtained after pressure division.

[0065] Optionally, step S306, which outputs a first voltage or a second voltage to the controller based on the comparison result, includes: outputting the first voltage in response to the comparison result that the key value voltage is less than the preset voltage; and outputting the second voltage in response to the comparison result that the key value voltage is greater than the preset voltage.

[0066] According to another aspect of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored program, wherein, when the program is running, it controls the device where the computer-readable storage medium is located to perform the key detection method of the above-described method embodiments.

[0067] According to another aspect of the present invention, a processor is also provided, which is used to run a program, wherein the program executes the key detection method of the above-described method embodiments.

[0068] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0069] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0070] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.

[0071] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0072] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0073] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0074] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A key detection device, characterized in that, include: A first resistor is connected between the DC power supply and the button circuit of the target device, wherein the button circuit includes multiple resistors connected in series. A comparator, wherein the first input terminal of the comparator is connected to the key circuit, the second input terminal of the comparator is input with a preset voltage, and the output terminal of the comparator is connected to the general-purpose input / output terminal of the controller, wherein the preset voltage is used to characterize the sampling voltage of the controller; A gating switch is provided, wherein the control terminal of the gating switch is connected to the output terminal of the comparator, the input terminal of the gating switch is connected to the key circuit, the first output terminal of the gating switch is connected to the sampling terminal of the controller via a first branch, and the second output terminal of the gating switch is connected to the sampling terminal of the controller via a second branch. The gating switch is used to control the input terminal of the gating switch to be connected to either the first or second output terminal of the gating switch based on the input voltage of the control terminal of the gating switch, wherein the resistance of the first branch is different from the resistance of the second branch. The controller is used to determine the target button that is turned on in the button circuit based on the voltage value collected by the sampling terminal of the controller and the state of the general input / output terminal. The first branch includes a wire connecting the first output terminal of the gating switch and the sampling terminal of the controller; the second branch includes a second resistor, with its first terminal grounded and its second terminal connected to the second output terminal of the gating switch and the sampling terminal of the controller. Specifically, by setting the second resistor on the second branch, the key voltage, which is higher than the maximum sampling voltage, is divided into a sampleable range before being sampled by the ADC, thereby reducing the limitation of the maximum sampling voltage on the key voltage. The key voltage is used to characterize the voltage obtained by the key circuit through voltage division.

2. The apparatus according to claim 1, characterized in that, The comparator is used to obtain the key voltage input at the first input terminal of the comparator. In response to the key voltage being less than the preset voltage, the comparator outputs a low level. In response to the key voltage being greater than the preset voltage, the comparator outputs a high level.

3. The apparatus according to claim 1, characterized in that, The gating switch is used to control the input terminal of the gating switch to be connected to the first output terminal of the gating switch in response to the input voltage of the control terminal of the gating switch being low; and to control the input terminal of the gating switch to be connected to the second output terminal of the gating switch in response to the input voltage of the control terminal of the gating switch being high.

4. The apparatus according to claim 1, characterized in that, The second branch further includes a diode, the anode of which is connected to the second terminal of the second resistor and the second output terminal of the gating switch, and the cathode of which is connected to the sampling terminal of the controller.

5. The apparatus according to claim 1, characterized in that, The controller is also used to determine the state of the general-purpose input / output terminal based on the voltage value at the output of the comparator.

6. The apparatus according to claim 1, characterized in that, The target device includes: vehicle steering wheel control.

7. A key detection method, characterized in that, include: The key value voltage of the key circuit of the target device is obtained, wherein the key value voltage is used to characterize the voltage obtained by voltage division of the key circuit, and the key circuit includes multiple resistors connected in series. The key voltage is compared with a preset voltage to obtain a comparison result, wherein the preset voltage is used to characterize the sampling voltage of the controller; Based on the comparison result, a first voltage or a second voltage is output to the controller, wherein the first voltage is determined based on the key value voltage, the second voltage is determined based on the key value voltage and the resistance value of the target circuit, and the target button that is turned on in the button circuit is determined by the controller based on the comparison result and the input voltage of the controller, wherein the first voltage is the key value voltage, and the second voltage is obtained by dividing the key value voltage by the resistance of the target circuit; Outputting a first voltage or a second voltage to the controller based on the comparison result includes: outputting the first voltage in response to the comparison result being that the key value voltage is less than the preset voltage; and outputting the second voltage in response to the comparison result being that the key value voltage is greater than the preset voltage.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device containing the computer-readable storage medium to perform the key detection method of claim 7.

9. A processor, characterized in that, The processor is used to run a program, wherein the program executes the key detection method of claim 7 when it runs.

Citation Information

Patent Citations

  • Keyboard detection circuit and method thereof

    CN101359034A

  • Vehicle-mounted key system

    CN110509867A