Reference voltage updating method, MCU, touch control equipment and storage medium

文档序号:1537813 发布日期:2020-02-14 浏览:13次 中文

阅读说明:本技术 基准电压更新方法、mcu、触控设备及存储介质 (Reference voltage updating method, MCU, touch control equipment and storage medium ) 是由 周伟 李庆斌 于 2019-10-28 设计创作,主要内容包括:本申请提供一种基准电压更新方法、MCU、触控设备及存储介质。其中,MCU通过N个通道与N个触摸按键连接,N个通道与N个触摸按键一一对应,MCU采集N个通道上的电压。若N个通道中电压小于第一电压的通道的数量达到第一数量,或者,若N个通道中电压大于第二电压的数量达到第二数量,则MCU分别更新N个通道的初始基准电压。从而可以防止出现冒键的情况。(The application provides a reference voltage updating method, an MCU, a touch device and a storage medium. The MCU is connected with the N touch keys through N channels, the N channels correspond to the N touch keys one to one, and the MCU collects voltages on the N channels. If the number of the channels with the voltages smaller than the first voltage in the N channels reaches a first number, or if the number of the channels with the voltages larger than the second voltage in the N channels reaches a second number, the MCU updates the initial reference voltages of the N channels respectively. Thereby preventing the occurrence of a cold key.)

1. A reference voltage updating method is characterized in that the method is applied to a Micro Control Unit (MCU), the MCU is connected with N touch keys through N channels, the N channels correspond to the N touch keys one by one, N is an integer greater than 1, and the method comprises the following steps:

collecting voltages on the N channels;

if the number of the channels with the voltages smaller than the first voltage in the N channels reaches a first number, or if the number of the channels with the voltages larger than the second voltage in the N channels reaches a second number, respectively updating the initial reference voltages of the N channels, wherein the initial reference voltages of the channels are stored in advance;

when a finger approaches the touch key, the first voltage is a voltage on the channel corresponding to the touch key; the initial reference voltage of the channel is the voltage on the channel when the touch key corresponding to the channel is not pressed under the normal condition; the second voltage is greater than the initial reference voltage.

2. The method of claim 1, further comprising:

if the number of the channels with the voltages smaller than the first voltage in the N channels does not reach the first number, determining the duration of the voltage of the target channel smaller than the first voltage aiming at any target channel with the voltages smaller than the first voltage in the N channels;

and if the duration is longer than the preset duration, updating the initial reference voltage of the target channel to obtain the updated reference voltage of the target channel.

3. The method of claim 2, wherein after updating the initial reference voltage of the target channel to obtain the updated reference voltage of the target channel, further comprising:

collecting the voltage of the target channel again to obtain the voltage collected again of the target channel;

and if the re-collected voltage of the target channel is greater than the updated reference voltage of the target channel, updating the updated reference voltage of the target channel again.

4. The method according to any one of claims 1-3, wherein said updating the initial reference voltages of the N channels respectively comprises:

and respectively updating the initial reference voltages of the N channels to the average voltage of the N channels.

5. The method of claim 2, wherein the updating the initial reference voltage of the target channel to obtain the updated reference voltage of the target channel comprises:

and updating the initial reference voltage of the target channel to the voltage of the target channel to obtain the updated reference voltage of the target channel.

6. The method of claim 3, wherein said re-updating the updated reference voltage of the target channel comprises:

and updating the updated reference voltage of the target channel to the initial reference voltage of the target channel.

7. The utility model provides a MCU, its characterized in that, MCU is connected with N touch button through N passageway, N passageway with N touch button one-to-one, N is for being greater than 1 integer, MCU includes:

the first acquisition module is used for acquiring the voltages on the N channels;

a first updating module, configured to update initial reference voltages of the N channels respectively if the number of channels with voltages smaller than a first voltage in the N channels reaches a first number, or if the number of channels with voltages larger than a second voltage in the N channels reaches a second number, where the initial reference voltages of the channels are stored in advance;

