Detection circuit and detection method of touch capacitor
By designing a touch capacitance detection circuit with multiple detection functions, the problem of poor anti-interference ability of traditional detection circuits is solved, and the detection accuracy and anti-interference ability are significantly improved.
Patent Information
- Application Number
- CN202411985927.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-29
AI Technical Summary
Traditional touch capacitor detection circuits have poor anti-interference ability, resulting in low detection accuracy.
A touch capacitor detection circuit including a control unit, a switching unit, a first detection unit, a second detection unit and a detection capacitor is designed. The control switch unit alternately connects different ports, and performs multiple detections when the preset number of times is reached to form a plurality of second detection signals to improve detection accuracy.
Through the redundancy of multiple detection signals, the anti-interference ability and detection accuracy of the touch capacitor detection circuit are improved.
Smart Images

Figure CN119902650A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the technical field of touch control, and in particular to a detection circuit and a detection method for touch capacitance. Background Art
[0002] The traditional touch capacitance detection circuit has a relatively poor anti-interference capability when detecting the touch capacitance, resulting in relatively poor detection accuracy of the touch capacitance. Summary of the invention
[0003] The present invention provides a detection circuit and a detection method for a touch capacitance, so as to improve the anti-interference capability of the touch capacitance detection circuit and improve the detection accuracy of the touch capacitance.
[0004] In a first aspect, an embodiment of the present invention provides a touch capacitance detection circuit, including a control unit, a switch unit, a first detection unit, a second detection unit, and a detection capacitor;
[0005] The control unit is connected to the control end of the switch unit, the first end of the switch unit is connected to the touch capacitor to be tested, the second end of the switch unit is connected to the power supply end, and the third end of the switch unit is connected to the detection capacitor, and the control unit is used to control the switch unit to alternately connect the first end and the second end, and the first end and the third end, and record the number of times the switch unit connects the first end and the third end;
[0006] The first detection unit and the second detection unit are both connected to the control unit and the detection capacitor, the first detection unit is used to detect the voltage of the detection capacitor to form a first detection signal; the control unit is used to control the second detection unit to sequentially detect the voltage of the detection capacitor when the number of times the switch unit connects the first end and the third end reaches different preset numbers in sequence to form multiple second detection signals; the control unit is also used to determine the capacitance value of the touch capacitor to be tested based on the first detection signal and the multiple second detection signals.
[0007] Optionally, the second detection unit includes an amplification module and an analog-to-digital conversion module;
[0008] The input end of the amplification module is connected to the detection capacitor, the output end of the amplification module is connected to the input end of the analog-to-digital conversion module, the control end of the analog-to-digital conversion module is connected to the first output end of the control unit, the output end of the analog-to-digital conversion module is connected to the first input end of the control unit, and the control unit is used to control the working state of the analog-to-digital conversion module and receive the second detection signal output by the analog-to-digital conversion module.
[0009] Optionally, the touch capacitance detection circuit further includes a storage unit;
[0010] The input end of the storage unit is connected to the output end of the second detection unit, the control end of the storage unit is connected to the first output end of the control unit, the output end of the storage unit is connected to the first input end of the control unit, and the control unit is further used to control the storage unit to store the second detection signal when the switch unit connects the first end and the third end a preset number of times.
[0011] Optionally, the first detection unit includes a digital-to-analog conversion module and a comparison module;
[0012] The digital-to-analog conversion module is connected to the negative input terminal of the comparison module, the positive input terminal of the comparison module is connected to the detection capacitor, the output terminal of the comparison module is connected to the second input terminal of the control unit, the digital-to-analog conversion module is used to provide a reference voltage for the negative input terminal of the comparison module, and the comparison module is used to compare the reference voltage and the voltage of the detection capacitor to form the first detection signal.
[0013] Optionally, the switch unit includes a first switch and a second switch;
[0014] The control end of the first switch and the control end of the second switch are connected to the second output end of the control unit, the first end of the first switch and the first end of the second switch are connected to the touch capacitor to be tested, the second end of the first switch is connected to the power supply end, and the second end of the second switch is connected to the detection capacitor.
[0015] Optionally, the switch unit further includes a third switch;
[0016] A first end of the third switch is connected to the second end of the second switch and the detection capacitor, and a second end of the third switch is grounded.
[0017] In a second aspect, an embodiment of the present invention further provides a method for detecting touch capacitance, which is performed by the touch capacitance detection circuit described in the first aspect, and the method includes:
[0018] Control the switch unit to alternately connect the first end and the second end, and the first end and the third end;
[0019] When the number of times that the switch unit connects the first end and the third end reaches different preset numbers in sequence, controlling the second detection unit to detect the voltage of the detection capacitor in sequence to form a plurality of second detection signals;
[0020] A first detection signal output by a first detection unit is acquired, and a capacitance value of the touch capacitor to be tested is determined according to the first detection signal and a plurality of the second detection signals.
[0021] Optionally, the preset number of times includes a first preset number of times to an nth preset number of times arranged in ascending order, wherein n is an integer greater than 1; when the number of times the switch unit connects the first end and the third end reaches different preset numbers in sequence, the second detection unit is controlled to detect the voltage of the detection capacitor in sequence to form a plurality of second detection signals, including:
[0022] When the number of times that the switch unit connects the first end and the third end reaches the first preset number to the i-th preset number in sequence, the second detection unit is controlled to detect the voltage of the detection capacitor in sequence under the first amplification factor to form i second detection signals; wherein i is an integer greater than or equal to 1 and less than or equal to n, at the i-th preset number, the first detection signal is logic low, and at the i+1-th preset number, the first detection signal is logic high;
[0023] When i is less than n, and the number of times the switch unit connects the first end and the third end reaches the i+1th preset number to the nth preset number in sequence, the second detection unit is controlled to detect the voltage of the detection capacitor in sequence under the second amplification factor to form ni second detection signals; wherein the second amplification factor is less than the first amplification factor.
[0024] Optionally, when the number of times the switch unit connects the first end and the third end reaches a preset number, after acquiring the first detection signal output by the first detection unit, the method further includes:
[0025] When the first detection signal is logic high and i is equal to n, the second detection signal is saved, and the touch capacitor to be tested and the detection capacitor are controlled to discharge;
[0026] When the first detection signal is logic high and i is less than n, the touch capacitor to be tested is controlled to connect the first end and the third end for a number of times to reach the i+1th preset number to the nth preset number in sequence, and the detection capacitor is controlled to detect the voltage of the detection capacitor in sequence under the second amplification factor;
[0027] When the first detection signal is logic low and the error signal is logic high, the touch capacitor to be tested and the detection capacitor are controlled to discharge.
[0028] Optionally, before controlling the switch unit to alternately connect the first end and the second end, and the first end and the third end, the method further includes:
[0029] The touch capacitor to be tested and the detection capacitor are discharged.
[0030] According to the technical solution of the embodiment of the present invention, a touch capacitor detection circuit is provided to include a second detection unit. The second detection unit can detect the voltage of the detection capacitor when the charging times of the detection capacitor reaches a plurality of preset times, thereby forming a plurality of second detection signals. The control unit determines the capacitance value of the touch capacitor to be tested according to the first detection signal and the plurality of second detection signals. The plurality of second detection signals can improve the detection accuracy of the capacitance value of the touch capacitor to be tested, while increasing the redundancy of the detection signal and improving the anti-interference capability of the touch capacitor detection circuit. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 A schematic diagram of the structure of a touch capacitance detection circuit provided by an embodiment of the present invention;
[0032] Figure 2 A schematic diagram of the structure of another touch capacitance detection circuit provided by an embodiment of the present invention;
[0033] Figure 3 A schematic diagram of the structure of another touch capacitance detection circuit provided by an embodiment of the present invention;
[0034] Figure 4 A schematic diagram of a flow chart of a touch capacitance detection method provided by an embodiment of the present invention;
[0035] Figure 5 A schematic flow chart of another touch capacitance detection method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0037] Figure 1 The structure diagram of a touch capacitance detection circuit provided by an embodiment of the present invention is shown in FIG. Figure 1As shown, the detection circuit of the touch capacitor includes a control unit 110, a switch unit 120, a first detection unit 130, a second detection unit 140 and a detection capacitor CX; the control unit 110 is connected to the control end of the switch unit 120, the first end of the switch unit 120 is connected to the touch capacitor TX to be tested, the second end of the switch unit 120 is connected to the power supply end VDD, and the third end of the switch unit 120 is connected to the detection capacitor CX. The control unit 110 is used to control the switch unit 120 to alternately connect the first end and the second end, and the first end and the third end, and record the switch unit 120 connected to the first end and the second end. The number of times the switch unit 120 connects the first end and the third end; the first detection unit 130 and the second detection unit 140 are both connected to the control unit 110 and the detection capacitor CX, the first detection unit 130 is used to detect the voltage of the detection capacitor CX to form a first detection signal; the control unit 110 is used to control the second detection unit 140 to sequentially detect the voltage of the detection capacitor CX when the number of times the switch unit 120 connects the first end and the third end reaches different preset numbers in sequence to form multiple second detection signals; the control unit 110 is also used to determine the capacitance value of the touch capacitor TX to be tested according to the first detection signal and the multiple second detection signals.
[0038] Specifically, the capacitance value of the touch capacitor TX to be tested may change depending on whether there is a touch action. When there is no touch action, the capacitance value of the touch capacitor TX to be tested is its own capacitance value. When there is a touch action, the capacitance value of the touch capacitor TX to be tested includes the capacitance value of the parasitic capacitance formed between the human body and the touch capacitor TX to be tested, so that the capacitance value of the touch capacitor TX to be tested becomes larger. Figure 1 It is exemplarily shown that there are two touch capacitors TX to be tested, and multiple touch capacitors TX to be tested are connected to the first end of the switch unit 120 through the gate switch Ch. By controlling the state of the gate switch Ch, a certain touch capacitor TX to be tested can be connected to the first end of the switch unit 120, so that different touch capacitors TX to be tested can be selected for detection through the gate switch Ch. Exemplarily, the gate state of the gate switch Ch can be controlled by the selection signal ch_sel. When the selection signal ch_sel==1, the gate switch Ch can select the first touch capacitor TX to be tested and the first end of the switch unit 120. When the selection signal ch_sel==2, the gate switch Ch can select the second touch capacitor TX to be tested and the first end of the switch unit 120.
[0039] The control unit 110 can control the first end and the second end of the switch unit 120 to be turned on, or control the first end and the third end of the switch unit 120 to be turned on. When the control unit 110 controls the first end and the second end of the switch unit 120 to be turned on, the power supply voltage provided by the power supply terminal VDD can be output to the first end through the second end of the switch unit 120 to charge the selected touch capacitor TX to be tested. When the control unit 110 controls the first end and the third end of the switch unit 120 to be turned on, the electric energy stored in the selected touch capacitor TX to be tested can be transmitted to the third end through the first end of the switch unit 120 to charge the detection capacitor CX. Therefore, the control unit 110 can control the switch unit 120 to alternately connect the first end and the second end, and the first end and the third end, so that the selected touch capacitor TX to be tested can charge the detection capacitor CX multiple times. The relationship between the voltage of the detection capacitor CX and the number of charge and discharge times n of the touch capacitor TX to be tested is:
[0040]
[0041] Among them, V CX is the voltage of the detection capacitor CX, n is the number of charge and discharge times of the touch capacitor TX to be tested, cx is the capacitance value of the detection capacitor CX, tx is the capacitance value of the touch capacitor TX to be tested, and Vdd is the power supply voltage provided by the power supply terminal VDD.
[0042] The first detection unit 130 is connected to the detection capacitor CX, and is used to detect the voltage of the detection capacitor CX and form a first detection signal. When there is no touch action at the touch capacitor TX to be tested, the capacitance value of the touch capacitor TX to be tested is relatively small, and the number of times the detection capacitor CX is charged to the reference voltage can be the first number, then the logic value output by the first detection unit 130 jumps when the number of times the switch unit 120 selects the first end and the third end reaches the first number. When there is a touch action at the touch capacitor TX to be tested, the capacitance value of the touch capacitor TX to be tested increases, and the voltage of the detection capacitor CX charged by the touch capacitor TX to be tested becomes larger each time. Before the number of times the touch capacitor TX to be tested charges the detection capacitor CX reaches the first number, the voltage of the detection capacitor CX is greater than the reference voltage, and the logic value output by the first detection unit 130 jumps before the number of times the switch unit 120 selects the first end and the third end reaches the first number, so that it can be judged whether the touch capacitor TX to be tested is touched according to the number of times the switch unit 120 selects the first end and the third end corresponding to the logic value jump of the first detection unit 130.
[0043] The second detection unit 140 is connected to the control unit 110 and the detection capacitor CX. The preset number of times may include multiple, and each preset number of times may be set according to the detection requirements and the first number of times. Exemplarily, at least one of the multiple preset numbers is relatively small, for example, less than the first number, for detecting the charging condition when the voltage of the detection capacitor CX is less than the reference voltage, and at least one of the multiple preset numbers is relatively large, for example, greater than the first number, for detecting the charging condition when the voltage of the detection capacitor CX is greater than the reference voltage. When the control unit 110 controls the switch unit 120 to alternately connect the first end and the second end, and the first end and the third end, so that the touch capacitor TX to be tested is charged to the detection capacitor CX multiple times to the first preset number of times, the control unit 110 controls the second detection unit 140 to enable, so that the second detection unit 140 can detect the voltage of the detection capacitor CX under the current charging number of times, and form the first second detection signal. After the second detection unit 140 completes the detection, the control unit 110 continues to control the switch unit 120 to alternately connect the first end and the second end, and the first end and the third end, so that the touch capacitor TX to be tested continues to charge the detection capacitor CX to the second preset number of times. The control unit 110 controls the second detection unit 140 to be enabled again, so that the second detection unit 140 can detect the voltage of the detection capacitor CX at the current charging times again, and form a second second detection signal. And so on, until the control unit controls the switch unit 120 to alternately connect the first end and the second end, and the first end and the third end, so that the touch capacitor TX to be tested charges the detection capacitor CX to the last preset times, and the second detection unit 140 detects the voltage of the detection capacitor CX at the current charging times again, and forms the last second detection signal.
[0044] After the first detection unit 130 and the second detection unit 140 perform detection respectively, the control unit 110 determines the capacitance value of the touch capacitor TX to be tested according to the first detection signal and the multiple second detection signals. The multiple second detection signals can improve the detection accuracy of the capacitance value of the touch capacitor TX to be tested, while increasing the redundancy of the detection signal and improving the anti-interference ability of the touch capacitor detection circuit.
[0045] The technical solution of this embodiment is to set the detection circuit of the touch capacitor to include a second detection unit. The second detection unit can detect the voltage of the detection capacitor when the charging number of the detection capacitor reaches a plurality of preset numbers to form a plurality of second detection signals. The control unit determines the capacitance value of the touch capacitor to be tested according to the first detection signal and the plurality of second detection signals. The plurality of second detection signals can improve the detection accuracy of the capacitance value of the touch capacitor to be tested, and at the same time increase the redundancy of the detection signal, thereby improving the anti-interference capability of the detection circuit of the touch capacitor.
[0046] Figure 2 FIG. 1 is a schematic diagram of another touch capacitance detection circuit provided by an embodiment of the present invention. Figure 2 As shown, the second detection unit 140 includes an amplifying module 141 and an analog-to-digital conversion module 142; the input end of the amplifying module 141 is connected to the detection capacitor CX, the output end of the amplifying module 141 is connected to the input end of the analog-to-digital conversion module 142, the control end of the analog-to-digital conversion module 142 is connected to the first output end of the control unit 110, the output end of the analog-to-digital conversion module 142 is connected to the first input end of the control unit 110, and the control unit 110 is used to control the working state of the analog-to-digital conversion module 142 and receive the second detection signal output by the analog-to-digital conversion module 142.
[0047] Specifically, the amplification module 141 may include an amplifier with an adjustable amplification gain for amplifying the voltage of the detection capacitor CX. Exemplarily, when the voltage of the detection capacitor CX is less than the reference voltage, the amplification gain of the amplification module 141 can be set to be relatively large to improve the sensitivity of the second detection signal. When the voltage of the detection capacitor CX is greater than or equal to the reference voltage, the amplification gain of the amplification module 141 can be set to be relatively small, reducing the voltage range of the second detection signal, so that the voltage range of the second detection signal is within the voltage range corresponding to the number of bits of the analog-to-digital conversion module 142. Exemplarily, the number of bits of the analog-to-digital conversion module 142 can be 12 bits, at which time the voltage range corresponding to the analog-to-digital conversion module 142 is the voltage range corresponding to the 12-bit value. When the touch capacitor TX to be tested does not charge the detection capacitor CX to a preset number of times, the control unit 110 controls the analog-to-digital conversion module 142 to be in an inoperative state, and the mode conversion module 142 cannot output the second detection signal. When the touch capacitor TX to be tested charges the detection capacitor CX to a preset number of times, the control unit 110 controls the analog-to-digital conversion module 142 to be in a working state, performs analog-to-digital conversion on the voltage output by the amplification module 141 to form a second detection signal, and outputs it to the control unit 110, so that the control unit 110 can determine the capacitance value of the touch capacitor TX to be tested according to the second detection signal.
[0048] Continue to refer Figure 2 The touch capacitance detection circuit also includes a storage unit 150; an input end of the storage unit 150 is connected to an output end of the second detection unit 140, a control end of the storage unit 150 is connected to a first output end of the control unit 110, and an output end of the storage unit 150 is connected to a first input end of the control unit 110. The control unit 110 is also used to control the storage unit 150 to store a second detection signal when the number of times the switch unit 120 connects the first end and the third end reaches a preset number.
[0049] Specifically, Figure 2As shown, the storage unit 150 has a storage function. Exemplarily, the storage unit 150 may include a First Input First Output (FIFO) memory and a Direct Memory Access (DMA), the FIFO memory is used to store the second detection signal, and the DMA can directly output the stored second detection signal to the control unit 110, so that the control unit 110 performs signal processing on the second detection signal to determine the capacitance value of the touch capacitor TX to be tested. When the number of times the switch unit 120 connects the first end and the third end reaches a preset number, the control unit 110 controls the second detection unit 140 to detect the voltage of the detection capacitor CX, and at the same time can control the storage unit 150 to store the second detection signal formed by the second detection unit 140, and output it to the control unit 110 through DMA, so that the control unit 110 can directly obtain the second detection signal.
[0050] Figure 3 FIG. 1 is a schematic diagram of another touch capacitance detection circuit provided by an embodiment of the present invention. Figure 3 As shown, the first detection unit 130 includes a digital-to-analog conversion module 131 and a comparison module 132; the digital-to-analog conversion module 131 is connected to the negative input terminal - of the comparison module 132, the positive input terminal + of the comparison module 132 is connected to the detection capacitor CX, the output terminal of the comparison module 132 is connected to the second input terminal of the control unit 110, the digital-to-analog conversion module 131 is used to provide a reference voltage for the negative input terminal - of the comparison module 132, and the comparison module 132 is used to compare the reference voltage and the voltage of the detection capacitor CX to form a first detection signal.
[0051] Specifically, the digital-to-analog conversion module 131 can convert a digital signal into an analog signal. Among them, the digital signal can be a numerical value corresponding to a reference voltage, and the reference voltage can be set according to the voltage of the detection capacitor CX when the number of times the detection capacitor CX is charged is the first number when the touch capacitor TX to be tested is not touched. Exemplarily, the digital-to-analog conversion module 131 can be an 8-bit digital-to-analog converter. By controlling the digital-to-analog converter to input an 8-bit digital signal corresponding to the reference voltage, it can be converted into a reference voltage. When the touch capacitor TX to be tested charges the detection capacitor CX, the voltage of the detection capacitor CX is output to the positive input terminal + of the comparison module 132. When the voltage of the detection capacitor CX is less than the reference voltage, the first detection signal output by the comparison module 132 is logically low. When the voltage of the detection capacitor CX is greater than the reference voltage, the first detection signal output by the comparison module 132 is logically high. Thus, the voltage change of the detection capacitor CX can be determined according to the change in the logic value of the first detection signal, and the capacitance value change of the touch capacitor TX to be tested can be determined according to the voltage change of the detection capacitor CX, so as to realize touch detection.
[0052] Continue to refer Figure 3 , the first detection unit 130 also includes a filter 133, and the filter 133 is connected between the output end of the comparison module 132 and the second input end of the control unit 110. The filter 133 can filter the jitter of the comparison module 132 to improve the reliability of the touch capacitance detection circuit. Exemplarily, the filter 133 can determine that the logic value of the first detection signal output by the comparison module 132 is valid after the logic value of the first detection signal continues for a certain period of time, and output it to the control unit 110. Or, the logic value of the first detection signal output by the comparison module 132 can be determined to be valid when the logic value of the first detection signal accumulated for a certain number of times, and output it to the control unit 110.
[0053] Continue to refer Figure 3 The switch unit 120 includes a first switch S1 and a second switch S2; a control end of the first switch S1 and a control end of the second switch S2 are connected to the second output end of the control unit 110, a first end of the first switch S1 and a first end of the second switch S2 are connected to the touch capacitor TX to be tested, a second end of the first switch S1 is connected to the power supply end VDD, and a second end of the second switch S2 is connected to the detection capacitor CX.
[0054] Specifically, the closed states of the first switch S1 and the second switch S2 are opposite states. When the first switch S1 is closed, the second switch S2 is disconnected, and the power supply terminal VDD charges the touch capacitor TX to be tested. When the second switch S2 is closed, the first switch S1 is disconnected, and the touch capacitor TX to be tested charges the detection capacitor CX. The control unit 110 can output a touch control signal to the control end of the first switch S1 and the second switch S2 to control the closed state of the first switch S1 and the second switch S2. Exemplarily, when the touch control signal is logic high, the first switch S1 is closed, the second switch S2 is disconnected, and the power supply terminal VDD charges the touch capacitor TX to be tested. When the touch control signal is logic low, the first switch S1 is disconnected, the second switch S2 is closed, and the touch capacitor TX to be tested charges the detection capacitor CX.
[0055] Continue to refer Figure 3 The switch unit 120 further includes a third switch S3; a first end of the third switch S3 is connected to the second end of the second switch S2 and the detection capacitor CX, and a second end of the third switch S3 is grounded GND.
[0056] Specifically, when the third switch S3 is closed, the detection capacitor CX can be connected to the ground GND through the third switch S3, and the detection capacitor CX is discharged to the ground GND, thereby realizing the discharge of the detection capacitor CX. At the same time, the second switch S2 can also be closed, and at this time, the touch capacitor TX to be measured is connected to the ground GND through the second switch S2 and the third switch S3, thereby realizing the discharge of the touch capacitor TX to be measured. Exemplarily, the control end of the third switch S3 is connected to the control unit 110, and the control unit 110 can output a discharge control signal to the control end of the third switch S3. When the discharge control signal is logically low, the third switch S3 is closed, and the detection capacitor CX is discharged to the ground GND. When the discharge control signal is logically high, the third switch S3 is disconnected, and the charging of the detection capacitor CX is realized by controlling the closed state of the first switch S1 and the second switch S2.
[0057] In some embodiments, the detection capacitor CX can be provided by a general purpose input / output (GPIO). When the third switch S3 is closed and the detection capacitor CX is discharged, 0V can be directly provided to the detection capacitor CX through the GPIO to achieve a strong drive discharge of the detection capacitor CX, thereby increasing the discharge speed of the detection capacitor CX.
[0058] An embodiment of the present invention further provides a method for detecting a touch capacitance, which is performed by the touch capacitance detection circuit provided by any embodiment of the present invention. Figure 4 A schematic diagram of a flow chart of a touch capacitance detection method provided by an embodiment of the present invention. Figure 4 As shown, the method includes:
[0059] S110, controlling the switch unit to alternately connect the first end and the second end, and the first end and the third end.
[0060] Specifically, the control unit can output a touch control signal to control the connection state of the switch unit. When the touch control signal is logic high, the switch unit connects the first end and the second end, and when the touch control signal is logic low, the switch unit connects the first end and the third end. Each time the state of the switch unit is alternated, the detection capacitor can be charged once through the touch capacitor to be tested. At this time, the number of times the detection capacitor is charged can be determined by counting the logical value of the touch control signal.
[0061] S120. When the number of times that the switch unit connects the first end and the third end reaches different preset numbers in sequence, control the second detection unit to detect the voltage of the detection capacitor in sequence to form a plurality of second detection signals.
[0062] Specifically, the number of times the switch unit connects the first terminal and the third terminal is the number of times the detection capacitor is charged. When the number of times of charging reaches a preset number each time, the control unit can control the second detection unit to detect the voltage of the detection capacitor under the current number of charging times, so that the second detection unit generates a plurality of second detection signals corresponding to different number of charging times.
[0063] S130, obtaining a first detection signal output by the first detection unit, and determining a capacitance value of a touch capacitor to be measured according to the first detection signal and a plurality of second detection signals.
[0064] Specifically, after the first detection unit and the second detection unit output the first detection signal and the second detection signal respectively, the control unit obtains the first detection signal and the second detection signal, and determines the capacitance value of the touch capacitor to be measured based on the first detection signal and the multiple second detection signals. The multiple second detection signals can improve the detection accuracy of the capacitance value of the touch capacitor to be measured, while increasing the redundancy of the detection signal and improving the anti-interference capability of the touch capacitor detection circuit.
[0065] The technical solution of this embodiment is to control the second detection unit to detect the voltage of the detection capacitor in sequence when the number of times the switch unit connects the first end and the third end reaches different preset numbers in sequence, so as to form multiple second detection signals. When the control unit determines the capacitance value of the touch capacitor to be measured according to the first detection signal and the multiple second detection signals, the multiple second detection signals can improve the detection accuracy of the capacitance value of the touch capacitor to be measured, and at the same time increase the redundancy of the detection signal, thereby improving the anti-interference ability of the detection circuit of the touch capacitor.
[0066] In some embodiments, the preset times include a first preset number to an nth preset number arranged in ascending order, wherein n is an integer greater than 1; when the number of times the switch unit connects the first end and the third end reaches different preset numbers in sequence, the second detection unit is controlled to detect the voltage of the detection capacitor in sequence to form a plurality of second detection signals, including:
[0067] When the number of times the switch unit connects the first end and the third end reaches the first preset number to the i-th preset number in sequence, the second detection unit is controlled to detect the voltage of the detection capacitor in sequence under the first amplification factor to form i second detection signals; wherein i is an integer greater than or equal to 1 and less than or equal to n, at the i-th preset number, the first detection signal is logic low, and at the i+1-th preset number, the first detection signal is logic high.
[0068] Specifically, Figure 5 A schematic diagram of a flow chart of another touch capacitance detection method provided by an embodiment of the present invention. Figure 5As shown, when the switch unit includes a first switch and a second switch, the control unit is in the first channel scanning state SCAN1, and the control unit controls the first switch and the second switch to be closed in time-sharing manner, so that the touch capacitor to be tested can charge the detection capacitor multiple times. When the number of charge and discharge times chcnt of the detection capacitor reaches the i-th preset number tkcnt, that is, chcnt==tkcnt, and the i-th preset number is less than or equal to the last preset number, that is, i<=n, the control unit enters the first A / D scanning state ADCONV1. At this time, the control unit controls the second detection unit to start, so that the second detection unit detects the voltage of the detection capacitor at the first magnification. At the end of the first A / D scanning state ADCONV1, conv_done is logic high, that is, conv_done==1, and returns to the first channel scanning state SCAN1. When the first detection signal cmp_out is logic low, that is, cmp_out==0, the control unit maintains the first channel scanning state SCAN1, continues to increase the number of charge and discharge times chcnt of the detection capacitor, and when the first detection signal cmp_out is logic low, that is, cmp_out==0, and the number of charge and discharge times chcnt of the detection capacitor reaches the next preset number tkcnt, the control unit enters the first A / D scanning state ADCONV1 again. The second detection unit detects the voltage of the detection capacitor at the first magnification again. At the end of the first A / D scanning state ADCONV1, conv_done is logic high, that is, conv_done==1, and returns to the first channel scanning state SCAN1. Until the first detection signal is logic high, that is, cmp_out==1, the control unit enters the result check state RSLT_CHK.
[0069] When i is less than n, and the number of times the switch unit connects the first end and the third end reaches the i+1th preset number to the nth preset number in sequence, the second detection unit is controlled to detect the voltage of the detection capacitor in sequence under the second amplification factor to form ni second detection signals; wherein the second amplification factor is less than the first amplification factor.
[0070] Specifically, after the control unit enters the result check state RSLT_CHK, it can be determined whether the preset number of times the detection capacitor is currently charged is the last preset number. When the preset number of times the detection capacitor is currently charged is less than the last preset number, that is, i<n, the control unit enters the second channel scanning state SCAN2. At this time, the control unit controls the first switch and the second switch to be closed in time-sharing, so that the touch capacitor to be tested can charge the detection capacitor multiple times until the next preset number is reached, that is, chcnt==tkcnt. When the next preset number is less than or equal to the last preset number, that is, i<=n, the control unit enters the second A / D scanning state ADCONV2. At this time, the control unit controls the second detection unit to start, so that the second detection unit detects the voltage of the detection capacitor at the second magnification. At the end of the first A / D scanning state ADCONV1, conv_done is logically high, that is, conv_done==1. When conv_done is logically high, that is, conv_done==1, and the current charging number of the detection capacitor is less than the last preset number, that is, i<n, the control unit returns to the second channel scanning state SCAN2 and continues to increase the charging and discharging times of the detection capacitor. When the charge and discharge times of the detection capacitor reach the next preset times, i.e., chcnt==tkcnt, and the next preset times are less than or equal to the last preset times, i.e., i<=n, the control unit enters the second A / D scanning state ADCONV2 again, so that the second detection unit detects the voltage of the detection capacitor again at the second magnification.
[0071] When conv_done is logic high, i.e., conv_done==1, and the current charging times of the detection capacitor are greater than or equal to the last preset times, i.e., i>=n, the control unit enters the discharge state DISCHARG to discharge the detection capacitor. Wherein, when the switch unit includes a third switch, in the discharge state DISCHARG, the third switch can be controlled to close to discharge the detection capacitor.
[0072] Continue to refer Figure 5 , when the number of times the switch unit connects the first end and the third end reaches a preset number, after obtaining the first detection signal output by the first detection unit, the method further includes:
[0073] When the first detection signal is logic high and i is equal to n, the second detection signal is saved, and the touch capacitor to be tested and the detection capacitor are controlled to discharge;
[0074] Specifically, Figure 5As shown, when the first detection signal is logic high, that is, cmp_out==1, the control unit enters the result check state RSLT_CHK. When the detection circuit of the touch capacitor includes a storage unit and the switch unit includes a third switch, when the number of times the detection capacitor is charged is greater than or equal to the last preset number of times, the storage unit is controlled to maintain the second detection signal, and the third switch is controlled to be closed, so that the detection capacitor is discharged to the ground through the third switch. The second switch can also be controlled to be closed, so that the touch capacitor to be tested is discharged to the ground through the second switch and the third switch.
[0075] When the first detection signal is logic high and i is less than n, the number of times that the touch capacitor to be tested is connected to the first end and the third end is controlled to reach the i+1th preset number to the nth preset number in sequence, and the detection capacitor is controlled to detect the voltage of the detection capacitor in sequence under the second amplification factor;
[0076] Specifically, Figure 5 As shown, when the first detection signal is logic high, that is, cmp_out==1, the control unit enters the result check state RSLT_CHK. When i is less than n, the control unit enters the second channel scan state SCAN2. At this time, the control unit controls the first switch and the second switch to be closed in time-sharing, so that the touch capacitor to be tested can charge the detection capacitor multiple times until the next preset number is reached.
[0077] When the first detection signal is logic low and the error signal is logic high, the touch capacitor to be tested and the detection capacitor are controlled to discharge.
[0078] Specifically, when the first detection signal is logic low, that is, cmp_out==0, and the error signal is logic high, that is, the error signal is logic 1, the control unit has an error in the first channel scanning state SCAN1. At this time, it can directly jump to the result check state RSLT_CHK, and directly control the discharge of the touch capacitor to be tested and the detection capacitor in the result check state RSLT_CHK.
[0079] Continue to refer Figure 5 , before controlling the switch unit to alternately connect the first end and the second end, and the first end and the third end, further comprising:
[0080] Discharge the touch capacitor and detection capacitor to be tested.
[0081] Specifically, Figure 5As shown, before the first channel scanning state SCAN1, the control unit also includes a channel pre-discharge state PRESCAN. In the channel pre-discharge state PRESCAN, the touch capacitor to be tested and the detection capacitor can be discharged. Exemplarily, the switch unit may include a second switch and a third switch, and during the discharge process, the second switch and the third switch may be controlled to be closed. The discharge time may be preset. For example, it may be configured through a register. After the channel pre-discharge state PRESCAN ends, the control unit enters the first channel scanning state SCAN1.
[0082] In some embodiments, continue to refer to Figure 5 , before the channel pre-discharge state PRESCAN, the control unit also includes a channel switching state CHSW. In the channel switching state CHSW, the control unit can determine whether there is a touch capacitor to be tested. If yes, it jumps to the channel pre-discharge state PRESCAN, and if no, it jumps to the idle state IDLE. Among them, the touch capacitor detection circuit includes a gating switch, and the control unit can output a selection signal for controlling the gating state of the gating switch. Whether there is a touch capacitor to be tested can be determined according to the logic value of the selection signal. For example, Figure 1 As shown, when the selection signal ch_sel is not equal to 0, that is, ch_sel! = 0, it can be determined that there is a touch capacitor to be tested, and the control unit enters the channel pre-discharge state PRESCAN. When the selection signal ch_sel is equal to 0, that is, ch_sel = 0, it can be determined that there is no touch capacitor to be tested, and the control unit enters the idle state IDLE.
[0083] Continue to refer Figure 5 Before the channel switching state CHSW, the control unit also includes an idle state IDLE. After the control unit is reset or the start signal tkst is logic low, that is, tkst is logic 0, the control unit is in the idle state IDLE. When the start signal tkst is logic high, that is, tkst is logic 1, the control unit enters the channel switching state CHSW.
[0084] Continue to refer Figure 5 After the discharge state DISCHARG ends, it can be determined whether there is a touch capacitor to be tested. If there is a touch capacitor to be tested, that is, when the selection signal ch_sel is not equal to 0, the control unit jumps to the channel switching state CHSW. If there is no touch capacitor to be tested, that is, when the selection signal ch_sel is not equal to 0, the control unit jumps to the idle state IDLE.
[0085] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A touch capacitance detection circuit, characterized in that: It includes a control unit, a switch unit, a first detection unit, a second detection unit and a detection capacitor; The control unit is connected to the control end of the switch unit, the first end of the switch unit is connected to the touch capacitor to be tested, the second end of the switch unit is connected to the power supply end, and the third end of the switch unit is connected to the detection capacitor, and the control unit is used to control the switch unit to alternately connect the first end and the second end, and the first end and the third end, and record the number of times the switch unit connects the first end and the third end; The first detection unit and the second detection unit are both connected to the control unit and the detection capacitor, the first detection unit is used to detect the voltage of the detection capacitor to form a first detection signal; the control unit is used to control the second detection unit to sequentially detect the voltage of the detection capacitor when the number of times the switch unit connects the first end and the third end reaches different preset numbers in sequence to form multiple second detection signals; the control unit is also used to determine the capacitance value of the touch capacitor to be tested based on the first detection signal and the multiple second detection signals.
2. The touch capacitance detection circuit according to claim 1, characterized in that: The second detection unit includes an amplification module and an analog-to-digital conversion module; The input end of the amplification module is connected to the detection capacitor, the output end of the amplification module is connected to the input end of the analog-to-digital conversion module, the control end of the analog-to-digital conversion module is connected to the first output end of the control unit, the output end of the analog-to-digital conversion module is connected to the first input end of the control unit, and the control unit is used to control the working state of the analog-to-digital conversion module and receive the second detection signal output by the analog-to-digital conversion module.
3. The touch capacitance detection circuit according to claim 2, characterized in that: Also includes a storage unit; The input end of the storage unit is connected to the output end of the second detection unit, the control end of the storage unit is connected to the first output end of the control unit, the output end of the storage unit is connected to the first input end of the control unit, and the control unit is further used to control the storage unit to store the second detection signal when the switch unit connects the first end and the third end a preset number of times.
4. The touch capacitance detection circuit according to claim 1, characterized in that: The first detection unit includes a digital-to-analog conversion module and a comparison module; The digital-to-analog conversion module is connected to the negative input terminal of the comparison module, the positive input terminal of the comparison module is connected to the detection capacitor, the output terminal of the comparison module is connected to the second input terminal of the control unit, the digital-to-analog conversion module is used to provide a reference voltage for the negative input terminal of the comparison module, and the comparison module is used to compare the reference voltage and the voltage of the detection capacitor to form the first detection signal.
5. The touch capacitance detection circuit according to claim 1, characterized in that: The switch unit includes a first switch and a second switch; The control end of the first switch and the control end of the second switch are connected to the second output end of the control unit, the first end of the first switch and the first end of the second switch are connected to the touch capacitor to be tested, the second end of the first switch is connected to the power supply end, and the second end of the second switch is connected to the detection capacitor.
6. The touch capacitance detection circuit according to claim 5, characterized in that: The switch unit further includes a third switch; A first end of the third switch is connected to the second end of the second switch and the detection capacitor, and a second end of the third switch is grounded.
7. A method for detecting touch capacitance, implemented by the touch capacitance detection circuit according to any one of claims 1 to 6, characterized in that: The method comprises: Control the switch unit to alternately connect the first end and the second end, and the first end and the third end; When the number of times that the switch unit connects the first end and the third end reaches different preset numbers in sequence, controlling the second detection unit to detect the voltage of the detection capacitor in sequence to form a plurality of second detection signals; A first detection signal output by a first detection unit is acquired, and a capacitance value of the touch capacitor to be tested is determined according to the first detection signal and a plurality of the second detection signals.
8. The method for detecting touch capacitance according to claim 7, characterized in that: The preset times include a first preset number to an nth preset number arranged in ascending order, wherein n is an integer greater than 1; when the number of times the switch unit connects the first end and the third end reaches different preset numbers in sequence, the second detection unit is controlled to detect the voltage of the detection capacitor in sequence to form a plurality of second detection signals, including: When the number of times that the switch unit connects the first end and the third end reaches the first preset number to the i-th preset number in sequence, the second detection unit is controlled to detect the voltage of the detection capacitor in sequence under the first amplification factor to form i second detection signals; wherein i is an integer greater than or equal to 1 and less than or equal to n, at the i-th preset number, the first detection signal is logic low, and at the i+1-th preset number, the first detection signal is logic high; When i is less than n, and the number of times the switch unit connects the first end and the third end reaches the i+1th preset number to the nth preset number in sequence, the second detection unit is controlled to detect the voltage of the detection capacitor in sequence under the second amplification factor to form ni second detection signals; wherein the second amplification factor is less than the first amplification factor.
9. The method for detecting touch capacitance according to claim 8, characterized in that: When the number of times the switch unit connects the first end and the third end reaches the preset number, after obtaining the first detection signal output by the first detection unit, the method further includes: When the first detection signal is logic high and i is equal to n, the second detection signal is saved, and the touch capacitor to be tested and the detection capacitor are controlled to discharge; When the first detection signal is logic high and i is less than n, the touch capacitor to be tested is controlled to connect the first end and the third end for a number of times to reach the i+1th preset number to the nth preset number in sequence, and the detection capacitor is controlled to detect the voltage of the detection capacitor in sequence under the second amplification factor; When the first detection signal is logic low and the error signal is logic high, the touch capacitor to be tested and the detection capacitor are controlled to discharge.
10. The method for detecting touch capacitance according to claim 7, characterized in that: Before controlling the switch unit to alternately connect the first end and the second end, and the first end and the third end, the method further includes: The touch capacitor to be tested and the detection capacitor are discharged.