Utility model content
First of the utility model is designed to provide a kind of anti-interference detection device of capacitance type touch key, reduces outer
The influence that portion's environmental disturbances update baseline value.
To realize first purpose, the utility model is provided the following technical solutions:
A kind of anti-interference detection device of capacitance type touch key, including timing sampling unit, key detection unit, baseline value
Detection unit, baseline value updating unit, third switch and the 4th switch;The sampled value output end of timing sampling unit with it is described
The input terminal connection of the input terminal of third switch, the input terminal of the 4th switch and the key detection unit;The third is opened
The output end of pass is connect with the input terminal of the baseline value detection unit;The output end of the key detection unit and the third
The control signal input of switch connects;The output end of the baseline value detection unit and the control signal of the 4th switch are defeated
Enter end connection;The output end of 4th switch is connect with the input terminal of the baseline value updating unit;
The timing sampling unit scan capacitance type touch key exports sampled value;The key detection unit is for examining
Whether the sampled value for surveying the timing sampling unit output is greater than key threshold value, and when the sampled value is greater than key threshold value,
The third switch is controlled to disconnect;Whether the sampled value that the baseline value detection unit is used to detect the third switch output is big
It is less than or equal to baseline value boundary in baseline value boundary, and in the sampled value, or, the sampled value is greater than time on baseline value boundary
When number is more than baseline value confirmation number, control the described 4th is closed the switch;The baseline value updating unit receives the described 4th and opens
The sampled value of output is closed, baseline value is updated.
As specific embodiment, the baseline value detection unit includes the 8th comparator, the 9th comparator, the tenth ratio
Decision unit is updated compared with device, the second counter and the first baseline value;Two input terminals of the 8th comparator receive respectively
The sampled value of baseline value boundary and third switch output;The output end and second counter of 8th comparator
Trigger signal input terminal connection;The output end of second counter is connect with an input terminal of the tenth comparator,
Another input terminal of tenth comparator receives baseline value and confirms number;Two input terminals of the 9th comparator are distinguished
Receive the sampled value on baseline value boundary and third switch output;The output end and the described tenth of 9th comparator
Two input terminals that the output end of comparator updates decision unit with first baseline value respectively are connect;
8th comparator is greater than for determining whether the sampled value is more than baseline value boundary in the sampled value
When the baseline value boundary, triggers second counter and count;Tenth comparator is for determining second counter
Whether the count value of output reaches baseline value confirmation number;9th comparator is for determining whether the sampled value is more than base
Line value boundary;When the tenth comparator determines that the count value of second counter output reaches baseline value confirmation number, or,
When 9th comparator determines that the sampled value is less than the baseline value boundary, first baseline value updates decision unit control
The described 4th is made to close the switch.
As specific embodiment, it is second or door that first baseline value, which updates decision unit,;When the sampled value
Greater than the baseline value boundary, and the count value reaches baseline value confirmation number, and the tenth comparator exports high level;When
The sampled value is less than or equal to baseline value boundary, and the 9th comparator exports high level;Described second or door export high level
When, the described 4th closes the switch;
Or, it is second and door that first baseline value, which updates decision unit,;When the sampled value is greater than the baseline value side
Boundary, and when the count value reaches baseline value confirmation number, the tenth comparator exports low level;When the sampled value is less than
When equal to baseline value boundary, the 9th comparator exports low level;Described second with door output low level when, the described 4th opens
It closes and closes.
As specific embodiment, the key detection unit includes the 6th comparator;The two of 6th comparator
A input terminal receives key threshold value and sampled value respectively, the 6th comparator by the sampled value and the key threshold value into
Row compares;When the sampled value is greater than the key threshold value, the 6th comparator controls the third switch and disconnects.
As specific embodiment, the key detection unit further includes the 7th comparator and the first counter;Institute
The trigger signal input terminal for stating the first counter is connect with the output end of the 6th comparator;Two of 7th comparator
Input terminal receives the count value of key confirmation number and first counter output, output end output key control letter respectively
Number;6th comparator triggers first counter and counts when the sampled value is greater than the key threshold value;Described
Seven comparators are used to determine whether the count value of the first counter output to reach key confirmation number, and in the count value
When reaching the key confirmation number, output key controls signal, and control executes button operation.
Further, when the sampled value is greater than the key threshold value, the 6th comparator exports high level/low electricity
It is flat, it triggers first counter and counts;It is described when the count value of first counter output reaches key confirmation number
The output of 7th comparator is high level/low level by key control signal, and control executes button operation.
Further, the detection device further includes that timing unit and baseline value update judging unit;The baseline value
Judging unit is updated to be connected between the baseline value detection unit and the 4th switch;The baseline value updates judging unit
Two input terminals are connect with the output end of the output end of the baseline value detection unit and the timing unit respectively, output end
It is connect with the control signal input of the 4th switch;The timing unit is for determining whether to reach timing;It is described
Baseline value updates judging unit and closes the switch or disconnect for controlling the described 4th;
When the baseline value detection unit detects that the sampled value of the third switch output is less than or equal to baseline value boundary
Or it is more than baseline value confirmation number that the sampled value, which is greater than the number on baseline value boundary, and, the timing unit judgement reaches fixed
When the time when, the baseline value updates judging unit control the described 4th and closes the switch.
As specific embodiment, it is first and door that the baseline value, which updates judging unit, when the baseline value detects
Unit detects that the sampled value of the third switch output is less than or equal to baseline value boundary or the sampled value is greater than baseline value side
When the number on boundary is more than baseline value confirmation number, the baseline value detection unit exports high level;When the timing unit determines
When reaching timing, the timing unit exports high level;Described first with door output high level when, it is described 4th switch close
It closes;
Or, it is first or door that the baseline value, which updates judging unit, when the baseline value detection unit detects described the
The sampled value of three switch outputs is less than or equal to baseline value boundary or the sampled value is greater than the number on baseline value boundary more than baseline
When value confirmation number, the baseline value detection unit exports low level;When timing unit judgement reaches timing, institute
State timing unit output low level;Described first or door output low level when, the described 4th closes the switch.
Further, the detection device further includes controlling of sampling unit;The input terminal of the controlling of sampling unit receives
Sampled value, output end export sampling control signal and connect to the control signal input of the timing sampling unit;The timing
The control signal output of sampling unit is connect with the control signal input of the timing unit;The controlling of sampling unit is used
Whether it is less than baseline value in the judgement sampled value, and when the sampled value is less than baseline value, controls the timing sampling list
Member accelerates sampling rate;When the timing sampling unit accelerates sampling rate, the timing sampling unit controls the timing
Unit shortens timing.
As specific embodiment, the timing unit includes timer, third counter, the generation of timing judgment condition
Unit and the 11st comparator;The output end of the timer is connect with the input terminal of third counter, third counter pair
Timer is counted, and exports count value to an input terminal of the 11st comparator;The timing judgment condition generates single
The input terminal of member receives the timing controling signal of the timing sampling unit output, and output end exports timing judgment condition to described
Another input terminal of 11st comparator;11st comparator is adjudicated for determining whether the timer reaches timing
Condition;The timing sampling unit reduces the numerical value of timing judgment condition by controlling the timing judgment condition generation unit,
Shorten the timing of the timing unit.
Further, the detection device further includes noise detection unit and the 5th switch;5th switch is connected into
Between the output end of the timing sampling unit and the input terminal of the controlling of sampling unit;The input of the noise detection unit
End is connect with the output end of the timing sampling unit, and output end is connect with the control signal input of the 5th switch;Institute
Noise detection unit is stated for determining whether the sampled value of timing sampling unit output is greater than noise threshold, and big in the difference
When the noise threshold, controls the 5th switch and disconnect.
Further, the detection device further includes noise detection unit and second switch;The second switch is connected into
Between the output end of the timing sampling unit and the input terminal of key detection unit;The input terminal of the noise detection unit with
The output end of the timing sampling unit connects, and output end is connect with the control signal input of the second switch;It is described to make an uproar
Sound detection unit is used to determine whether the sampled value of timing sampling unit output to be greater than noise threshold, and is greater than institute in the difference
When stating noise threshold, controls the second switch and disconnect.
Further, the detection device further includes that sampled value stablizes judging unit and first switch;Described first opens
Correlate the common end into the output end of the timing sampling unit and third switch, the 4th switch and key detection unit
Between;The input terminal that the sampled value stablizes judging unit is connect with the output end of the timing sampling unit, output end and institute
State the control signal input connection of second switch;The sampled value stablizes judging unit for determining that timing sampling unit exports
Multiple sampled values in maximum sampled value and the difference of minimum sampled value whether be greater than preset difference value, and be greater than in the difference
When the preset difference value, controls the first switch and disconnect.
Further, the detection device further includes average filter unit;The average filter unit is connected into the timing
Between the output end of sampling unit and the common end of third switch, the 4th switch and key detection unit;It is described average
Multiple sampled values that filter unit exports the timing sampling unit are averaged, and are exported average sample value and are opened to the third
Pass, the 4th switch and key detection unit.
Further, the detection device further includes digital filtering unit;The digital filtering unit is connected into the timing
Between the output end of sampling unit and the common end of third switch, the 4th switch and key detection unit;The number
Filter unit carries out digital filtering to the sampled value that the timing sampling unit exports, and exports filtering sampling value and opens to the third
Pass, the 4th switch and key detection unit.
As specific embodiment, the digital filtering unit includes the first multiplier, the second multiplier, the first addition
Device and filtering sampling value register;Two input terminals of first multiplier receive average sample value respectively and first multiply
The method factor 1/K, K=2q, q is positive integer;The output end of the output end of first multiplier and second multiplier point
It is not connect with two input terminals of the first adder;The output end of the first adder and the filtering sampling value are deposited
The input terminal of device connects;One input terminal of second multiplier receives the second multiplication factor (K-1)/K, another input terminal
It is connect with the output end of the filtering sampling value register, the filtering sampling value register feeds back the result of last time filtering
To second multiplier, by repeatedly filtering output filtering sampling value.
Further, the detection device further includes that sampled value stablizes judging unit, average filter unit, digital filtering list
Member, noise detection unit, timing unit, baseline value update judging unit, first switch, second switch and the 5th switch;Institute
State the sampled value output end of timing sampling unit and the sampled value stablize judging unit input terminal and first switch it is defeated
Enter end connection;The output end that the sampled value stablizes judging unit is connect with the control signal input of the first switch;Institute
The output end for stating first switch is connect with the input terminal of the average filter unit;The output end of the average filter unit and institute
State the input terminal of digital filtering unit and the input terminal connection of the noise detection unit;The output of the digital filtering unit
It holds and is connect with the input terminal of the second switch, third switch, the 4th switch and the 5th switch;The output of the second switch
End is connect with the input terminal of the key detection unit;The input of the output end and the controlling of sampling unit of 5th switch
End connection;The control signal input of the output end of the noise detection unit and the second switch and the 5th switch connects
It connects;The baseline value update two input terminals of judging unit respectively with the output end of the baseline value detection unit and described
The output end of timing unit connects, and output end is connect with the control signal input of the 4th switch;The timing unit is used
In determining whether to reach timing;The baseline value updates judging unit and closes the switch or disconnect for controlling the described 4th;
The control signal output of the timing sampling unit is connect with the control signal input of the timing unit;
The sampled value stablizes judging unit and is used to determine that the maximum in multiple sampled values of timing sampling unit output to be adopted
Whether the difference of sample value and minimum sampled value is greater than preset difference value, and when the difference is greater than the preset difference value, controls institute
State first switch disconnection;Multiple sampled values that the average filter unit exports the timing sampling unit are averaged, defeated
Average sample value gives the digital filtering unit and noise detection unit out;The digital filtering unit is to the average filter
The average sample value of unit output carries out digital filtering, exports filtering sampling value to the second switch;The noise measuring list
Whether average sample value of the member for detecting the output of average filter unit is more than noise threshold, and is more than in the average sample value
When the noise threshold, controls the second switch and disconnect;It is defeated that the key detection unit is also used to detect the second switch
Whether filtering sampling value out is greater than key threshold value, and is more than that key is true in the number that the filtering sampling value is greater than key threshold value
When recognizing number, control executes button operation;The controlling of sampling unit for determining whether filtering sampling value is less than baseline value, and
When filtering sampling value is less than baseline value, control timing sampling unit accelerates sampling rate;When the timing sampling unit is accelerated
When sampling rate, timing sampling unit controls timing unit and shortens timing.
Second of the utility model is designed to provide a kind of capacitance type touch key anti interference detection method, reduces outer
The influence that portion's environmental disturbances update baseline value.
To realize second purpose, the utility model is provided the following technical solutions:
A kind of capacitance type touch key anti interference detection method, comprising the following steps:
(1) start;
(2) each module initialization;
(3) noise threshold, key threshold value and baseline value boundary are set;
(4) timing sampling unit scan touch key-press obtains the capacitance of touch key-press;
(5) timing sampling unit exports multiple sampled values and gives sampled value stabilization judging unit;
(6) the stable judging unit of sampled value determines that the difference of maximum sampled value and minimum sampled value in multiple sampled values is
It is no to be greater than preset difference value, if so, (7) are entered step, if it is not, entering step (8);
(7) average filter unit does not receive multiple sampled values of timing sampling unit output, return step (4);
(8) average filter unit receives multiple sampled values of timing sampling unit output;
(9) average filter unit exports average sample value to digital filtering unit, noise detection unit;
(10) whether noise detection unit detection average sample value is greater than noise threshold, if so, (11) are entered step, if
It is no, enter step (12) and step (26);
(11) key detection unit and controlling of sampling unit do not receive the filtering sampling value of digital filtering unit output, return
It returns step (4);
(12) key detection unit receives the filtering sampling value of digital filtering unit output;
(13) whether key detection unit detection filter sampled value is greater than key threshold value, if so, entering step (14) and walking
Suddenly (17), if it is not, entering step (16) and step (18);
(14) whether the number that key detection unit detection filter sampled value is greater than key threshold value reaches key confirmation number,
If so, (15) are entered step, if it is not, entering step (16);
(15) key operation unit executes button operation, return step (4);
(16) key operation unit does not execute button operation, return step (4);
(17) baseline value detection unit does not receive the filtering sampling value of digital filtering unit output, enters step (25);
(18) baseline value detection unit receives the filtering sampling value of digital filtering unit output;
(19) whether baseline value detection unit detection filter sampled value is greater than baseline value boundary, if so, (20) are entered step,
If it is not, entering step (21);
(20) whether the number that baseline value detection unit detection filter sampled value is greater than baseline value boundary it is true reach baseline value
Number is recognized, if so, (21) are entered step, if it is not, entering step (24);
(21) whether timing unit reaches timing, if so, (22) are entered step, if it is not, entering step (24);
(22) baseline value updating unit receives the filtering sampling value of digital filtering unit output;
(23) baseline value updating unit updates baseline value, return step (4);
(24) baseline value updating unit does not receive the filtering sampling value of digital filtering unit output;
(25) baseline value updating unit does not update a reference value return step (4);
(26) whether controlling of sampling unit detection filter sampled value is less than baseline value, if so, entering step (27) and step
(28), if it is not, return step (4);
(27) timing sampling unit improves sampling rate, return step (4);
(28) timing unit shortens timing, enters step (21).
The utility model has the beneficial effects that
The utility model baseline value detection device is less than baseline value boundary Control the 4th in sampled value and closes the switch, a reference value
Updating unit updates a reference value, and when sampled value is greater than baseline value boundary, need sampled value to be greater than the number on baseline value boundary
Reach baseline value confirmation number and just update a reference value, reduces the risk that environmental disturbances cause a reference value mistake to update.Further,
The utility model confirms number by setting button, when the number that only sampled value is greater than key threshold value reaches key confirmation number
Button operation is just executed, reducing environmental disturbances leads to the risk of detection error.Further, the utility model controlling of sampling unit
When detecting that sampled value is less than baseline value, the sampling rate of timing sampling unit is improved, timing is shortened by timing sampling unit
The timing of unit accelerates the speed that declines after baseline value increases, further decrease continuous several times touch capacitance touch by
The influence that key detects baseline value.Further, the utility model noise detection unit is by determining average filter output
Whether average sample value is greater than noise threshold, and control the 5th is closed the switch or disconnected so that controlling of sampling unit will not detect it is super
The sampled value of noise threshold out prevents from carrying out the noise generated under the action of environmental disturbances.The utility model noise measuring
Unit controls second switch closing or opening, so that key detection unit is not by determining whether sampled value is greater than noise threshold
The sampled value beyond noise threshold can be detected, prevents from carrying out the noise generated under the action of environmental disturbances key detection, drop
The risk of low detection error.Further, the utility model sampled value stablizes judging unit by determining that timing sampling unit is defeated
Whether the maximum sampled value of multiple sampled values out and the difference of minimum sampled value are greater than preset difference value, control first switch closure
Or disconnect, so that first switch can only export multiple sampled values that difference is less than preset difference value, prevent to the work in environmental disturbances
Key detection is carried out with the unstable sampled value of lower generation and baseline value updates, and reduces detection error and a reference value mistake
The risk of update.Further, the utility model is averaged multiple sampled values by average filter unit, and it is dry to reduce environment
Disturb the risk for influencing sampled value.The utility model carries out digital filtering to sampled value by digital filtering unit, and it is dry to reduce environment
Disturb the risk for influencing sampled value.Further, the utility model is filtered by multi-stage digital, and the effect of filtering environmental interference is more
It is good.Further, after the utility model average filter unit filters out maximum sampled value and minimum sampled value in multiple sampled values
It is averaged, readily available more stable average sample value.
Specific embodiment
With reference to the accompanying drawing, the present invention will be described in detail.
In order to which the purpose of the present invention, technical solution, advantage is more clearly understood, with reference to the accompanying drawings and embodiments to this
Invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, not
For limiting the present invention.
As shown in Figure 1, a kind of anti-interference detection device of capacitance type touch key includes timing sampling unit, controlling of sampling list
Member, timing unit, sampled value stablize judging unit, average filter unit, digital filtering unit, noise detection unit, noise threshold
It is worth generation unit, key detection unit, key threshold value generation unit, baseline value detection unit, baseline value boundary generation unit, base
It is single that line value updating unit, first switch, second switch, third switch, the 4th switch, the 5th switch and baseline value update judgement
Member.
As shown in Figure 1, the sampled value output end of timing sampling unit and sampled value stablize judging unit input terminal and
The input terminal of first switch connects;The timing controling signal output end of timing sampling unit and the timing controling signal of timing unit
Input terminal connection, controls the timing of timing unit;Sampled value stablizes the output end of judging unit and the control of first switch
Signal input part connection, controls first switch closing or opening;The output end of first switch and the input terminal of average filter unit
Connection;The output end of average filter unit and the input terminal of digital filtering unit and an input terminal of noise detection unit connect
It connects;The input terminal of the output end of digital filtering unit and second switch, the input terminal of third switch, the 4th switch input terminal with
And the 5th switch input terminal connection;The output end of noise detection unit and the control signal input of second switch and the 5th
The control signal input of switch connects, and controls second switch and the 5th closes the switch or disconnect;The output end of second switch
It is connect with an input terminal of key detection unit;One output end output key operation signal of key detection unit is to key
Operating unit (not shown) executes corresponding operation by key operation unit, and the control of another output and third switch is believed
The connection of number input terminal, control third are closed the switch or are disconnected;One of output end and the baseline value detection unit of third switch is defeated
Enter end connection;The output end of baseline value detection unit and the output end of timing unit update decision unit with baseline value respectively
Two input terminal connections;The output end that baseline value updates decision unit is connect with the control signal input of the 4th switch, is controlled
4th closes the switch or disconnects;The output end of 4th switch is connect with the input terminal of baseline value updating unit;Baseline value updates single
The output end and the input terminal of noise threshold generation unit of member, the input terminal of key threshold value generation unit, baseline value boundary generate
The input terminal connection of the input terminal and controlling of sampling unit of unit;The output end and noise of noise threshold generation unit are examined
Survey another input terminal connection of unit;The output end of key threshold value generation unit and another input terminal of key detection unit
Connection;The output end of baseline value boundary generation unit is connect with another input terminal of baseline value detection unit;5th switch
Output end is connect with another input terminal of controlling of sampling unit;The output end of controlling of sampling unit is adopted with timing sampling unit
The connection of sample control signal input, controls the sampling rate of timing sampling unit.
As shown in Figure 1, timing sampling unit exports multiple sampled value C1……Cn……CN(N >=2,1≤n≤N, N, n are equal
It is the same below for integer) to the stable judging unit of sampled value and first switch;Sampled value stablizes judging unit and receives preset difference value
Δ C and multiple sampled value C of timing sampling unit output1……Cn……CN, export first control signal to first switch,
Control first switch closing or opening.
Include maximum value judging unit, minimum value judging unit, first subtract as shown in Fig. 2, sampled value stablizes judging unit
Musical instruments used in a Buddhist or Taoist mass and first comparator;Maximum value judging unit is connect with an input terminal of the first subtracter, receives timing sampling list
Multiple sampled value C of member output1……Cn……CN, export maximum sampled value CMAXTo the first subtracter;Minimum value judging unit
It is connect with another input terminal of the first subtracter, receives multiple sampled value C of timing sampling unit output1……Cn……CN,
Export minimum sampled value CMINTo the first subtracter;The output end of first subtracter and an input terminal of first comparator connect,
Export maximum sampled value CMAXWith minimum sampled value CMINDifference CMAX-CMINTo first comparator, first comparator another
Input terminal receives preset difference value Δ C;First comparator is by difference CMAX-CMINIt is compared with preset difference value Δ C, and according to comparing
As a result first control signal is exported.
In the present embodiment, as maximum sampled value CMAXWith minimum sampled value CMINDifference CMAX-CMINLess than or equal to default
When difference DELTA C, the first control signal that sampled value stablizes judging unit output is high level, control first switch closure;When most
Big sampled value CMAXWith minimum sampled value CMINDifference CMAX-CMINWhen greater than preset difference value Δ C, it is defeated that sampled value stablizes judging unit
First control signal out is low level, and control first switch disconnects.
In other embodiments, as maximum sampled value CMAXWith minimum sampled value CMINDifference CMAX-CMINLess than or equal to pre-
If when difference DELTA C, the first control signal that sampled value stablizes judging unit output is low level, first switch closure;Work as maximum
Sampled value CMAXWith minimum sampled value CMINDifference CMAX-CMINWhen greater than preset difference value Δ C, sampled value stablizes judging unit output
First control signal be high level, control first switch disconnect.
In the present embodiment, preset difference value Δ C is the empirical value that timing sampling unit multiple repairing weld determines, and need to not had
There are environmental disturbances, for example is measured in the case that mobile phone interferes;Count timing sampling unit multiple repairing weld output maximum value with most
Small value takes the difference of the maxima and minima as preset difference value Δ C.In the present embodiment, Δ C=100-1000.
As shown in figure 3, maximum value judging unit includes the second comparator and maximum sampled value register;Second comparator
An input terminal receive multiple sampled value C1……Cn……CN, the output end and maximum sampled value register of the second comparator
Input terminal connection, the output end of maximum sampled value register connect with another input terminal of the second comparator.
In the present embodiment, maximum value judging unit receives multiple sampled value C1……Cn……CN, export maximum sampled value
CMAXPrinciple it is as follows: an input terminal of the second comparator receives first sampled value C1, and by the first sampled value C1It is stored in
Maximum sampled value register, by maximum sampled value register by the first sampled value C1Feed back another input to the second comparator
End;Second comparator receives second sampled value C again2, and by first sampled value C1With second sampled value C2It is compared,
And by first sampled value C1With second sampled value C2In biggish sampled value be stored in maximum sampled value register, by maximum
Biggish sampled value is fed back to another input terminal of the second comparator by sampling value register;Second comparator receives third again
A sampled value C3, and by third sampled value C3It is compared with value of feedback, biggish sampled value is stored in after comparing again
Biggish sampled value is fed back to another input of the second comparator by maximum sampled value register by maximum sampled value register
End, and;And so on, maximum sampled value register finally exports multiple sampled value C1……Cn……CNIn maximum sampled value
CMAX。
As shown in figure 4, minimum value judging unit includes third comparator and minimum sampled value register;Third comparator
An input terminal receive multiple sampled value C1……Cn……CN, the output end and minimum sampled value register of third comparator
Input terminal connection, the output end of minimum sampled value register connect with another input terminal of the second comparator.
In the present embodiment, minimum value judging unit receives multiple sampled value C1……Cn……CN, export minimum sampled value
CMINPrinciple it is as follows: an input terminal of third comparator receives first sampled value C1, and by the first sampled value C1It is stored in
Minimum sampled value register, by minimum sampled value register by the first sampled value C1Feed back another input of third comparator
End;Third comparator receives second sampled value C again2, and by first sampled value C1With second sampled value C2It is compared,
And by first sampled value C1With second sampled value C2In lesser sampled value be stored in minimum sampled value register, by minimum
Lesser sampled value is fed back to another input terminal of third comparator by sampling value register;Third comparator receives third again
A sampled value C3, and by third sampled value C3It is compared with value of feedback, lesser sampled value is stored in after comparing again
Lesser sampled value is fed back to another input of third comparator by minimum sampled value register by minimum sampled value register
Hold minimum sampled value register;And so on, minimum sampled value register finally exports multiple sampled value C1……Cn……CNIn
Minimum sampled value CMIN。
In the present embodiment, when first switch is closed, average filter unit receives multiple sampled value C1……Cn……
CN, and to removing maximum sampled value CMAXWith minimum sampled value CMINMultiple sampled value C afterwards1……Cn……CNIt is averaged,
Export average sample value CAVE, i.e. average sample value CAVE=(C1+…… Cn……+CN-CMAX-CMIN)/N;When first switch is disconnected
When opening, average filter unit stops receiving the sampled value of timing sampling unit output, and stops exporting average sample value CAVETo number
Word filter unit.
As shown in Figure 1, digital filtering unit receives the average sample value C of average filter unit outputAVE, export filtering and adopt
Sample value CF;Digital filtering unit is to average sample value CAVECarry out digital filtering.In the present embodiment, digital filtering unit is used for
It is repeatedly filtered, CF, i+1=CAVE/K+(K-1)*CF, i/ K, K=2q, q and i are positive integer;CF, iFor digital filtering unit
I-th filtering as a result, CF, i+1For the result of digital filtering unit i+1 time filtering;CF is digital filtering unit last time
The result of filtering.In the present embodiment, q=1,2,3,4,5,6,7,8.
As shown in figure 5, digital filtering unit includes that the first multiplier, the second multiplier, first adder and filtering are adopted
Sample value register;Two input terminals of the first multiplier receive average sample value C respectivelyAVEAnd the first multiplication factor 1/K;The
The output end of the output end of one multiplier and the second multiplier is connect with two input terminals of first adder respectively;First adds
The output end of musical instruments used in a Buddhist or Taoist mass is connect with the input terminal of filtering sampling value register;The output end of filtering sampling value register and the second multiplication
One input terminal of device connects, by the result C of last time filteringF, iThe second multiplier is fed back to, another of the second multiplier is defeated
Enter end and receive the second multiplication factor (K-1)/K, first adder exports the result C filtered next timeF, i+1, it is stored in filtering and adopts
Sample value register;The output end of filtering sampling value register finally exports filtering sampling value CF。
As shown in Figure 1, noise threshold generation unit receives the baseline value C of baseline value updating unit outputB, in output noise
Threshold value CNUAnd noise lower threshold value CNDTo noise detection unit;Noise detection unit receives the noise of noise threshold unit output
Upper threshold value CNU, noise lower threshold value CNDAnd the average sample value C of average filter unit outputAVE, by average sample value CAVEWith make an uproar
Sound upper threshold value CNUAnd noise lower threshold value CNDIt is compared, and second control signal is exported to second switch according to comparison result
And the 5th switch, it controls second switch and the 5th closes the switch or disconnect.
As shown in fig. 6, in the present embodiment, noise threshold generation unit include the second subtracter, second adder and
Third multiplier;Two input terminals of third multiplier receive baseline value C respectivelyBAnd coefficient a1, output end and the second subtracter
An input terminal and second adder an input terminal connection, export a1*CBTo the second subtracter and the second addition
Device;Another input terminal of second subtracter and another input terminal of second adder receive baseline value CB;Second subtracts
The output end of musical instruments used in a Buddhist or Taoist mass exports CB-a1*CB, i.e. output noise lower threshold value CND;The output end of second adder exports CNU=CB+a1*
CB, i.e. output noise upper threshold value CNU。
As shown in fig. 7, noise detection unit includes the 4th comparator, the 5th comparator and noise decision unit;4th
Two input terminals of comparator receive the noise lower threshold value C of noise threshold generation unit output respectivelyNDAnd average filter unit
The average sample value C of outputAVE, output end connect with an input terminal of noise decision unit;Two inputs of the 5th comparator
End receives the noise upper threshold value C of noise threshold generation unit output respectivelyNUAnd the average sample value of average filter unit output
CAVE, output end connect with another input terminal of noise decision unit;Output end output the second control letter of noise decision unit
Number.
In the present embodiment, noise decision unit is third and door;When average sample value is more than or equal to noise lower threshold value,
4th comparator exports high level;When average sample is less than noise lower threshold value, the 4th comparator exports low level;When averagely adopting
When sample value is less than or equal to noise upper threshold value, the 5th comparator exports high level;When average sample value is greater than noise upper threshold value, the
Five comparators export low level;When the 4th comparator and the 5th comparator export high level, third and door export high level,
It control second switch and the 5th closes the switch;When the 4th comparator or the 5th comparator output low level, third is defeated with door
Low level out, controls second switch and the 5th switch disconnects.
In other embodiments, noise decision unit is third or door;When average sample value is more than or equal to noise lower threshold value
When, the 4th comparator exports low level;When average sample is less than noise lower threshold value, the 4th comparator exports high level;When flat
When equal sampled value is less than or equal to noise upper threshold value, the 5th comparator exports low level;When average sample value is greater than noise upper threshold value
When, the 5th comparator exports high level;When the 4th comparator and the 5th comparator export low level, third or door output are low
Level controls second switch and the 5th closure;When the 4th comparator or the 5th comparator output high level when, third or
Door output high level, controls second switch and the 5th switch disconnects.
In this embodiment, when second switch is closed, the filtering that key detection unit receives the output of digital filtering unit is adopted
Sample value CF, and pass through detection filter sampled value CFNumerical value determine capacitance type touch key whether be in touch condition;It opens when second
When shutdown is opened, key detection unit stops receiving the filtering sampling value C of digital filtering unit outputF;When the 5th closes the switch,
Controlling of sampling unit receives the filtering sampling value C of digital filtering unit outputF;When second switch disconnects, controlling of sampling unit
Stop receiving the filtering sampling value C of digital filtering unit outputF。
In the present embodiment, noise lower threshold value CND=CB-a1*CB, noise upper threshold value CNU=CB+a1*CB; a1=0.001-
0.1。
In the present embodiment, only when noise detection unit detects average sample value CAVEIt is not noise, i.e. average sample
Value CAVEMore than or equal to noise lower threshold value CNDAnd it is less than or equal to noise upper threshold value CNUWhen, second switch is just closed, and key detection is single
Member can just detect average sample value CAVE, the interference that avoids noise from detecting key.
As shown in Figure 1, key threshold value generation unit receives the baseline value C of baseline value updating unit outputB, output key threshold
Value CTKGive key detection unit;Key detection unit receives the key threshold value C of key threshold value generation unit outputTKAnd second
Switch the filtering sampling value C of outputF, by filtering sampling value CFWith key threshold value CTKIt is compared, and is exported according to comparison result
The operation of key operation signal control button operating unit, output third control signal control third are closed the switch or are disconnected.
As shown in figure 8, key threshold value generation unit includes third adder and the 5th multiplier;The two of 5th multiplier
A input terminal receives baseline value C respectivelyBAnd coefficient b, the output end of the 5th multiplier and an input terminal of third adder
Connection exports b*CBGive third adder;Another input terminal of third adder receives baseline value CB, output end output CB+b*
CB, i.e. output key threshold value CTK。
As shown in figure 9, key detection unit includes the 6th comparator, the 7th comparator and the first counter;6th ratio
Compared with the key threshold value C that two input terminals of device receive the output of key threshold value generation unit respectivelyFKAnd digital filtering unit output
Filtering sampling value CF, the 6th comparator is by filtering sampling value CFWith key threshold value CTKIt is compared, and defeated according to comparison result
Third control signal gives third switch out, and control third is closed the switch or disconnected, and export the first trigger signal to the first counter,
Control the counting of the first counter;Two input terminals of the 7th comparator receive key confirmation times N respectivelyTKAnd first counter
The count value of output, the count value and key that the 7th comparator exports the first counter confirm times NTKIt is compared, and root
According to comparison result output key operation signal.
In the present embodiment, as filtering sampling value CFGreater than key threshold value CTK, and filtering sampling value CFGreater than key threshold value
CTKNumber reach key confirmation times NTKWhen, the key operation signal of key detection unit output is high level, key detection
The third control signal of unit output is high level;As filtering sampling value CFGreater than key threshold value CTK, and filtering sampling value CFGreatly
In key threshold value CTKNumber be not up to key confirmation times NTKWhen, the key operation signal of key detection unit output is low
The third control signal of level, the output of key detection unit is high level;As filtering sampling value CFLess than key threshold value CTKWhen, it presses
The key operation signal of key detection unit output is low level, and the third control signal of key detection unit output is low level.
In the present embodiment, as filtering sampling value CFGreater than key threshold value CTK, the 6th comparator output high level the first counter of triggering
It counts, and the count value of the first counter output is greater than key and confirms times NTK, i.e. filtering sampling value CFGreater than key threshold value CTK
Number reach key confirmation times NTKWhen, the key operation signal of the 7th comparator output is high level, key detection unit
Determine that corresponding capacitance type touch key is in touch condition;As filtering sampling value CFLess than key threshold value CTK, the 6th comparator
Export low level, the first counter without counting, or, filtering sampling value CFGreater than key threshold value CTK, the high electricity of the 6th comparator output
The first counter of flat triggering counts, but filtering sampling value CFGreater than key threshold value CTKNumber be not up to key confirmation times NTK
When, the key operation signal of the 7th comparator output is low level, and key detection unit determines corresponding capacitance type touch key
In not by touch condition.
In the present embodiment, when the key operation signal of push-button unit output is high level, key operation unit is executed
The operation of corresponding capacitance type touch key;When the key operation signal of push-button unit output is low level, key operation unit
The operation of corresponding capacitance type touch key is not carried out;When the 6th comparator exports high level, i.e. third control signal is high electricity
Usually, third switch disconnects;When the 6th comparator exports low level, i.e., when third control signal is low level, third switch is closed
It closes.
In other embodiments, as filtering sampling value CFGreater than key threshold value CTK, the output low level triggering of the 6th comparator
First counter counts, and the count value of the first counter output is greater than key and confirms times NTK, i.e. filtering sampling value CFIt is greater than
Key threshold value CTKNumber reach key confirmation times NTKWhen, the key operation signal of the 7th comparator output is low level, is pressed
Key detection unit determines that corresponding capacitance type touch key is in touch condition;As filtering sampling value CFLess than key threshold value CTK,
6th comparator export high level, the first counter without counting, or, filtering sampling value CFGreater than key threshold value CTK, the 6th compares
The low level that device exports triggers the first counter and counts, but filtering sampling value CFGreater than key threshold value CTKNumber be not up to key
Confirm times NTKWhen, the key operation signal of the 7th comparator output is high level, and key detection unit determines corresponding capacitor
Formula touch key-press is in not by touch condition.
In other embodiments, when the key operation signal of push-button unit output is low level, key operation unit is held
The operation of the corresponding capacitance type touch key of row;When the key operation signal of push-button unit output is high level, button operation list
The operation of corresponding capacitance type touch key is not carried out in member;When the 6th comparator exports high level, i.e. third control signal is height
When level, third switch is disconnected;When the 6th comparator exports low level, i.e., when third control signal is low level, third switch
Closure.
In the present embodiment, when third closes the switch, baseline value detection unit receives the filter of digital filtering unit output
Wave sampled value CF;When third, which switchs, to be disconnected, baseline value detection unit stops receiving the filtering sampling of digital filtering unit output
Value CF。
In the present embodiment, key threshold value CTK=CB+b*CB;B=0.001-0.1, and b < a2;Key confirms number CTK
Repeatedly to touch the empirical value determined after capacitance type touch key;When statistics repeatedly touches capacitance type touch key, filtering sampling
Value CFGreater than key threshold value CTKNumber minimum as key confirm number CTK;Key confirms times NTKNumberical range
It is 1 to 8.
As shown in Figure 1, baseline value boundary generation unit receives the baseline value C of baseline value updating unit outputB, export base
Line value boundary CBBGive baseline value detection unit;Baseline value detection unit receives the baseline value side of baseline value boundary generation unit output
Boundary CBBAnd the filtering sampling value C of third switch outputF, by filtering sampling value CFWith baseline value boundary CBBIt is compared, and root
The first baseline value more new signal, which is exported, according to comparison result updates decision unit to baseline value.
As shown in Figure 10, baseline value boundary generation unit includes the 4th adder and the 6th multiplier;6th multiplier
Two input terminals receive baseline value C respectivelyBAnd coefficient c, one of the output end of the 6th multiplier and the 4th adder are defeated
Enter end connection, exports c*CBTo the 4th adder;Another input terminal of 4th adder receives baseline value CB, output end output
CB+c*CB, i.e. output baseline value boundary CBB。
As shown in figure 11, baseline value detection unit includes the 8th comparator, the 9th comparator, the tenth comparator, the second meter
Number device and the first baseline value update judging unit;Two input terminals of the 8th comparator receive the filter of third switch output respectively
Wave sampled value CFAnd the baseline value boundary C of baseline value boundary generation unit outputBB, the 8th comparator is by filtering sampling value CFWith
Baseline value boundary CBBIt is compared, and the second trigger signal is exported to the second counter according to comparison result, triggering second counts
Device counts;Two input terminals of the tenth comparator receive baseline value confirmation times N respectivelyBAnd second counter output counting
Value, output end are connect with the input terminal that the first baseline value updates judging unit;Tenth comparator exports the second counter
Count value and baseline value confirm times NBIt is compared, and high level or low level is exported to the first baseline according to comparison result
Value updates judging unit;Two input terminals of the 9th comparator receive the filtering sampling value C of third switch output respectivelyFAnd base
The baseline value boundary C of line value boundary generation unit outputBB, another input of output end and the first baseline value update judging unit
End connection;9th comparator is by filtering sampling value CFWith baseline value boundary CBBIt is compared, and high electricity is exported according to comparison result
Flat or low level updates judging unit to the first baseline value;The output end that first baseline value updates judging unit exports the first baseline
It is worth more new signal.
In the present embodiment, it is second or door that the first baseline value, which updates judging unit,;As filtering sampling value CFGreater than baseline
It is worth boundary CBBWhen, the 9th comparator exports low level, and the 8th comparator exports high level and triggers the counting of the second counter;When second
The count value of counter output is greater than baseline value and confirms times NB, i.e. filtering sampling value CFGreater than baseline value boundary CBBNumber reach
Times N is confirmed to baseline valueBWhen, the tenth comparator exports high level, and the first baseline value more new signal that second or door export is
High level confirms times N when the count value of the second counter output is less than baseline valueB, i.e. filtering sampling value CFGreater than baseline value side
Boundary CBBNumber be not up to baseline value confirmation times NBWhen, the tenth comparator exports low level, the first base that second or door export
Line value more new signal is low level;As filtering sampling value CFLess than or equal to baseline value boundary CBBWhen, the high electricity of the 9th comparator output
Flat, the 8th comparator exports low level, does not trigger the second counter and is counted, and the tenth comparator exports low level, second or
The first baseline value more new signal of door output is high level.In the present embodiment, baseline value boundary CBB=CB+c*CB;C=
0.001-0.1, and c < b;Baseline value confirms times NBNumberical range be 1 to 32.
As described in Figure 1, timing unit receives the timing controling signal of timing sampling unit output, and the second baseline value of output is more
New signal updates decision unit to baseline value.As shown in figure 12, timing unit includes timer, third counter, timing judgement
Condition generation unit and the 11st comparator;The output end of timer is connect with the input terminal of third counter, and third counts
Device counts timer, and exports count value to an input terminal of the 11st comparator;The reception of timing judgment condition is adopted
Sample unit exports timing controling signal, exports timing judgment condition to another input terminal of the 11st comparator;Timing controlled
Signal is used to control the numerical value of timing judgment condition;11st comparator exports the second baseline value more new signal.
In the present embodiment, when item is adjudicated in the timing that the count value of third counter output is less than the output of timing judgment condition
When part, i.e. baseline value updating unit do not arrive the time that timing updates also, the second baseline value of the 11st comparator output updates letter
Number be low level;When the count value of third counter output is equal to the timing judgment condition of timing judgment condition output, i.e. timing
When unit reaches timing, the second baseline value more new signal of the 11st comparator output is high level.
In the present embodiment, it is first and door that baseline value, which updates decision unit,;When the first of the output of baseline value detection unit
When datum renewal signal and the second datum renewal signal of timing unit output are high level, first exports high level with door;
When the first datum renewal signal or the second datum renewal signal are low level, first exports low level with door;When first and door
When exporting high level, first controls signal with the 4th of door output as high level, and the 4th closes the switch, and baseline value updating unit connects
Receive the filtering sampling value C of digital filtering unit outputFBaseline value update is carried out, the baseline value of output becomes filtering sampling value CF;
When first with door output low level, the first the 4th control signal exported with door is low level, and the 4th switch disconnects, baseline value
Updating unit is updated without baseline value, and the baseline value of output is constant.
In the present embodiment, baseline value updating unit updates baseline value and needs to meet following conditions: (1) noise measuring list
Member detects average sample value CAVEIt is not noise;(2) the filtering sampling value C that baseline value detection unit detectsFReach update item
Part, i.e. filtering sampling value CFLess than or equal to baseline value boundary CBB, or, filtering sampling value CFTimes N is confirmed greater than baseline valueBReach
Baseline value confirms times NB, and filtering sampling value CFLess than key threshold value CTK;(3) timing unit reaches timing;Reduction is made an uproar
The influence that sound detects baseline value;To less than or equal to baseline value boundary CBBFiltering sampling value CF, without multiple confirmation, directly more
New baseline value improves the speed of baseline value update;To greater than baseline value boundary CBBFiltering sampling value CF, repeatedly confirmed
After could update baseline value, avoid of short duration influence of the mutation to capacitance type touch key capacitance of environment, lead to baseline value mistake
It updates.
In the present embodiment, the baseline value of baseline value updating unit output for the first time is capacitance type touch key not by environment
Capacitance when interfering, and not touched, the capacitance are obtained by timing sampling unit scan.
As shown in Figure 1, controlling of sampling unit receives the filtering sampling value C of the 5th switch outputFAnd baseline value updates list
The baseline value C of member outputB, export sampling control signal and give timing sampling unit.As shown in figure 13, controlling of sampling unit includes
12nd comparator;Two input terminals of the 12nd comparator accept filter sampled value C respectivelyFAnd baseline value CB, the 12nd ratio
Compared with device by filtering sampling value CFAnd baseline value CBIt is compared, and sampling control signal is exported according to comparison result.
In the present embodiment, as filtering sampling value CFMore than or equal to baseline value CBWhen, the sampling control of the 12nd comparator output
Signal processed is low level, and timing sampling unit maintains original sampling rate, the timing controling signal of timing sampling unit output
The numerical value for controlling the timing judgment condition of timing unit output is constant, i.e. the renewal speed of baseline value updating unit is constant;Work as filter
Wave sampled value CFLess than baseline value CBWhen, the sampling control signal of the 12nd comparator output is high level, and timing sampling unit mentions
High sampling rate, the timing controling signal control timing unit of timing sampling unit output reduce the numerical value of timing judgment condition,
The timing for shortening timing unit accelerates the renewal speed of baseline value updating unit.
As shown in figure 14, continuous several times touch capacitance type touch key will lead to capacitance type touch key numerical value it is continuous on
Decline after rising;When the sampling rate of timing sampling unit is lower, the sampled value of timing sampling unit output is biggish value,
And then the filtering sampling value C for causing digital filtering unit to exportFGreater than baseline value boundary CBBNumber reach baseline value confirmation time
Number NB, baseline value updating unit, which updates baseline value, will lead to baseline value raising extremely.
In the present embodiment, controlling of sampling unit detects filtering sampling value CFLess than baseline value CBWhen, control timing sampling
Unit accelerates sampling rate (as shown in figure 15), and the sampled value of timing sampling unit output can become smaller, and then digital filtering unit
The filtering sampling value C of outputFAlso it can become smaller, prevent from increasing extremely due to the low caused baseline value of sampling rate;On the other hand, fixed
When sampling unit while accelerate sampling rate, control timing unit reduces the numerical value of timing judgment condition, i.e. control timing is single
Member shortens timing, accelerates the speed that declines after baseline value increases, further decrease continuous several times touch capacitance touch by
The influence that key detects baseline value.
As shown in figure 16, a kind of capacitance type touch key anti interference detection method the following steps are included:
(1) start;
(2) each module initialization;
(3) noise threshold, key threshold value and baseline value boundary are set;
(4) timing sampling unit scan touch key-press obtains the capacitance of touch key-press;
(5) timing sampling unit exports multiple sampled values and gives sampled value stabilization judging unit;
(6) the stable judging unit of sampled value determines that the difference of maximum sampled value and minimum sampled value in multiple sampled values is
It is no to be greater than preset difference value, if so, (7) are entered step, if it is not, entering step (8);
(7) average filter unit does not receive multiple sampled values of timing sampling unit output, return step (4);
(8) average filter unit receives multiple sampled values of timing sampling unit output;
(9) average filter unit exports average sample value to digital filtering unit, noise detection unit;
(10) whether noise detection unit detection average sample value is greater than noise threshold, if so, (11) are entered step, if
It is no, enter step (12) and step (26);
(11) key detection unit and controlling of sampling unit do not receive the filtering sampling value of digital filtering unit output, return
It returns step (4);
(12) key detection unit receives the filtering sampling value of digital filtering unit output;
(13) whether key detection unit detection filter sampled value is greater than key threshold value, if so, entering step (14) and walking
Suddenly (17), if it is not, entering step (16) and step (18);
(14) whether the number that key detection unit detection filter sampled value is greater than key threshold value reaches key confirmation number,
If so, (15) are entered step, if it is not, entering step (16);
(15) key operation unit executes button operation, return step (4);
(16) key operation unit does not execute button operation, return step (4);
(17) baseline value detection unit does not receive the filtering sampling value of digital filtering unit output, enters step (25);
(18) baseline value detection unit receives the filtering sampling value of digital filtering unit output;
(19) whether baseline value detection unit detection filter sampled value is greater than baseline value boundary, if so, (20) are entered step,
If it is not, entering step (21);
(20) whether the number that baseline value detection unit detection filter sampled value is greater than baseline value boundary it is true reach baseline value
Number is recognized, if so, (21) are entered step, if it is not, entering step (24);
(21) whether timing unit reaches timing, if so, (22) are entered step, if it is not, entering step (24);
(22) baseline value updating unit receives the filtering sampling value of digital filtering unit output;
(23) baseline value updating unit updates baseline value, return step (4);
(24) baseline value updating unit does not receive the filtering sampling value of digital filtering unit output;
(25) baseline value updating unit does not update a reference value, return step (4);
(26) whether controlling of sampling unit detection filter sampled value is less than baseline value, if so, entering step (27) and step
(28), if it is not, return step (4);
(27) timing sampling unit improves sampling rate, return step (4);
(28) timing unit shortens timing, enters step (21).
In the present embodiment, step (3) includes the following steps;
(31) baseline value updating unit exports baseline value to noise threshold generation unit, key threshold value generation unit, baseline
It is worth boundary generation unit and controlling of sampling unit;
(32) noise threshold generation unit output noise threshold value is pressed to noise detection unit, the output of key threshold value generation unit
Key threshold value gives key detection unit, and baseline value boundary generation unit exports baseline value boundary and gives baseline value detection unit.