when a finger approaches the touch key, the first voltage is a voltage on the channel corresponding to the touch key; the initial reference voltage of the channel is the voltage on the channel when the touch key corresponding to the channel is not pressed under the normal condition; the second voltage is greater than the initial reference voltage.

8. The MCU of claim 7, further comprising:

a determining module, configured to determine, for any target channel of the N channels whose voltage is smaller than a first voltage, a duration of time for which the voltage of the target channel is smaller than the first voltage if the number of channels whose voltages are smaller than the first voltage does not reach the first number;

and the second updating module is used for updating the initial reference voltage of the target channel if the duration is longer than the preset duration so as to obtain the updated reference voltage of the target channel.

9. The MCU of claim 8, further comprising:

the second acquisition module is used for acquiring the voltage of the target channel again to obtain the voltage acquired again of the target channel;

and the third updating module is used for updating the updated reference voltage of the target channel again if the voltage acquired again of the target channel is greater than the updated reference voltage of the target channel.

10. The MCU of any one of claims 7 to 9, wherein the first updating module is specifically configured to:

and respectively updating the initial reference voltages of the N channels to the average voltage of the N channels.

11. The MCU of claim 8, wherein the second updating module is specifically configured to:

and updating the initial reference voltage of the target channel to the voltage of the target channel to obtain the updated reference voltage of the target channel.

12. The MCU of claim 9, wherein the third updating module is specifically configured to:

and updating the updated reference voltage of the target channel to the initial reference voltage of the target channel.

13. An MCU, characterized in that it is adapted to perform the reference voltage updating method according to any of claims 1-6.

14. A touch device, comprising: the device comprises an MCU and N touch keys, wherein the MCU is connected with the N touch keys through N channels, the N channels correspond to the N touch keys one by one, N is an integer larger than 1, and the MCU is used for executing the reference voltage updating method according to any one of claims 1 to 6.

15. A readable storage medium characterized by comprising program instructions that, when run on a computer, cause the computer to execute the reference voltage updating method according to any one of claims 1 to 6.

Technical Field

The present application relates to the field of touch technologies, and in particular, to a reference voltage updating method, an MCU, a touch device, and a storage medium.

Background

Touch control equipment is frequently used in daily life of people at present, such as a gas stove, a touch control lamp and the like. Among these touch devices are: a Micro Control Unit (MCU) and a touch key, wherein a channel exists between the MCU and the touch key.

The principle that whether the MCU detects the finger pressing condition on the touch key is as follows: any touch key can be understood as a capacitor, the MCU can obtain a voltage Vout on a channel corresponding to the touch key through an Analog-to-Digital Converter (ADC), where when no finger presses on a touch key, the voltage Vout is generally 2048, where 2048 is a value after normalization processing according to the precision of the ADC, and the Vout is a reference voltage Base of the channel corresponding to the touch key. When a finger presses the touch key, a capacitance is formed between a human body and the ground, and the capacitance is connected with the touch key in series, so that the capacitance of the touch key is increased, and further, the voltage on the touch key is decreased within the same time, for example, the voltage is about Vout 1600. This 1600 is again the value after normalization processing according to the accuracy of the ADC. The MCU determines whether there is a finger pressing the touch key by calculating Delta-Base-Vout, for example: and when the Delta value is more than 200, the touch key is considered to be pressed by the finger.

However, if the touch key is pressed by a large area due to temperature and humidity changes or water drops on the touch key, the capacitance value of the touch key is also changed, so that the voltage Vout on the channel corresponding to the touch key is changed, and finally Delta is also changed correspondingly, and the touch key is mistakenly identified as a finger press, that is, a key overflow problem exists.

Disclosure of Invention

The application provides a reference voltage updating method, an MCU, a touch device and a storage medium. Thereby avoiding the problem of key collapse.

