CN111026286A - Anti-interference processing method for capacitive touch keys - Google Patents

Anti-interference processing method for capacitive touch keys Download PDF

Info

Publication number
CN111026286A
CN111026286A CN201910972955.6A CN201910972955A CN111026286A CN 111026286 A CN111026286 A CN 111026286A CN 201910972955 A CN201910972955 A CN 201910972955A CN 111026286 A CN111026286 A CN 111026286A
Authority
CN
China
Prior art keywords
key
executing
interruption
judging whether
processing method
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910972955.6A
Other languages
Chinese (zh)
Inventor
汪蕾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ningbo Fotile Kitchen Ware Co Ltd
Original Assignee
Ningbo Fotile Kitchen Ware Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ningbo Fotile Kitchen Ware Co Ltd filed Critical Ningbo Fotile Kitchen Ware Co Ltd
Priority to CN201910972955.6A priority Critical patent/CN111026286A/en
Publication of CN111026286A publication Critical patent/CN111026286A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/03Arrangements for converting the position or the displacement of a member into a coded form
    • G06F3/041Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
    • G06F3/0416Control or interface arrangements specially adapted for digitisers
    • G06F3/0418Control or interface arrangements specially adapted for digitisers for error correction or compensation, e.g. based on parallax, calibration or alignment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/03Arrangements for converting the position or the displacement of a member into a coded form
    • G06F3/041Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
    • G06F3/044Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means by capacitive means
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03KPULSE TECHNIQUE
    • H03K17/00Electronic switching or gating, i.e. not by contact-making and –breaking
    • H03K17/94Electronic switching or gating, i.e. not by contact-making and –breaking characterised by the way in which the control signals are generated
    • H03K17/96Touch switches
    • H03K17/962Capacitive touch switches

Abstract

An anti-interference processing method of a capacitive touch key is characterized by comprising the following steps: (1) initializing setting, wherein the priority of key interruption is set to be the highest level; (2) judging whether the key interruption flag bit is set, if so, executing the next step; if not, executing the step (4); (3) entering a key interruption program; (4) judging whether other interrupt flag bits are set, if so, executing the next step; if not, executing the step (6); (5) entering other interrupt programs, judging whether a key interrupt flag bit is set, if so, returning to the step (3); if not, continuing the next step; (6) executing the key processing function and starting a next key channel; (7) other procedures are executed, and then the step (2) is returned. The invention has the advantages that: the touch key is improved from software, time consumption is short, design cost is low, the problem of external interference can be solved, and the problem of mutual interference among the touch keys can be solved.

Description

