Disclosure of Invention
The present invention is directed to a touch anti-interference method, a chip, a circuit, a storage medium and a program product, which are used for solving the above problems in the prior art.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
in a first aspect, a touch anti-interference method is provided, including:
The method comprises the steps that a first working parameter sampling value of a touch module is collected in real time through a touch channel, a second working parameter sampling value of a detection module is collected in real time through a detection channel, the touch module and the detection module are touch sensing devices with the same configuration, and the connected working power supplies are the same;
Calling a preset detection channel parameter reference value;
Calculating to obtain corrected touch parameter values according to the first working parameter sampling value, the second working parameter sampling value and the detection channel parameter reference value;
and performing touch control output based on the touch parameter value.
In one possible design, the collecting, in real time, the first operation parameter sampling value of the touch module through the touch channel, and collecting, in real time, the second operation parameter sampling value of the detection module through the detection channel, includes:
the switch corresponding to one signal sampling channel is controlled to be connected with the touch module in a conducting manner, the signal sampling channel after being connected with the touch module in a conducting manner is used as a touch channel, the switch corresponding to the other signal sampling channel is controlled to be connected with the detection module in a conducting manner, and the signal sampling channel after being connected with the detection module in a conducting manner is used as a detection channel;
the first working parameter sampling value of the touch module is acquired in real time through the touch channel, and the second working parameter sampling value of the detection module is acquired in real time through the detection channel.
In one possible design, before retrieving the preset detection channel parameter reference value, the method further includes:
and electrifying the touch module and the detection module, collecting a plurality of initial working parameter sampling values of the detection module through the detection channel before the touch module is touched, and taking the average value of the initial working parameter sampling values as a detection channel parameter reference value.
In one possible design, the calculating the corrected touch parameter value according to the first operation parameter sampling value, the second operation parameter sampling value and the detection channel parameter reference value includes:
Substituting the first working parameter sampling value, the second working parameter sampling value and the detection channel parameter reference value into a preset touch parameter correction formula to calculate to obtain a corrected touch parameter value, wherein the touch parameter correction formula is S=C 1-(C2 -R, S is the corrected touch parameter value, C 1 is the first working parameter sampling value, C 2 is the second working parameter sampling value, and R is the detection channel parameter reference value.
In one possible embodiment, the first operating parameter sample value comprises a first operating voltage sample value, the second operating parameter sample value comprises a second operating voltage sample value, and the detection channel parameter reference value comprises a detection channel voltage reference value.
In a second aspect, a touch anti-interference chip is provided, where the chip includes a touch module, a detection module, and a processor, where the processor is respectively connected to the touch module and the detection module, and the processor is configured to execute any one of the methods in the first aspect.
In one possible design, the chip employs an MCU chip.
In a third aspect, a touch anti-interference circuit is provided, including a touch module, a detection module and a processor, the processor is provided with a plurality of signal sampling channels, each signal sampling channel is provided with a change-over switch, the change-over switch includes a stationary end and two movable ends, the stationary end is connected with the signal sampling channel, the two movable ends are respectively connected with the touch module and the detection module, and the processor is used for executing the method according to any one of the first aspects.
In a fourth aspect, there is provided a storage medium having stored thereon instructions which, when executed on a processor, cause the processor to perform the method of any of the first aspects. Also provided is a program product for performing the method of any of the first aspects when the program product is run on a processor.
The touch control device has the beneficial effects that the touch module and the detection module with the same configuration are combined and applied to the touch control chip, the detection parameters of the detection module are utilized to calibrate the touch parameters of the touch module in real time, so that the influence of external strong interference can be eliminated, a good touch control anti-interference effect is achieved, the problem of false touch triggering caused by the jump of a touch value due to external interference is effectively solved, the touch control chip can normally operate, an anti-interference circuit is not required to be additionally arranged, and the cost can be effectively saved.
Detailed Description
It should be noted that the description of these examples is for aiding in understanding the present invention, but is not intended to limit the present invention. Specific structural and functional details disclosed herein are merely representative of example embodiments of the invention. This invention may, however, be embodied in many alternate forms and should not be construed as limited to the embodiments set forth herein.
It will be understood that, unless explicitly stated and limited otherwise, the term "connected" shall be interpreted broadly, as referring to a fixed connection, a removable connection, or an integral connection, as referring to an electrical connection, as referring to a direct connection, as referring to an indirect connection via an intermediary, as referring to a communication between two elements. The specific meaning of the terms in the embodiments can be understood by those of ordinary skill in the art according to the specific circumstances.
In the following description, specific details are provided to provide a thorough understanding of example embodiments. However, it will be understood by those of ordinary skill in the art that the example embodiments may be practiced without these specific details. For example, means may be shown in the block diagrams in order to avoid obscuring the examples with unnecessary detail. In other embodiments, well-known processes, structures, and techniques may be shown without unnecessary detail in order to avoid obscuring the embodiments.
Example 1:
The embodiment provides a touch anti-interference method, which can be used for a processor of a touch chip, as shown in fig. 1, and comprises the following steps:
S1, acquiring a first working parameter sampling value of a touch module in real time through a touch channel, and acquiring a second working parameter sampling value of a detection module in real time through a detection channel, wherein the touch module and the detection module are touch sensing devices with the same configuration, and the connected working power supplies are the same. When the touch module is used for touch application, the processor can control the switch corresponding to one signal sampling channel to be connected with the touch module in a conducting manner, and control the switch corresponding to the other signal sampling channel to be connected with the detection module in a conducting manner by taking the signal sampling channel after being connected with the touch module as the touch channel, and take the signal sampling channel after being connected with the detection module as the detection channel. And then the first working parameter sampling value of the touch module is acquired in real time through the touch channel, and the second working parameter sampling value of the detection module is acquired in real time through the detection channel. The first operating parameter sample value comprises a first operating voltage sample value, and the second operating parameter sample value comprises a second operating voltage sample value.
S2, calling a preset detection channel parameter reference value. In specific implementation, before the reference value of the detection channel parameter is called, the touch module and the detection module are electrified, and before the touch module is touched and used, the detection channel is used for collecting the initial working parameter sampling values of the detection module for a plurality of times (such as 10 times), and the average value of the initial working parameter sampling values is used as the reference value of the detection channel parameter, wherein the initial working parameter sampling values comprise initial working voltage sampling values, and the detection channel parameter reference value comprises the reference value of the detection channel voltage.
S3, calculating to obtain corrected touch parameter values according to the first working parameter sampling value, the second working parameter sampling value and the detection channel parameter reference value. In specific implementation, the first working parameter sampling value, the second working parameter sampling value and the detection channel parameter reference value are substituted into a preset touch parameter correction formula to be calculated, so as to obtain a corrected touch parameter value, wherein the touch parameter correction formula is s=c 1-(C2 -R, S is the corrected touch parameter value, C 1 is the first working parameter sampling value, C 2 is the second working parameter sampling value, and R is the detection channel parameter reference value.
And S4, performing touch control output based on the touch parameter value. And finally, the touch chip generates a corresponding touch signal based on the touch parameter value to realize touch output.
According to the method, the touch module and the detection module which are configured in the same way are combined and applied to the touch chip, the detection parameters of the detection module are utilized to calibrate the touch parameters of the touch module in real time, so that the influence of external strong interference can be eliminated, a good touch anti-interference effect is achieved, the problem of false touch triggering caused by the jump of a touch value due to external interference is effectively solved, the touch chip can normally operate, an anti-interference circuit is not required to be additionally arranged, and the cost can be effectively saved.
Example 2:
The embodiment provides a touch anti-interference chip, as shown in fig. 2, including a touch module, a detection module, a processor, a memory and a data interface, wherein:
the data interface is used for establishing signal butt joint between the processor and the touch module and between the processor and the detection module;
a memory for storing instructions;
And the processor is used for reading the instructions stored in the memory and executing the touch anti-interference method in the embodiment 1 according to the instructions.
Optionally, the chip adopts an MCU chip.
Optionally, the chip further includes an internal bus through which the processor and the memory and the data interface may be interconnected, the internal bus may be an ISA (Industry Standard Architecture ) bus, a PCI (PERIPHERAL COMPONENT INTERCONNECT, peripheral component interconnect standard) bus, or an EISA (Extended Industry Standard Architecture ) bus, etc. The buses may be classified as address buses, data buses, control buses, etc. The Memory may include, but is not limited to, random access Memory (Random Access Memory, RAM), read Only Memory (ROM), flash Memory (Flash Memory), first-in first-Out Memory (First Input First Output, FIFO), and/or first-in last-Out Memory (FIRST IN LAST Out, FILO), etc. The Processor may be a central processing unit (Central Processing Unit, CPU), or may be a digital signal Processor (DIGITAL SIGNAL Processor, DSP), application Specific Integrated Circuit (ASIC), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components.
The conventional touch MCU touch part only has a single touch module, the touch channels can be scanned circularly and cannot be scanned simultaneously, and parameters of the touch modules can change in real time after being interfered, so that the internal voltages of touches are not synchronous when different touch channels are scanned. For example, as shown in fig. 3, the touch portion of the conventional touch MCU is different touch channels, and K1-TK4 are corresponding switches connected to the touch channels, and the switches can only be connected to the touch module or disconnected, and the touch channels can only scan one channel at a time, so that the touch parameter value of the current channel can be obtained after the channel scanning is completed.
The embodiment also provides a touch anti-interference circuit, which comprises a touch module, a detection module and a processor, wherein the processor is provided with signal sampling channels, each signal sampling channel is provided with a change-over switch, each change-over switch comprises a fixed end and two movable ends, the fixed ends are connected with the signal sampling channels, the two movable ends are respectively connected with the touch module and the detection module, and the processor is used for executing the touch anti-interference method in the embodiment 1. As shown in FIG. 4, a touch module is added on the basis of the existing touch module, the added touch module is used as a detection module, the detection module is configured the same as the touch module, when the touch parameters of the touch module and the detection module are changed by external interference, the interference degrees of the touch module and the detection module are consistent, and in addition, the problem of interference synchronization is to be realized, so that a signal sampling channel can be connected to the touch module and also can be connected to the detection module. Namely TK1-TK4 are different signal sampling channels, K1-K4 are switches connected with corresponding signal sampling channels, the switches are similar to single-pole double-throw switches, a touch module can be connected with a detection module, when a certain signal sampling channel is used as the touch channel for touch scanning, another signal sampling channel can be used as the detection channel for scanning, synchronous sampling can be guaranteed, the detection module is identical to the touch module in configuration, when the parameters of the touch module are changed due to external interference, the parameters of the detection module and the parameters of the touch module are changed together, and the change amplitude caused by interference is identical. When the touch scanning of the signal sampling channel TK1 and the detection scanning of the signal sampling channel TK2 are completed simultaneously, the signal sampling channel TK1 is used as a detection channel, the signal sampling channel TK2 is used as a touch channel for continuous detection, so that normal scanning of all the signal sampling channels can be ensured, and meanwhile, the initial working parameter sampling value of the detection channel is used as a detection channel parameter reference value to calibrate the parameter sampling value of the touch channel.
Example 3:
The present embodiment provides a storage medium having stored thereon instructions that, when executed on a processor, cause the processor to perform the touch anti-interference method of embodiment 1. The storage medium refers to a carrier for storing data, and may include, but is not limited to, a flash Memory, a flash disk, and/or a Memory Stick (Memory Stick), etc., where the processor may be a general purpose processor, a special purpose processor, a processor network, or other programmable devices.
The present embodiment also provides a program product that, when run on a processor, performs the touch anti-tamper method of embodiment 1. Wherein the processor may be a general purpose processor, a special purpose processor, a network of processors, or other programmable device.
Finally, it should be noted that the above description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.