In a first aspect, a method for updating a reference voltage is applied to a Micro Control Unit (MCU), the MCU is connected with N touch keys through N channels, the N channels are in one-to-one correspondence with the N touch keys, N is an integer greater than 1, and the method includes: collecting the voltage on the N channels. If the number of the channels with the voltages smaller than the first voltage in the N channels reaches a first number, or if the number of the channels with the voltages larger than the second voltage in the N channels reaches a second number, respectively updating the initial reference voltages of the N channels, and storing the initial reference voltages of the channels in advance. The first voltage is the voltage on the channel corresponding to the touch key when the finger is close to the touch key. The initial reference voltage of the channel is the voltage on the channel when the touch key corresponding to the channel is not pressed under the normal condition. The second voltage is greater than the initial reference voltage. And the difference Delta between the updated reference voltage and the voltage on the channel is smaller than 200, namely smaller than the voltage difference between the reference voltage and the first voltage, so that the condition of key overflow can be prevented.

Optionally, the respectively updating the initial reference voltages of the N channels includes: and respectively updating the initial reference voltages of the N channels into the average voltage of the N channels. Assuming that the voltages Vout of the channels are the same, the updated reference voltage is the voltage on the N channels, so that Delta is equal to the updated reference voltage minus the voltage on the channels, and as a result, 0 is 0, and the occurrence of a cold key situation can be prevented because 0 is not greater than 200.

Optionally, the method further includes: if the number of the channels with the voltages smaller than the first voltage in the N channels does not reach the first number, determining the duration of the voltage of the target channel smaller than the first voltage aiming at any target channel with the voltages smaller than the first voltage in the N channels. And if the duration is longer than the preset duration, updating the initial reference voltage of the target channel to obtain the updated reference voltage of the target channel. And the difference Delta between the updated reference voltage of the target channel and the voltage on the target channel is smaller than 200, namely smaller than the voltage difference between the reference voltage and the first voltage, so that the condition of key overflow can be prevented.

Optionally, after updating the initial reference voltage of the target channel to obtain an updated reference voltage of the target channel, the method further includes: and collecting the voltage of the target channel again to obtain the voltage collected again of the target channel. And if the re-acquisition voltage of the target channel is greater than the updated reference voltage of the target channel, updating the updated reference voltage of the target channel again. Therefore, the operation corresponding to the touch key can be normally triggered.

Optionally, updating the initial reference voltage of the target channel to obtain an updated reference voltage of the target channel, including: and updating the initial reference voltage of the target channel to the voltage of the target channel to obtain the updated reference voltage of the target channel.

Optionally, the updating the updated reference voltage of the target channel again includes: and updating the updated reference voltage of the target channel to the initial reference voltage of the target channel.

The MCU, the touch device, the readable storage medium, and the computer program product will be described below, and the effects thereof can refer to the effects of the above methods, which will not be described further below.

In a second aspect, the present application provides an MCU, the MCU is connected to N touch keys through N channels, the N channels correspond to the N touch keys one to one, and N is an integer greater than 1, and the MCU includes:

the first acquisition module is used for acquiring the voltages on the N channels.

The first updating module is used for respectively updating the initial reference voltages of the N channels if the number of the channels with the voltages smaller than the first voltage in the N channels reaches a first number, or if the number of the channels with the voltages larger than the second voltage in the N channels reaches a second number, and the initial reference voltages of the channels are stored in advance.

The first voltage is the voltage on the channel corresponding to the touch key when the finger is close to the touch key. The initial reference voltage of the channel is the voltage on the channel when the touch key corresponding to the channel is not pressed under the normal condition. The second voltage is greater than the initial reference voltage.

In a third aspect, the present application provides an MCU configured to execute the reference voltage updating method according to the first aspect or the optional manner of the first aspect.