Anti-interference processing method for capacitive touch keys
Technical Field
The invention relates to a capacitive touch key, in particular to an anti-interference processing method of the capacitive touch key.
Background
The capacitive touch key is widely applied to remote controllers, lamp dimming, various switches, control interfaces of vehicle-mounted, small household appliances and the like, and a high-resolution touch detection module and a special signal processing circuit are integrated in a control chip of the capacitive touch key so as to ensure that the chip has sensitive automatic identification and tracking functions on environmental changes.
The principle of the touch key is charge transfer, as shown in fig. 3, which is a schematic diagram of a circuit control of the touch key in the prior art, a finger sensing capacitor Cf and a circuit capacitor Cx form a distributed capacitor Cp on the touch sensing key, when a finger touches the key, the charge of the distributed capacitor Cp on the touch sensing key is transferred to a sensitivity adjustment capacitor Cadj until the voltage on the sensitivity adjustment capacitor Cadj reaches a reference voltage Vref, a comparator is inverted to generate a key interrupt flag bit, and meanwhile, the charging time TKCNT is counted in the charge transfer process. In the prior art, a conventional control flow of a capacitive touch key is as follows: when the touch key is pressed down, a key interruption zone bit is generated, at the moment, interruption processing is carried out to judge whether the key is pressed down, if so, the current key value is obtained and the action is executed; if there are a plurality of interrupts with higher priority levels than the touch key interrupt in the program, while the key interrupt is processed, the program also needs to process other interrupts with higher priority levels (such as other external interrupts like a timer, a serial port UART and the like), which can cause the key interrupt program to be interrupted, the time of each key interrupt entering and exiting is inconsistent, the discharging time of the sensitivity adjusting capacitor Cadj is inconsistent, finally, the charging starting voltages of different key channels will be different, and the charging starting voltages of the same key channel at different times will also be different; while the charging time TKCNT is a time when the sensitivity adjustment capacitor Cadj is charged from the initial voltage to the reference voltage Vref, if the initial voltages are different, the charging time TKCNT is different, and the fluctuation of TKCNT in the actual engineering is large.
In the using process, the touch key is misjudged due to the fluctuation of the TKCNT, interference is possibly judged to be the key, and the anti-interference performance is poor. The anti-interference difference cannot be eliminated through time length judgment due to the fact that the anti-interference difference is caused in principle, when the fluctuation of the TKCNT is large, the key is triggered when the variable quantity reaches the threshold representing the key pressing, and the charge on the capacitor is accumulated continuously due to incomplete discharge of the sensitivity adjusting capacitor Cadj until the charge is accumulated to the reference voltage Vref, and finally the key failure is caused.
In summary, the following solutions are mainly used for the anti-interference of the touch key in the prior art: (1) optimizing PCB wiring; (2) adding filtering treatment; (3) judging whether the key is interfered or pressed according to the pressed time length of the key; (4) and an interference detection channel is added, and the button is considered to be pressed down only when the sampling value of the button sampling channel reaches a set value under the condition that the sampling value of the interference detection channel is not interference.
The method (1) and the method (2) need to modify hardware, and in actual engineering, the method (1) needs to redraw the PCB for continuous verification; the method (2) needs to modify the schematic diagram and redraw the PCB, and does not need to debug the capacitance value for continuous verification. Therefore, the methods (1) and (2) take much time and cannot solve the problem quickly, and cannot solve the interference between the keys; the method (3) can only process whether the interference is external interference or not, but can not process the interference from other key channels, and the problem of poor interference resistance caused in principle can not be solved; the method (4) has multiple judgment levels and can actually resist interference, but if the judgment value of the interference is not set well enough, the anti-interference performance of the key is too good, so that the sensitivity of the key is reduced, the key is not pressed, and the problem of poor anti-interference caused in principle cannot be solved.
Therefore, in order to solve the above problems, further improvement and improvement of the anti-interference processing method for the capacitive touch key needs to be made to improve the anti-interference capability.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide an anti-interference processing method for capacitive touch keys with stronger anti-interference capability, aiming at the current state of the prior art, wherein the anti-interference processing method not only can solve the problem of external interference, but also can solve the problem of mutual interference between keys.
The technical scheme adopted by the invention for solving the technical problems is as follows: an anti-interference processing method of a capacitive touch key is characterized by comprising the following steps:
(1) starting a program, initializing, and setting the priority of key interruption as the highest level of all interruptions;
(2) judging whether the key interruption flag bit is set, if so, executing the next step; if not, executing the step (4);
(3) entering a key interruption program, and starting a next key channel until the key interruption program is finished;
(4) judging whether flag bits of other interrupts (such as a timer, a serial port UART and other external interrupts) are set, if so, executing the next step; if not, executing the step (6);
(5) entering other interrupt programs, judging whether a key interrupt flag bit is set, if so, returning to the step (3); if not, continuing the next step;
(6) executing a key processing function;
(7) executing other programs and then returning to the step (2).
Preferably, the key interruption procedure of step (3) includes the following steps:
(3-1) clearing the key interruption zone bit;
(3-2) starting a timer, and timing the key pressing duration;
(3-3) judging whether the key pressing time length reaches a preset key pressing time length Tb or not, if so, pressing a key, and executing the next step; if not, no key is pressed, and the step (4) is carried out;
(3-4) resetting the timer and processing the key data;
and (3-5) obtaining the key value of the current key operation, and then executing the step (4).
Preferably, the value of the key press duration Tb preset in the step (3-3) is in a range of 50ms to 150 ms.
Preferably, the step (2) of determining whether the key interruption flag bit is set adopts the following method:
(2-1) whether the reference voltage on the sensitivity adjusting capacitor Cadj in the touch key circuit reaches a preset reference voltage Vref or not, and if so, executing the next step; if not, the step is circulated;
and (2-2) reversing the comparator to generate a key interruption flag bit.
Preferably, the preset reference voltage Vref in the step (2-1) has a value range of 3V to 5V.
Compared with the prior art, the invention has the advantages that: the hardware structure does not need to be modified, only the software is improved, the priority of key interruption is set to be the highest, the discharging time of the sensitivity adjusting capacitor Cadj is ensured to be the same after the key interruption program is entered each time, the initial voltage is finally consistent when the key is started each time, the fluctuation of the charging time TKCNT is effectively reduced, the consumed time is short, the design cost is low, the problem of external interference from the key can be solved, and the problem of mutual interference between touch keys can be solved.
Drawings
Fig. 1 is a general flowchart of an anti-interference processing method according to an embodiment of the present invention.
Fig. 2 is a flowchart of a key interrupt processing procedure of the anti-interference processing method according to the embodiment of the present invention.
Fig. 3 is a schematic diagram of a touch key circuit in the prior art.
Detailed Description
The invention is described in further detail below with reference to the accompanying examples.
The basic principle of the touch key is charge transfer, as shown in fig. 3, which is a schematic diagram of a circuit control of the touch key in the prior art, wherein the finger sensing capacitance Cf and the circuit capacitance Cx form a distributed capacitance Cp on the touch sensing key, the process of the touch key transfers the charge of the distributed capacitance Cp on the touch sensing key to the sensitivity adjustment capacitance Cadj, and simultaneously, the timer counts the charging time TKCNT during the charge transfer process until the voltage on the sensitivity adjustment capacitance Cadj reaches a preset reference voltage Vref, and the comparator is inverted to generate an interrupt flag bit.
When no key is pressed down, the distributed capacitance Cp is equal to the circuit capacitance Cx, and the time for transferring Cp charges to the sensitivity adjusting capacitance Cadj is the reference value of the charging time; when a key is pressed down, the distributed capacitance Cp is equal to the circuit capacitance Cx plus the finger sensing capacitance Cf; for reaching the same reference voltage Vref, the smaller the capacitance value of the distributed capacitance Cp, the longer the charging time, the larger the TKCNT value; the larger the value of the distributed capacitance Cp, the shorter the charging time, and accordingly, the smaller the value of TKCNT.
After the interrupt flag bit is generated, the interrupt program starts to read the charging time TKCNT, judges the variation of the charging time TKCNT value (namely the charging time TKCNT after the key is pressed down is different from the charging time reference value when no key is pressed down), starts the timing of the key pressing time duration, considers that the key is pressed down only when the variation of the charging time TKCNT reaches a set threshold and the time duration reaches a preset time, and excludes key touch possibly caused by external interference, so that the external interference resistance of the key is ensured; the threshold for representing the key pressing can be set by the variable quantity of the charging time TKCNT before and after the finger is pressed, so that the sensitivity of the key is ensured.
In the interrupt processing process, the sensitivity adjusting capacitor Cadj is discharged, after the interrupt processing is completed, the sensitivity adjusting capacitor Cadj is not discharged any more, the next key channel is opened, and charge transfer is performed again, at this time, the charging starting voltage of the sensitivity adjusting capacitor Cadj is the voltage after last discharge, and the starting voltage is determined by the discharge time length of the sensitivity adjusting capacitor Cadj in the last interrupt processing process and is not necessarily 0V.
In order to avoid the problem that the charging time TKCNT fluctuates due to inconsistent starting voltages, thereby causing malfunction of the touch keys or mutual interference between the keys, the present embodiment adopts a pure software control method, and designs an anti-interference processing method for the capacitive touch keys, as shown in fig. 1 and fig. 2, the anti-interference processing method includes the following steps:
(1) the method comprises the steps of starting a program, initializing, setting the priority of key interruption to the highest level of all interruptions, namely once key operation is generated, other interruption operations are suspended, key interruption is executed first until the key interruption is finished, and then other interruption operations are executed.
(2) Judging whether the key interruption flag bit is set, if so, executing the next step; if not, executing the step (4).
(3) Entering a key interruption program;
(3-1) clearing the key interruption zone bit;
(3-2) starting a timer, and timing the key pressing duration;
(3-3) judging whether the key pressing time length reaches a preset key pressing time length Tb or not, if so, pressing a key, and executing the next step; if not, no key is pressed, and the step (4) is carried out; wherein the preset keying time Tb ranges from 50ms to 150 ms;
(3-4) resetting the timer and processing the key data;
(3-5) obtaining a key value of the current key operation, and then executing the next step;
and (3-6) starting the next key channel until the key interruption program is finished.
(4) Judging whether other interrupt flag bits are set, if so, executing the next step; if not, executing the step (6);
(5) entering other interrupt programs, judging whether a key interrupt flag bit is set, if so, returning to the step (3); if not, continuing the next step;
(6) executing a key processing function;
(7) executing other programs and then returning to the step (2).
Preferably, the generation of the key interruption flag bit in the step (2) adopts the following method:
(2-1) whether the reference voltage on the sensitivity adjusting capacitor Cadj in the touch key circuit reaches a preset reference voltage Vref or not, and if so, executing the next step; if not, the step is circulated; the value range of the preset reference voltage Vref is 3V-5V;
and (2-2) reversing the comparator to generate a key interruption flag bit.
According to the embodiment, the hardware structure does not need to be modified, the consumed time is short, the design cost is low, only the software is improved, the priority of the key interruption is set to be the highest level, when other interruptions are executed, if the key interruption flag bit is set, other interruption programs can be interrupted, the interruption program executes the key interruption processing program firstly, and then continues to execute other interruption programs after the key interruption processing program is completely finished. Therefore, after the key interruption program is entered each time, the key interruption program can be interrupted without other interruption during processing, the discharging time of the sensitivity adjusting capacitor Cadj is the same, and finally the initial voltage is consistent when the next key is started, so that the fluctuation of the charging time TKCNT is effectively reduced, the problem of external interference from the keys can be solved, the problem of mutual interference among touch keys can be solved, and the whole control method is simple and easy to implement.