In a fourth aspect, the present application provides a touch device, including: the MCU is connected with the N touch keys through N channels, the N channels correspond to the N touch keys one by one, N is an integer larger than 1, and the MCU is used for executing the reference voltage updating method according to the first aspect or the optional mode of the first aspect.

In a fifth aspect, the present application provides a readable storage medium comprising program instructions which, when run on a computer, cause the computer to perform the reference voltage updating method according to the first aspect or the alternatives of the first aspect.

In a sixth aspect, the present application provides a computer program product comprising program instructions for implementing the reference voltage updating method according to the first aspect or the alternatives of the first aspect.

The application provides a reference voltage updating method, an MCU, a touch device and a storage medium. The MCU is connected with the N touch keys through N channels, the N channels correspond to the N touch keys one to one, N is an integer larger than 1, and the MCU collects voltages on the N channels. If the number of the channels with the voltages smaller than the first voltage in the N channels reaches a first number, or if the number of the channels with the voltages larger than the second voltage in the N channels reaches a second number, the MCU updates the initial reference voltages of the N channels respectively. The difference Delta between the updated reference voltage and the voltage on the channel is smaller than the voltage difference between the reference voltage and the first voltage, so that the condition of false keys can be prevented.

Drawings

FIG. 1 is a schematic diagram of the connection between the MCU and the touch key;

FIG. 2 is a schematic diagram showing the relationship between temperature and voltage on a channel corresponding to a touch key;

fig. 3 is a flowchart of a reference voltage updating method according to an embodiment of the present application;

FIG. 4 is a schematic diagram of voltages at various levels according to an embodiment of the present application;

FIG. 5 is a schematic diagram illustrating a relationship between a water droplet area and a voltage on a channel corresponding to a touch key according to an embodiment of the present disclosure;

fig. 6 is a flowchart of a reference voltage updating method according to another embodiment of the present application;

fig. 7 is a schematic diagram of an MCU according to an embodiment of the present application.

Detailed Description

As described above, the current touch device includes: a Micro Control Unit (MCU) and a touch key, wherein a channel exists between the MCU and the touch key. Fig. 1 is a schematic diagram illustrating a connection between an MCU and a touch key, and as shown in fig. 1, a typical touch key currently exists, which includes: the touch keys are also called touch sensing electrodes, for example, keys 0, 1 and 2 in fig. 1 are all key touch keys, the key 3 is a circular touch key, and the key 4 is a slide bar touch key. The slider touch key is formed by 3 touch keys or units, the circular touch key is formed by 4 touch keys or units, and each touch key or unit is connected with the MCU through a channel, for example: the keys 0, 1 and 2 are respectively connected with the MCU through the channels 0, 1 and 2, the key 3 is respectively connected with the MCU through the channels 3, 4, 5 and 6, and the key 4 is respectively connected with the MCU through the channels 7, 8 and 9. It should be noted that the touch key to be mentioned below in this application may be the upper key type touch key, or one of the slide bar type touch keys, or one of the circular type touch keys.

The MCU determines whether there is a finger pressing the touch key by calculating Delta-Base-Vout, for example: and when the Delta value is more than 200, the touch key is considered to be pressed by the finger. However, if the touch key is pressed by a large area due to temperature and humidity changes or water drops on the touch key, the capacitance value of the touch key is also changed, so that the voltage Vout on the channel corresponding to the touch key is changed, and finally Delta is also changed correspondingly, and the touch key is mistakenly identified as a finger press, that is, a key overflow problem exists. For example: fig. 2 is a schematic diagram of a relationship between temperature and voltage on a channel corresponding to a touch key, and as shown in fig. 2, as the temperature T increases, the output voltage Vout on the channel corresponding to the touch key tends to decrease. When the voltage Vout drops to a level that causes Delta to be greater than 200, the touch key is erroneously recognized as a case where there is a finger press, i.e., there is a key press problem.

In order to solve the above technical problem, the present application provides a reference voltage updating method, an MCU, a touch device, and a storage medium.

The technical scheme of the application can be applied to the following scenes: if there is an abnormal situation such as temperature, humidity change, large-area pressing, or water drop on the touch key, the method can also be applied to a normal situation, that is, there is no temperature, humidity change, large-area pressing, or water drop on the touch key.

Fig. 3 is a flowchart of a reference voltage updating method according to an embodiment of the present application, where the method is applied to an MCU, the MCU is connected to N touch keys through N channels, the N channels are in one-to-one correspondence with the N touch keys, and N is an integer greater than 1, as shown in fig. 3, the method includes the following steps:

step S301: the MCU collects voltages on the N channels.

Step S302: if the number of the channels with the voltages smaller than the first voltage in the N channels reaches a first number, or if the number of the channels with the voltages larger than the second voltage in the N channels reaches a second number, the MCU updates the initial reference voltages of the N channels respectively.

Wherein the initial reference voltage of the channel is stored in advance. In this application, the MCU may divide the voltage on the channel corresponding to a certain touch key into a plurality of levels:

reference voltage (Base): indicating that when the touch key is not pressed, the voltage on the channel corresponding to the touch key, i.e. the reference voltage Base, is generally 2048V.

Voltage at start of approach (Proxy Out): indicating the voltage Vout on the channel corresponding to the touch key when the finger starts to approach the touch key.

Voltage at approach (Proxy In): and the voltage Vout of the channel corresponding to the touch key is shown when the finger is close to the touch key. Here, the approach touch key may mean that the touch key has not been touched.

Voltage at start of pressing (Detect Out): indicating the voltage Vout on the channel corresponding to the touch key when the finger starts to press the touch key.

Voltage at the time of pressing (Detect In): and the voltage Vout on the channel corresponding to the touch key is shown when the finger presses the touch key.

Calibration voltage (calibration): indicating that the voltage Vout on the channel corresponding to the touch key is greater than the reference voltage Base on the channel corresponding to the touch key.

Fig. 4 is a schematic diagram of voltages of various levels according to an embodiment of the present application, and as shown in fig. 4, a nominal voltage > a reference voltage > a voltage at the beginning of approaching > a voltage at the beginning of pressing > a voltage at the time of pressing.

It should be noted that the voltage difference between the reference voltage and the voltage at the time of approach may be 200. Under any scenario, the voltage difference values of the respective levels are not changed.

The first voltage is a voltage at the time of approach; the initial reference voltage of the channel is the reference voltage; the second voltage is the above-mentioned nominal voltage.

The following describes the technical solution of the present application with reference to a scene of temperature change:

the temperature is also called temperature drift, which causes capacitance values of all touch keys on the touch device to change, thereby affecting the voltage Vout on the channel corresponding to each touch key. As shown in fig. 2, as the temperature T increases, the voltage Vout on the corresponding channel of the touch key tends to decrease. When the voltage Vout drops to a voltage value that causes Delta to be greater than 200 (i.e., a voltage difference between the reference voltage and the voltage at the time of approach described above), the touch key is erroneously recognized as a case where there is a finger press, i.e., there is a key press problem.

When the temperature rises, capacitance values of all touch keys on the touch equipment change, correspondingly, the voltage Vout on the channel corresponding to each touch key becomes smaller, and due to certain difference of the temperature drift curve of each channel, the MCU counts the Vout values of all channels, and when the number of the channels with the voltages smaller than the first voltage in the N channels reaches the first number, the number of the channels meeting the following conditions reaches the first number: base-the voltage on the channel Vout > Base-the voltage at close. The MCU updates the initial reference voltages of the N channels, respectively. For example, the MCU updates the initial reference voltages of the N channels to the average voltage of the N channels, respectively. Or the MCU respectively updates the initial reference voltages of the N channels to the average voltage of a part of the N channels. Assuming that the voltage Vout of each channel is the same, the updated reference voltage is the voltage on N channels, so that Delta equals to the voltage Vout of the updated Base-channel equals to 0, and since 0 is not greater than 200, the occurrence of a key overflow situation can be prevented.