Claims (5)

1. An anti-interference processing method of a capacitive touch key is characterized by comprising the following steps:
(1) starting a program, initializing, and setting the priority of key interruption as the highest level of all interruptions;
(2) judging whether the key interruption flag bit is set, if so, executing the next step; if not, executing the step (4);
(3) entering a key interruption program, and starting a next key channel until the key interruption program is finished;
(4) judging whether other interrupt flag bits are set, if so, executing the next step; if not, executing the step (6);
(5) entering other interrupt programs, judging whether a key interrupt flag bit is set, if so, returning to the step (3); if not, continuing the next step;
(6) executing a key processing function;
(7) executing other programs and then returning to the step (2).
2. The anti-interference processing method for the capacitive touch key according to claim 1, wherein: the key interruption program of the step (3) comprises the following steps:
(3-1) clearing the key interruption zone bit;
(3-2) starting a timer, and timing the key pressing duration;
(3-3) judging whether the key pressing time length reaches a preset key pressing time length Tb or not, if so, pressing a key, and executing the next step; if not, no key is pressed, and the step (4) is carried out;
(3-4) resetting the timer and processing the key data;
and (3-5) obtaining the key value of the current key operation, and then executing the step (4).
3. The anti-interference processing method for the capacitive touch key according to claim 2, wherein: and (4) the value range of the key pressing time Tb preset in the step (3-3) is 50 ms-150 ms.
4. The anti-interference processing method for the capacitive touch key according to claim 1, wherein: the step (2) of judging whether the key interruption flag bit is set adopts the following method:
(2-1) whether the reference voltage on the sensitivity adjusting capacitor Cadj in the touch key circuit reaches a preset reference voltage Vref or not, and if so, executing the next step; if not, the step is circulated;
and (2-2) reversing the comparator to generate a key interruption flag bit.
5. The anti-interference processing method for the capacitive touch key according to claim 4, wherein: the value range of the preset reference voltage Vref in the step (2-1) is 3V-5V.
CN201910972955.6A 2019-10-14 2019-10-14 Anti-interference processing method for capacitive touch keys Pending CN111026286A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910972955.6A CN111026286A (en) 2019-10-14 2019-10-14 Anti-interference processing method for capacitive touch keys

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910972955.6A CN111026286A (en) 2019-10-14 2019-10-14 Anti-interference processing method for capacitive touch keys