When the temperature is reduced, capacitance values of all touch keys on the touch equipment are changed, correspondingly, the voltage Vout on the channel corresponding to each touch key is increased, because the temperature drift curve of each channel has a certain difference, the MCU counts the Vout values of all channels, and when the number of the voltages in the N channels, which are greater than the second voltage, reaches the second number, the number of the channels meeting the following conditions reaches the second number: the voltage on the Base-channel Vout < Base-nominal voltage. The MCU updates the initial reference voltages of the N channels, respectively. For example, the MCU updates the initial reference voltages of the N channels to the average voltage of the N channels, respectively. Or the MCU respectively updates the initial reference voltages of the N channels to the average voltage of a part of the N channels. Assuming that the voltage Vout of each channel is the same, the updated reference voltage is the voltage on N channels, so that Delta equals to the voltage Vout of the updated Base-channel equals to 0, and since 0 is not greater than 200, the occurrence of a key overflow situation can be prevented.

The technical scheme of the application is described in combination with a scene that water drops exist on the touch key:

fig. 5 is a schematic diagram of a relationship between an area of a water droplet and a voltage on a channel corresponding to a touch key according to an embodiment of the present application, and as shown in fig. 5, the larger the area of the water droplet, the smaller the voltage on the channel corresponding to the touch key. When the voltage Vout drops to a level that results In Delta being greater than 200 (i.e., the difference between the voltage at BASE level and the voltage at Proxy In level), the touch key is erroneously identified as a finger press, i.e., a key top-off problem.

Since each channel is affected by water drops differently, the MCU counts the Vout values of all the channels, and when the number of channels having a voltage lower than the first voltage among the N channels reaches the first number, the number of channels satisfying the following condition reaches the first number: base-the voltage on the channel Vout > Base-the voltage at close. The MCU updates the initial reference voltages of the N channels, respectively. For example, the MCU updates the initial reference voltages of the N channels to the average voltage of the N channels, respectively. Or the MCU respectively updates the initial reference voltages of the N channels to the average voltage of a part of the N channels. Assuming that the voltage Vout of each channel is the same, the updated reference voltage is the voltage on N channels, so that Delta equals to the voltage Vout of the updated Base-channel equals to 0, and since 0 is not greater than 200, the occurrence of a key overflow situation can be prevented.

The technical scheme of the application is described in combination with a large-area pressing scene as follows:

the larger the pressing area is, the smaller the voltage on the corresponding channel of the touch key is. When the voltage Vout drops to a level that results In Delta being greater than 200 (i.e., the difference between the voltage at BASE level and the voltage at Proxy In level), the touch key is erroneously identified as a finger press, i.e., a key top-off problem.

Because each channel is affected by the pressing differently, the MCU counts the Vout values of all the channels, and when the number of channels with a voltage lower than the first voltage among the N channels reaches the first number, the number of channels satisfying the following condition reaches the first number: base-the voltage on the channel Vout > Base-the voltage at close. The MCU updates the initial reference voltages of the N channels, respectively. For example, the MCU updates the initial reference voltages of the N channels to the average voltage of the N channels, respectively. Or the MCU respectively updates the initial reference voltages of the N channels to the average voltage of a part of the N channels. Assuming that the voltage Vout of each channel is the same, the updated reference voltage is the voltage on N channels, so that Delta equals to the voltage Vout of the updated Base-channel equals to 0, and since 0 is not greater than 200, the occurrence of a key overflow situation can be prevented.

In summary, the present application provides a method for updating a reference voltage, including: the MCU collects voltages on the N channels. If the number of the channels with the voltages smaller than the first voltage in the N channels reaches a first number, or if the number of the channels with the voltages larger than the second voltage in the N channels reaches a second number, the MCU updates the initial reference voltages of the N channels respectively. Delta is made smaller than 200, namely smaller than the voltage difference value between the reference voltage and the voltage when approaching, so that the condition of overflowing the key can be prevented.

If there is a water droplet on the touch button, and the area of the water droplet is small, for example: only one touch key has water drops, and the MCU can update the reference voltage on the channel corresponding to the touch key. The following may provide a reference voltage update method in connection with this scenario, but is not limited to this scenario.

Fig. 6 is a flowchart of a reference voltage updating method according to another embodiment of the present application, where the method is applied to an MCU, the MCU is connected to N touch keys through N channels, and the N channels correspond to the N touch keys one to one, as shown in fig. 6, the method includes the following steps:

step S601: if the number of the channels with the voltages smaller than the first voltage in the N channels does not reach the first number, the MCU determines the duration of the voltage of the target channel smaller than the first voltage aiming at any target channel with the voltages smaller than the first voltage in the N channels.

Step S602: and if the duration is longer than the preset duration, the MCU updates the initial reference voltage of the target channel to obtain the updated reference voltage of the target channel.

Assuming that the first number is 2 and the preset time period is 5 seconds, when only one touch key has water drops, and the number of channels with voltage lower than the first voltage is 1, the MCU may determine, for the channel corresponding to the touch key, that is, the target channel, that the duration of the voltage Vout of the target channel lower than the first voltage is greater than 5 seconds, and update the initial reference voltage of the target channel to the voltage of the target channel to obtain an updated reference voltage Base of the target channel, so that Delta-the voltage Vout of the target channel is 0, and since 0 is not greater than 200, the occurrence of a false key may be prevented.

When the water drops on the touch keys are wiped dry, the MCU needs to update the reference voltage of the target channel again. Specifically, the MCU needs to acquire the voltage of the target channel again to obtain the voltage of the target channel; if the voltage acquired again by the target channel is greater than the updated reference voltage of the target channel, for example, when water drops on the touch key are wiped, the MCU updates the updated reference voltage of the target channel to the initial reference voltage of the target channel.

When a finger pressing operation really exists on the touch key, and the duration of the finger pressing operation is longer than 5 seconds, that is, the duration of the voltage Vout of the target channel being smaller than the first voltage is longer than 5 seconds, the MCU may update the initial reference voltage of the target channel to the voltage of the target channel to obtain the updated reference voltage Base of the target channel, so that Delta-the updated Base-the voltage Vout of the target channel is 0. In order to ensure that the operation corresponding to the touch key is normally triggered, the MCU needs to update the reference voltage of the target channel again. Specifically, the MCU needs to acquire the voltage of the target channel again to obtain the voltage of the target channel; and if the voltage acquired again by the target channel is greater than the updated reference voltage of the target channel, the MCU updates the updated reference voltage of the target channel to the initial reference voltage of the target channel. Therefore, the operation corresponding to the touch key can be normally triggered.

In summary, the present application provides a method for updating a reference voltage, including: if the number of the channels with the voltages smaller than the first voltage in the N channels does not reach the first number, the MCU determines the duration of the voltage of the target channel smaller than the first voltage aiming at any target channel with the voltages smaller than the first voltage in the N channels. And if the duration is longer than the preset duration, the MCU updates the initial reference voltage of the target channel to obtain the updated reference voltage of the target channel. Therefore, the Delta is equal to the voltage Vout of the updated Base-target channel, which is equal to 0, and the situation of false keys can be prevented because 0 is not more than 200. In addition, the technical scheme is not only suitable for the condition that water drops exist on the touch key, but also suitable for the condition that the finger pressing operation really exists on the touch key, and the duration of the finger pressing operation is longer than the preset duration, so that the operation corresponding to the touch key is normally triggered.

It should be noted that when the external environment is very severe, which causes the voltage Vout on the touch key to be too small or too large, the MCU needs to readjust the internal parameters of the capacitive touch sensor, so that the reference voltage on the touch key is 2048.