Publications (1)

Publication Number Publication Date
CN111026286A true CN111026286A (en) 2020-04-17

Family

ID=70205070

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910972955.6A Pending CN111026286A (en) 2019-10-14 2019-10-14 Anti-interference processing method for capacitive touch keys

Country Status (1)

Country Link
CN (1) CN111026286A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102185602A (en) * 2011-03-01 2011-09-14 无锡和晶科技股份有限公司 Refrigerator controller touch button sampling method
CN106933661A (en) * 2017-02-27 2017-07-07 百富计算机技术(深圳)有限公司 A kind of method and apparatus of debugging embedded system multiple interrupt
CN109039319A (en) * 2018-08-13 2018-12-18 中科芯集成电路股份有限公司 A kind of anti-interference capacitor formula touch key-press controller and implementation method
CN109918179A (en) * 2017-12-13 2019-06-21 合肥欣奕华智能机器有限公司 A kind of button processing method, equipment and system
CN110324033A (en) * 2019-06-20 2019-10-11 杭州九阳小家电有限公司 The key response method of cooking apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102185602A (en) * 2011-03-01 2011-09-14 无锡和晶科技股份有限公司 Refrigerator controller touch button sampling method
CN106933661A (en) * 2017-02-27 2017-07-07 百富计算机技术(深圳)有限公司 A kind of method and apparatus of debugging embedded system multiple interrupt
CN109918179A (en) * 2017-12-13 2019-06-21 合肥欣奕华智能机器有限公司 A kind of button processing method, equipment and system
CN109039319A (en) * 2018-08-13 2018-12-18 中科芯集成电路股份有限公司 A kind of anti-interference capacitor formula touch key-press controller and implementation method
CN110324033A (en) * 2019-06-20 2019-10-11 杭州九阳小家电有限公司 The key response method of cooking apparatus

Similar Documents

Publication Publication Date Title
CN103109196B (en) Method and device for sensing capacitance change and method and device for sensing touch
JP4981120B2 (en) Method and related apparatus for detecting a touch event on a touch panel
CN104794433A (en) Fingerprint recognition system and fingerprint recognition method
CN103389847B (en) Touch control terminal and anti-interference method and system thereof
CN108259044B (en) Touch key scanning method and device and computer readable storage medium
CN109274363B (en) Key judging system of capacitive touch key
CN102841715A (en) Capacitive touch sensor and touch control terminal and anti-interference method and system thereof
CN111352534B (en) Touch key touch threshold correction method, wire controller, electric appliance and computer readable storage medium
CN102915151A (en) Method for adjusting sensitivity of touch screen and portable electronic device
TW201839576A (en) Touch sensor-type electronic device and sensor control method
CN102855033A (en) Touch control device and control method thereof
CN110084082B (en) Electronic equipment, fingerprint identification device and finger touch detection circuit thereof
CN103543344A (en) Method for solving failure of capacitive screen and capacitive screen anomaly detection circuit
CN112073047A (en) Capacitive touch key system and control method thereof
US8378987B2 (en) Sensing method and circuit for a capacitive touch panel
CN101626246A (en) Touch-control method and touch-control device
CN111026286A (en) Anti-interference processing method for capacitive touch keys
CN104184449A (en) Capacitive touch control apparatus, method, and system
CN105306038A (en) Capacitive sensing touch control key and key judging method thereof
CN112199232A (en) Fuse starting address identification fault-tolerant method
CN113126815A (en) Key response control method and device, terminal equipment and storage medium
CN108391261A (en) A kind of bluetooth discovery detection method, detection device, storage medium and mobile terminal
CN2938571Y (en) Electric load tranfer device, touch induction device
CN114325481B (en) Power-off duration detection method and device, electronic equipment and storage medium
CN110739952A (en) method for reducing interference between capacitive touch keys

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200417