Fig. 7 is a schematic diagram of an MCU provided in an embodiment of the present application, where the MCU is connected to N touch keys through N channels, and the N channels correspond to the N touch keys one to one, as shown in fig. 7, the MCU includes:

the first collecting module 701 is configured to collect voltages on the N channels.

The first updating module 702 is configured to update the initial reference voltages of the N channels respectively if the number of channels with voltages smaller than the first voltage among the N channels reaches a first number, or if the number of channels with voltages larger than the second voltage among the N channels reaches a second number.

The first voltage is a voltage on a channel corresponding to the touch key when the touch key is pressed under a normal condition. The initial reference voltage of the channel is the voltage on the channel when the touch key corresponding to the channel is not pressed under the normal condition. The second voltage is greater than the initial reference voltage.

Optionally, the MCU further comprises: the determining module 703 is configured to determine, for any target channel of the N channels whose voltage is smaller than the first voltage, a duration that the voltage of the target channel is smaller than the first voltage if the number of channels whose voltages are smaller than the first voltage does not reach the first number.

A second updating module 704, configured to update the initial reference voltage of the target channel if the duration is greater than the preset duration, so as to obtain an updated reference voltage of the target channel.

Optionally, the MCU further comprises: and a second collecting module 705, configured to collect the voltage of the target channel again to obtain a voltage collected again by the target channel.

A third updating module 706, configured to update the updated reference voltage of the target channel again if the reacquired voltage of the target channel is greater than the updated reference voltage of the target channel.

Optionally, the first updating module 702 is specifically configured to: and respectively updating the initial reference voltages of the N channels into the average voltage of the N channels.

Optionally, the second updating module 704 is specifically configured to: and updating the initial reference voltage of the target channel to the voltage of the target channel to obtain the updated reference voltage of the target channel.

Optionally, the third updating module 706 is specifically configured to: and updating the updated reference voltage of the target channel to the initial reference voltage of the target channel.

The MCU provided in the present application can execute the above reference voltage updating method, and the content and effect thereof can refer to the embodiment of the method, which is not described herein again.

The present application further provides an MCU, wherein the MCU is configured to execute the above-mentioned reference voltage updating method, and the content and effect of the MCU can refer to the embodiment of the method, which is not described herein again.

The present application further provides a touch device, exemplarily, the touch device includes: the touch key comprises an MCU and N touch keys, wherein the MCU is connected with the N touch keys through N channels, and the N channels correspond to the N touch keys one to one, for example, as shown in fig. 1, a typical touch key currently exists, which includes: the touch key comprises a key type touch key, a slide bar type touch key and a circular type touch key, for example, keys 0, 1 and 2 in fig. 1 are all key type touch keys, a key 3 is a circular type touch key, and a key 4 is a slide bar type touch key. The slider touch key is formed by 3 touch keys or units, the circular touch key is formed by 4 touch keys or units, and each touch key or unit is connected with the MCU through a channel, for example: the keys 0, 1 and 2 are respectively connected with the MCU through the channels 0, 1 and 2, the key 3 is respectively connected with the MCU through the channels 3, 4, 5 and 6, and the key 4 is respectively connected with the MCU through the channels 7, 8 and 9. The MCU is used to execute the above-mentioned reference voltage updating method, and the content and effect thereof can refer to the embodiment of the method, which is not described herein again.

The present application further provides a readable storage medium, which includes program instructions, and when the program instructions are executed on a computer, the computer executes the above reference voltage updating method, and the content and effect of the method can refer to the embodiment of the method, which is not described herein again.

The present application further provides a computer program product, which includes a program instruction, where the program instruction is used for testing the above-mentioned reference voltage updating method, and the content and effect thereof can refer to the embodiment of the method, which is not described herein again.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种电容式触摸多按键的快速检测方法及系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类