CN103364718B - Button detection and filtering method, interlock circuit, external equipment button detection chip - Google Patents

Button detection and filtering method, interlock circuit, external equipment button detection chip Download PDF

Info

Publication number
CN103364718B
CN103364718B CN201210099872.9A CN201210099872A CN103364718B CN 103364718 B CN103364718 B CN 103364718B CN 201210099872 A CN201210099872 A CN 201210099872A CN 103364718 B CN103364718 B CN 103364718B
Authority
CN
China
Prior art keywords
key
comparator
signal
circuit
sampling
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201210099872.9A
Other languages
Chinese (zh)
Other versions
CN103364718A (en
Inventor
李承翰
S·K·巴登
李艳芳
王一
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fairchild Semiconductor Suzhou Co Ltd
Original Assignee
Fairchild Semiconductor Suzhou Co Ltd
Filing date
Publication date
Application filed by Fairchild Semiconductor Suzhou Co Ltd filed Critical Fairchild Semiconductor Suzhou Co Ltd
Priority to CN201210099872.9A priority Critical patent/CN103364718B/en
Priority to US13/852,812 priority patent/US9456272B2/en
Publication of CN103364718A publication Critical patent/CN103364718A/en
Application granted granted Critical
Publication of CN103364718B publication Critical patent/CN103364718B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a kind of button detection and filtering method, interlock circuit, external equipment button detection chip, the push button signalling of wire-controlled apparatus is accessed external equipment button detection chip;Described external equipment button detection chip carries out digital sample by filter circuit to push button signalling, exports the digital logic signal of corresponding button to audio codec according to sampled result;Described audio codec determines the button being pressed according to described digital logic signal, performs corresponding function;Pass through the solution of the present invention, can be not required on wire-controlled apparatus and electronic equipment use special chip or complex software code to be i.e. avoided that noise interferences in push button signalling, detect the button being pressed accurately, and integrated filter circuit in outside device keys detection chip, the space of printed circuit board can be saved, reduce manufacturing cost, and be easy to product design.

Description

Key detection and filtering method, related circuit and external equipment key detection chip
Technical Field
The present invention relates to signal detection technologies for electronic devices, and in particular, to a key detection and filtering method, a related circuit, and a key detection chip for an external device.
Background
With the rapid development of electronic technology, many portable electronic devices such as walkmans, Compact Disc (CD) players, palm computers, and mobile phones provide a line control device, and a user can conveniently operate the electronic devices through the line control device, for example: the control of music playing, phone answering, volume control and the like are realized.
The drive-by-wire device is usually provided with a plurality of keys to realize different control functions, and the electronic equipment identifies that a certain key is pressed by detecting a key signal. However, in practical applications, the key signal generally contains a noise interference signal, and in order to accurately perform key detection and avoid key detection error detection and missing detection caused by the noise interference signal, a dedicated key signal transmitting chip generally needs to be arranged on the line control device, and a matched key signal receiving chip is arranged on the electronic device.
As shown in fig. 1, a mobile device of Apple (Apple) is provided with a wire-controlled headset, which is provided with a dedicated digital signal transmitting chip IC 1 for recognizing a pressed key and generating a corresponding digital signal to the mobile device, and a dedicated digital signal receiving chip IC2 also provided at a mobile device side for receiving the digital signal and transmitting the digital signal as a control signal to an Audio Codec (Audio Codec)32, and the Audio Codec 32 controls a left channel signal (L _ SPKR) and a right channel signal (R _ SPKR) transmitted to the headset according to the control signal. The method can avoid the key detection error detection and omission caused by noise interference signals, but special chips are required to be arranged on the line control equipment and the electronic equipment, thereby greatly increasing the manufacturing cost.
In addition, the electronic equipment filters the key signal through software, and can also avoid key detection error detection and omission caused by noise interference signals, but complex software codes for filtering are needed, the code processing amount of an operating system of the electronic equipment is increased, and product design is not facilitated.
Disclosure of Invention
In view of the above, in order to solve the problem in the prior art that a dedicated chip or a complex software code is required to avoid noise interference signals contained in the key signals, the present invention mainly aims to provide a key detection and filtering method, a related circuit, and a key detection chip for an external device.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
the invention provides a filter circuit, which is configured to perform digital sampling on a key signal, determine a pressed key according to a sampling result, and output a digital logic signal corresponding to the key.
The invention provides a chip for detecting external equipment keys, which comprises: a filter circuit, digital logic circuit, inter-integrated circuit (I2C) bus; wherein,
the filter circuit is configured to perform digital sampling on the key signal, determine a pressed key according to a sampling result, and output a digital logic signal corresponding to the key to the digital logic circuit;
the digital logic circuit is configured to receive the digital logic signal output by the filter circuit and send the digital logic signal to the audio codec through the I2C bus.
The invention provides a key detection circuit, which comprises: the device comprises an external device key detection chip and an audio codec; wherein,
the external equipment key detection chip is configured to receive a key signal of the line control device, perform digital sampling on the key signal through the filter circuit, and output a digital logic signal corresponding to a key to the audio codec according to a sampling result;
and the audio codec is configured to determine the pressed key according to the digital logic signal and execute a corresponding function.
The invention provides a key detection method, which comprises the following steps:
connecting a key signal of the wire control device into an external equipment key detection chip;
the external equipment key detection chip carries out digital sampling on the key signal through the filter circuit and outputs a digital logic signal corresponding to the key to the audio codec according to a sampling result;
and the audio codec determines the pressed key according to the digital logic signal and executes a corresponding function.
The invention provides a filtering method of a key signal, which comprises the following steps:
the method comprises the steps of carrying out digital sampling on a key signal of the wire control device, determining a pressed key according to a sampling result, and outputting a digital logic signal corresponding to the key.
The invention provides a key detection and filtering method, a related circuit and an external equipment key detection chip, wherein a key signal of a line control device is accessed to the external equipment key detection chip of electronic equipment; the external equipment key detection chip carries out digital sampling on the key signal through the filter circuit and outputs a digital logic signal corresponding to the key to the audio codec according to a sampling result; the audio codec determines the pressed key according to the digital logic signal and executes a corresponding function; therefore, the noise interference signal in the key signal can be avoided without using a special chip or a complex software code on the wire control device and the electronic equipment, and the pressed key can be accurately detected; in addition, the filter circuit is integrated in the external equipment key detection chip, so that the space of a Printed Circuit Board (PCB) can be saved, the manufacturing cost is reduced, and the product design is facilitated.
Drawings
FIG. 1 is a schematic diagram of a detection circuit for a wire-controlled earphone button in the prior art;
FIG. 2 is a schematic diagram of a key detection circuit according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a filter circuit of the online control device according to the embodiment of the present invention when three buttons need to be detected;
fig. 4 is a schematic flowchart of a method for detecting a key according to an embodiment of the present invention.
Detailed Description
The basic idea of the invention is: accessing a key signal of the wire control device into an external equipment key detection chip of the electronic equipment; the external equipment key detection chip carries out digital sampling on the key signal through the filter circuit and outputs a digital logic signal corresponding to the key to the audio codec according to a sampling result; and the audio codec determines the pressed key according to the digital logic signal and executes a corresponding function.
The invention is further described in detail below with reference to the figures and the specific embodiments.
An embodiment of the present invention provides a key detection circuit, as shown in fig. 2, the key detection circuit includes: an external device key detection chip 31, an audio codec 32; wherein,
the external device key detection chip 31 is configured to receive a key signal of the line control device, perform digital sampling on the key signal through the filter circuit, and output a digital logic signal of a corresponding key to the audio codec 32 according to a sampling result;
and the audio codec 32 is configured to determine the pressed key according to the digital logic signal and execute the corresponding function.
The external device key detection chip 31 includes: filter circuit 311, digital logic circuit 312, I2C bus 313; wherein,
the filter circuit 311 is configured to perform digital sampling on the key signal, determine a pressed key according to a sampling result, and output a digital logic signal corresponding to the key to the digital logic circuit 312;
the digital logic circuit 312, configured to receive the digital logic signal output by the filter circuit, and send the digital logic signal to the audio codec 32 through the I2C bus 313;
the external device key detection chip 31 further includes a Mic Switch (Mic _ Switch)314 configured to transmit a voice signal to the audio codec 32 when the Mic key is pressed;
the filter circuit 311 includes: a reference voltage supply circuit 3111, a comparator sampling circuit 3112, a sampling result register 3113, and a logic processing circuit 3114; wherein,
a reference voltage supply circuit 3111 configured to supply a reference voltage of each key to the comparator sampling circuit 3112;
a comparator sampling circuit 3112 configured to set comparators equal to the number of keys, each of the comparators comparing a reference voltage of each of the keys with a voltage of a key signal, wherein the comparator triggered by the key signal transmits a trigger signal to the sampling result register 3113;
specifically, the reference voltage of each key in the comparator sampling circuit 3112 is respectively connected to the first signal input terminal of each comparator, the key signal is connected to the second signal input terminal of each comparator, and the output terminal of each comparator is connected to the sampling result register 3113;
a sampling result register 3113 configured to receive the trigger signal output by each comparator in the comparator sampling circuit 3112, count the output port by a pulse counter according to the trigger condition of each comparator, and send the count result of each output port to the logic processing circuit 3114;
a logic processing circuit 3114 configured to determine a pressed key according to the count result of each output port, and output a digital logic signal corresponding to the key;
specifically, the logic processing circuit 3114 searches for an output port whose count result first reaches a preset threshold, determines that a key corresponding to the output port is a pressed key, and outputs a digital logic signal corresponding to the key.
The operation of the comparator sampling circuit 3112, the sampling result register 3113 and the logic processing circuit 3114 is further described by specific examples.
When the line control device has three keys to be detected, three comparators are disposed in the comparator sampling circuit 3112, as shown in fig. 3, positive input terminals of the three comparators respectively receive reference voltages of the three keys, wherein the positive input terminal of the first comparator CP1 receives the reference voltage Vref1 of the first key, the positive input terminal of the second comparator CP2 receives the reference voltage Vref2 of the second key, the positive input terminal of the third comparator CP3 receives the reference voltage Vref3 of the third key, values of the Vref1, Vref2, and Vref3 are determined by resistance values of series resistors of the keys, and it is assumed that Vref1< Vref2< Vref 3; the negative input ends of the three comparators receive a key signal KPS (key Press signal), when the voltage of KPS is less than Vref1, the three comparators are all triggered to generate high-level trigger signals to the sampling result register 3113, and the sampling result register 3113 adds 1 to the value of the pulse counter of the first output port Out 1; when the KPS voltage is greater than Vref1 and less than Vref2, the first comparator CP1 is not triggered, the second comparator CP2 and the third comparator CP3 are triggered, the second comparator CP2 and the third comparator CP3 generate a high-level trigger signal to the sampling result register 3113, and the sampling result register 3113 increments the pulse counter value of the second output port Out2 by 1; when the KPS voltage is greater than Vref2 and less than Vref3, the first comparator CP1 and the second comparator CP2 are not triggered, the third comparator CP3 is triggered, the third comparator CP3 generates a high-level trigger signal to the sampling result register 3113, and the sampling result register 3113 increments the pulse counter value of the third output port Out3 by 1; when the counting result of the pulse counter of the first output port Out1 reaches the preset threshold value first, it is determined that the first key is pressed, and the logic processing circuit 3114 outputs a digital logic signal corresponding to the first key, such as 01; when the counting result of the pulse counter of the second output port Out2 reaches the preset threshold value first, it is determined that the second key is pressed, and the logic processing circuit 3114 outputs a digital logic signal corresponding to the second key, for example, 10; when the counting result of the pulse counter of the third output port Out3 reaches the preset threshold value first, it is determined that the third key is pressed, and the logic processing circuit 3114 outputs a digital logic signal corresponding to the third key; the preset threshold is generally set according to the sampling rate and the sampling time of the chip on which the filter circuit is located, and may be 10 times, 28 times, 30 times, and the like; here, the larger the threshold value, the more accurate the key detection.
Based on the key detection circuit, an embodiment of the present invention further provides an external device key detection chip, as shown in fig. 2, where the external device key detection chip 31 includes: filter circuit 311, digital logic circuit 312, I2C bus 313; wherein,
the filter circuit 311 is configured to perform digital sampling on the key signal, determine a pressed key according to a sampling result, and output a digital logic signal corresponding to the key to the digital logic circuit 312;
the digital logic circuit 312, configured to receive the digital logic signal output by the filter circuit, and send the digital logic signal to the audio codec 32 through the I2C bus 313;
the external device key detection chip 31 further includes a Mic Switch (Mic Switch)314 configured to transmit a voice signal to the audio codec 32 when the Mic key is pressed;
the filter circuit 311 includes: a reference voltage supply circuit 3111, a comparator sampling circuit 3112, a sampling result register 3113, and a logic processing circuit 3114; wherein,
a reference voltage supply circuit 3111 configured to supply a reference voltage of each key to the comparator sampling circuit 3112;
a comparator sampling circuit 3112 configured to set comparators equal to the number of keys, each of the comparators comparing a reference voltage of each of the keys with a voltage of a key signal, wherein the comparator triggered by the key signal transmits a trigger signal to the sampling result register 3113;
specifically, the reference voltage of each key in the comparator sampling circuit 3112 is respectively connected to the first signal input terminal of each comparator, the key signal is connected to the second signal input terminal of each comparator, and the output terminal of each comparator is connected to the sampling result register 3113;
a sampling result register 3113 configured to receive the trigger signal output by each comparator in the comparator sampling circuit 3112, count the output port by a pulse counter according to the trigger condition of each comparator, and send the count result of each output port to the logic processing circuit 3114;
a logic processing circuit 3114 configured to determine a pressed key according to the count result of each output port, and output a digital logic signal corresponding to the key;
specifically, the logic processing circuit 3114 searches for an output port whose count result first reaches a preset threshold, determines that a key corresponding to the output port is a pressed key, and outputs a digital logic signal corresponding to the key.
As shown in fig. 2, the filter circuit 311 is configured to perform digital sampling on the key signal, determine a pressed key according to a sampling result, and output a digital logic signal corresponding to the key;
the filter circuit 311 includes: a reference voltage supply circuit 3111, a comparator sampling circuit 3112, a sampling result register 3113, and a logic processing circuit 3114; wherein,
a reference voltage supply circuit 3111 configured to supply a reference voltage of each key to the comparator sampling circuit 3112;
a comparator sampling circuit 3112 configured to set comparators equal to the number of keys, each of the comparators comparing a reference voltage of each of the keys with a voltage of a key signal, wherein the comparator triggered by the key signal transmits a trigger signal to the sampling result register 3113;
specifically, the reference voltage of each key in the comparator sampling circuit 3112 is respectively connected to the first signal input terminal of each comparator, the key signal is connected to the second signal input terminal of each comparator, and the output terminal of each comparator is connected to the sampling result register 3113;
a sampling result register 3113 configured to receive the trigger signal output by each comparator in the comparator sampling circuit 3112, count the output port by a pulse counter according to the trigger condition of each comparator, and send the count result of each output port to the logic processing circuit 3114;
a logic processing circuit 3114 configured to determine a pressed key according to the count result of each output port, and output a digital logic signal corresponding to the key;
specifically, the logic processing circuit 3114 searches for an output port whose count result first reaches a preset threshold, determines that a key corresponding to the output port is a pressed key, and outputs a digital logic signal corresponding to the key.
The embodiment of the invention realizes a key detection method, as shown in fig. 4, the method comprises the following steps:
step 101: accessing a key signal of the wire control device into an external equipment key detection chip of the electronic equipment;
here, the external device key detection chip includes an audio interface multi-key detection chip.
Step 102: the external equipment key detection chip carries out digital sampling on the key signal through the filter circuit and outputs a digital logic signal corresponding to the key to the audio codec according to a sampling result;
specifically, a filter circuit is integrated in the external device key detection chip, comparators with the number equal to that of the keys are arranged in the filter circuit, a first signal input end of each comparator receives a reference voltage of each key, a second signal input end of each comparator receives a key signal, each comparator generates a trigger signal when being triggered by the key signal, counting is carried out on a corresponding output port through a pulse counter according to the trigger condition of each comparator, the filter circuit determines the pressed key according to the counting result of each output port, and a digital logic signal corresponding to the key is output to a digital logic circuit in the external device key detection chip; the digital logic Circuit sends the digital logic signal to an audio codec through an Inter-Integrated Circuit (I2C) bus;
the key which is determined to be pressed according to the counting result of each output port is as follows: and inquiring an output port with a counting result reaching a preset threshold value at first, and determining that a key corresponding to the output port is a pressed key.
The implementation of this step is further illustrated by the specific examples below.
When only one key of the line control device needs to be detected, a comparator is arranged in the filter circuit, the positive input end of the comparator receives the reference voltage of the key, and the negative input end of the comparator receives a key signal; when the voltage of the key signal at the negative input end is less than the reference voltage at the positive input end, the comparator is triggered to generate a high-level trigger signal, counting is carried out at an output port through a pulse counter, when the counting result reaches a preset threshold value, the key is determined to be pressed, and a digital logic signal corresponding to the key is output, such as 11; a digital logic circuit in the external device key detection chip sends a digital logic signal to the audio codec through an I2C bus; the preset threshold is generally set according to the sampling rate and the sampling time of the chip on which the filter circuit is located, and may be 10 times, 28 times, 30 times, and the like; here, the larger the threshold value, the more accurate the key detection.
When the line control device has two keys to be detected, two comparators are arranged in the filter circuit, positive input ends of the two comparators respectively receive reference voltages of the two keys, wherein the first comparator receives the reference voltage Vref1 of the first key, the second comparator receives the reference voltage Vref2 of the second key, values of the Vref1 and the Vref2 are determined by resistance values of series resistors of the first key and the second key, and it is assumed that Vref1 is less than Vref 2; the negative input ends of the two comparators receive the key signal, when the voltage of the key signal is less than Vref1, the two comparators are triggered to generate high-level trigger signals, and the value of a pulse counter of the first output port is increased by 1; when the key signal voltage is greater than Vref1 and less than Vref2, the first comparator is not triggered, the second comparator is triggered, the second comparator generates a high-level trigger signal, and the value of a pulse counter of the second output port is increased by 1; and when the counting result of the pulse counter of the first output port reaches a preset threshold value, determining that the first key is pressed, and outputting a digital logic signal corresponding to the first key, such as 01. When the counting result of the pulse counter of the second output port reaches a preset threshold value, determining that the second key is pressed, and outputting a digital logic signal corresponding to the second key, such as 10; a digital logic circuit in the external device key detection chip sends a digital logic signal to the audio codec through an I2C bus; the preset threshold is generally set according to the sampling rate and the sampling time of the chip on which the filter circuit is located, and may be 10 times, 28 times, 30 times, and the like; here, the larger the threshold value, the more accurate the key detection.
When the line control device has three keys to be detected, three comparators are arranged in the filter circuit, positive input ends of the three comparators respectively receive reference voltages of the three keys, wherein the positive input end of the first comparator receives the reference voltage Vref1 of the first key, the positive input end of the second comparator receives the reference voltage Vref2 of the second key, the positive input end of the third comparator receives the reference voltage Vref3 of the third key, values of the Vref1, Vref2 and Vref3 are determined by resistance values of series resistors of the keys, and it is assumed that Vref1 is less than Vref2 is less than Vref 3; the negative input ends of the three comparators receive the key signal, when the voltage of the key signal is less than Vref1, the three comparators are triggered to generate high-level trigger signals, and the value of a pulse counter of the first output port is increased by 1; when the key signal voltage is greater than Vref1 and less than Vref2, the first comparator is not triggered, the second comparator and the third comparator are triggered, the second comparator and the third comparator generate a high-level trigger signal, and the value of a pulse counter of the second output port is increased by 1; when the key signal voltage is greater than Vref2 and less than Vref3, the first comparator and the second comparator are not triggered, the third comparator is triggered, the third comparator generates a high level trigger signal, and the pulse counter value of the third output port is increased by 1. When the counting result of the pulse counter of the first output port reaches a preset threshold value, determining that the first key is pressed down, and outputting a digital logic signal corresponding to the first key, such as 01; when the counting result of the pulse counter of the second output port reaches a preset threshold value, determining that the second key is pressed, and outputting a digital logic signal corresponding to the second key, such as 10; when the counting result of the pulse counter at the third output port reaches the preset threshold value, the third key is determined to be pressed, and a digital logic signal corresponding to the third key is output, such as 11; a digital logic circuit in the external device key detection chip sends a digital logic signal to the audio codec through an I2C bus; the preset threshold is generally set according to the sampling rate and the sampling time of the chip on which the filter circuit is located, and may be 10 times, 28 times, 30 times, and the like; here, the larger the threshold value, the more accurate the key detection.
When the drive-by-wire device has more than three keys to be detected, the working method of the filter circuit is the same as that described above, and no more detection examples of the keys are performed here.
Step 103: and the audio codec determines the pressed key according to the digital logic signal and executes a corresponding function.
The embodiment of the invention realizes a filtering method of a key signal, which comprises the following steps: the method comprises the steps of carrying out digital sampling on a key signal of the wire control device, determining a pressed key according to a sampling result, and outputting a digital logic signal corresponding to the key.
The method further comprises the following steps: setting comparators with the same number as the keys, wherein the first signal input end of each comparator receives the reference voltage of each key respectively, and the second signal input end of each comparator receives the key signal;
the digital sampling of the key signal, the determination of the pressed key according to the sampling result and the output of the digital logic signal corresponding to the key are as follows:
each comparator compares the reference voltage of each key with the voltage of the key signal, wherein the comparator triggered by the key signal generates a trigger signal; counting at the corresponding output port through a pulse counter according to the triggering condition of each comparator, determining a pressed key according to the counting result of each output port, and outputting a digital logic signal corresponding to the key;
the key which is determined to be pressed according to the counting result of each output port is as follows: and inquiring an output port with a counting result reaching a preset threshold value at first, and determining that a key corresponding to the output port is a pressed key.
In summary, the scheme of the present invention can avoid noise interference signals in the key signals and accurately detect the pressed key without using a special chip or complex software code on the line control device and the electronic device; in addition, the filter circuit is integrated in the external equipment key detection chip, so that the space of the PCB can be saved, the manufacturing cost is reduced, and the product design is facilitated.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention.

Claims (21)

1. A filter circuit is characterized in that the filter circuit is configured to perform digital sampling on a key signal, determine a pressed key according to a sampling result, and output a digital logic signal corresponding to the key;
the filter circuit comprises a comparator sampling circuit, a sampling result register and a logic processing circuit; wherein,
the comparator sampling circuit is configured to compare the reference voltage of each key with the voltage of the key signal through each comparator;
the sampling result register is configured to count at an output port corresponding to the comparator triggered by the key signal through a pulse counter and send the counting result of each output port to the logic processing circuit;
and the logic processing circuit is configured to determine a pressed key according to the counting result of each output port and output a digital logic signal corresponding to the key.
2. The method of claim 1, wherein the filter circuit further comprises a reference voltage providing circuit;
a reference voltage supply circuit configured to supply a reference voltage of each key to the comparator sampling circuit;
the comparator sampling circuit is also configured to set comparators equal to the number of the keys; wherein the comparator triggered by the key signal sends a trigger signal to the sampling result register;
and the sampling result register is also configured to receive the trigger signals output by the comparators in the comparator sampling circuit, count at the corresponding output ports through the pulse counter according to the trigger condition of the comparators, and send the counting results of the output ports to the logic processing circuit.
3. The filter circuit according to claim 2, wherein the reference voltage of each key in the comparator sampling circuit is respectively connected to the first signal input terminal of each comparator, the key signal is connected to the second signal input terminal of each comparator, and the output terminal of each comparator is connected to the sampling result register.
4. A chip for detecting keys of an external device, the chip comprising: a filter circuit, digital logic circuit, inter-integrated circuit (I2C) bus; wherein,
the filter circuit is configured to perform digital sampling on the key signal, determine a pressed key according to a sampling result, and output a digital logic signal corresponding to the key to the digital logic circuit;
the digital logic circuit is configured to receive the digital logic signal output by the filter circuit and send the digital logic signal to the audio codec through the I2C bus;
the filter circuit comprises a comparator sampling circuit, a sampling result register and a logic processing circuit; wherein,
the comparator sampling circuit is configured to compare the reference voltage of each key with the voltage of the key signal through each comparator;
the sampling result register is configured to count at an output port corresponding to the comparator triggered by the key signal through a pulse counter and send the counting result of each output port to the logic processing circuit;
and the logic processing circuit is configured to determine a pressed key according to the counting result of each output port and output a digital logic signal corresponding to the key.
5. The peripheral device key detection chip of claim 4, further comprising a microphone switch configured to transmit a voice signal to the audio codec when the microphone key is pressed.
6. The external device key detection chip of claim 4, wherein the filter circuit further comprises a reference voltage providing circuit;
a reference voltage supply circuit configured to supply a reference voltage of each key to the comparator sampling circuit;
the comparator sampling circuit is also configured to set comparators equal to the number of the keys; wherein the comparator triggered by the key signal sends a trigger signal to the sampling result register;
and the sampling result register is also configured to receive the trigger signals output by the comparators in the comparator sampling circuit, count at the corresponding output ports through the pulse counter according to the trigger condition of the comparators, and send the counting results of the output ports to the logic processing circuit.
7. The peripheral device key detection chip of claim 6, wherein the reference voltage of each key in the comparator sampling circuit is respectively connected to the first signal input terminal of each comparator, the key signal is connected to the second signal input terminal of each comparator, and the output terminal of each comparator is connected to the sampling result register.
8. A key detection circuit, comprising: the device comprises an external device key detection chip and an audio codec; wherein,
the external equipment key detection chip is configured to receive a key signal of the line control device, perform digital sampling on the key signal through the filter circuit, and output a digital logic signal corresponding to a key to the audio codec according to a sampling result;
the audio codec is configured to determine a pressed key according to the digital logic signal and execute a corresponding function;
the external equipment key detection chip comprises a filter circuit; the filter circuit is configured to perform digital sampling on the key signal, determine a pressed key according to a sampling result, and output a digital logic signal corresponding to the key to the digital logic circuit;
the filter circuit comprises a comparator sampling circuit, a sampling result register and a logic processing circuit; wherein,
the comparator sampling circuit is configured to compare the reference voltage of each key with the voltage of the key signal through each comparator;
the sampling result register is configured to count at an output port corresponding to the comparator triggered by the key signal through a pulse counter and send the counting result of each output port to the logic processing circuit;
and the logic processing circuit is configured to determine a pressed key according to the counting result of each output port and output a digital logic signal corresponding to the key.
9. The key detection circuit of claim 8, wherein the external device key detection chip further comprises: digital logic, I2C bus; wherein,
the digital logic circuit is configured to receive the digital logic signal output by the filter circuit and send the digital logic signal to the audio codec through the I2C bus.
10. The key detect circuit of claim 9, wherein the peripheral device key detect chip further comprises a microphone switch configured to transmit a voice signal to an audio codec when the microphone key is pressed.
11. The key detect circuit of claim 9, wherein the filter circuit further comprises a reference voltage supply circuit; wherein,
a reference voltage supply circuit configured to supply a reference voltage of each key to the comparator sampling circuit;
the comparator sampling circuit is also configured to set comparators equal to the number of the keys; wherein the comparator triggered by the key signal sends a trigger signal to the sampling result register;
and the sampling result register is also configured to receive the trigger signals output by the comparators in the comparator sampling circuit, count at the corresponding output ports through the pulse counter according to the trigger condition of the comparators, and send the counting results of the output ports to the logic processing circuit.
12. The key detect circuit of claim 11, wherein the reference voltage of each key in the comparator sampling circuit is respectively connected to the first signal input terminal of each comparator, the key signal is connected to the second signal input terminal of each comparator, and the output terminal of each comparator is connected to the sampling result register.
13. A key detection method is characterized by comprising the following steps:
connecting a key signal of the wire control device into an external equipment key detection chip;
the external equipment key detection chip carries out digital sampling on the key signal through the filter circuit and outputs a digital logic signal corresponding to the key to the audio codec according to a sampling result;
the audio codec determines the pressed key according to the digital logic signal and executes a corresponding function;
wherein, carry out digital sampling to the key signal through the filter circuit, output the digital logic signal of corresponding button to the audio frequency codec according to the sampling result, include:
the comparator sampling circuit in the filter circuit compares the reference voltage of each key with the voltage of the key signal through each comparator; a sampling result register in the filter circuit counts at an output port corresponding to a comparator triggered by a key signal through a pulse counter, and sends counting results of all the output ports to a logic processing circuit; and the logic processing circuit in the filter circuit determines the pressed key according to the counting result of each output port and outputs a digital logic signal corresponding to the key.
14. The method of claim 13, wherein the external device key detection chip comprises an audio interface multi-key detection chip.
15. The key detecting method of claim 13, wherein the external device key detecting chip performs digital sampling on the key signal through a filter circuit, and outputs a digital logic signal corresponding to the key to the audio codec according to the sampling result, and the method comprises:
the external equipment key detection chip is integrated with a filter circuit, the filter circuit is internally provided with comparators with the number equal to that of keys, the first signal input end of each comparator receives the reference voltage of each key, the second signal input end of each comparator receives a key signal, each comparator generates a trigger signal when being triggered by the key signal, counting is carried out on the corresponding output port through a pulse counter according to the triggering condition of each comparator, the filter circuit determines the pressed key according to the counting result of each output port, and digital logic signals corresponding to the key are output to a digital logic circuit in the external equipment key detection chip; the digital logic circuit sends the digital logic signal to the audio codec via the I2C bus.
16. The key detecting method of claim 13, wherein the external device key detecting chip performs digital sampling on the key signal through a filter circuit, and outputs a digital logic signal corresponding to the key to the audio codec according to the sampling result, and the method comprises:
when only one key of the line control device needs to be detected, a comparator is arranged in the filter circuit, the positive input end of the comparator receives the reference voltage of the key, the negative input end of the comparator receives a key signal, when the key signal voltage of the negative input end is smaller than the reference voltage of the positive input end, the comparator is triggered to generate a high-level trigger signal, counting is carried out on an output port through a pulse counter, when the counting result reaches a preset threshold value, the key is determined to be pressed, and a digital logic signal corresponding to the key is output; the digital logic circuit in the external device key detection chip sends digital logic signals to the audio codec through the I2C bus.
17. The key detecting method of claim 13, wherein the external device key detecting chip performs digital sampling on the key signal through a filter circuit, and outputs a digital logic signal corresponding to the key to the audio codec according to the sampling result, and the method comprises:
when the line control device has two keys which need to be detected, two comparators are arranged in the filter circuit, positive input ends of the two comparators respectively receive reference voltages of the two keys, wherein the first comparator receives the reference voltage Vref1 of the first key, the second comparator receives the reference voltage Vref2 of the second key, and Vref1 is less than Vref 2; the negative input ends of the two comparators receive the key signal, when the voltage of the key signal is less than Vref1, the two comparators are triggered to generate high-level trigger signals, and the value of a pulse counter of the first output port is increased by 1; when the key signal voltage is greater than Vref1 and less than Vref2, the first comparator is not triggered, the second comparator is triggered, the second comparator generates a high-level trigger signal, and the value of a pulse counter of the second output port is increased by 1; when the counting result of the pulse counter of the first output port reaches a preset threshold value, determining that the first key is pressed down, and outputting a digital logic signal corresponding to the first key; when the counting result of the pulse counter of the second output port reaches a preset threshold value, the second key is determined to be pressed down, and a digital logic signal corresponding to the second key is output; the digital logic circuit in the external device key detection chip sends digital logic signals to the audio codec through the I2C bus.
18. The key detecting method of claim 13, wherein the external device key detecting chip performs digital sampling on the key signal through a filter circuit, and outputs a digital logic signal corresponding to the key to the audio codec according to the sampling result, and the method comprises:
when the line control device has three keys to be detected, three comparators are arranged in the filter circuit, the positive input end of the first comparator receives the reference voltage Vref1 of the first key, the positive input end of the second comparator receives the reference voltage Vref2 of the second key, the positive input end of the third comparator receives the reference voltage Vref3 of the third key, and Vref1< Vref2< Vref 3; the negative input ends of the three comparators receive the key signal, when the voltage of the key signal is less than Vref1, the three comparators are triggered to generate high-level trigger signals, and the value of a pulse counter of the first output port is increased by 1; when the key signal voltage is greater than Vref1 and less than Vref2, the first comparator is not triggered, the second comparator and the third comparator are triggered, the second comparator and the third comparator generate a high-level trigger signal, and the value of a pulse counter of the second output port is increased by 1; when the key signal voltage is greater than Vref2 and less than Vref3, the first comparator and the second comparator are not triggered, the third comparator is triggered, the third comparator generates a high-level trigger signal, and the value of a pulse counter of the third output port is increased by 1; when the counting result of the pulse counter of the first output port reaches a preset threshold value, determining that the first key is pressed down, and outputting a digital logic signal corresponding to the first key; when the counting result of the pulse counter of the second output port reaches a preset threshold value, the second key is determined to be pressed down, and a digital logic signal corresponding to the second key is output; when the counting result of the pulse counter of the third output port reaches a preset threshold value, the third key is determined to be pressed down, and a digital logic signal corresponding to the third key is output; the digital logic circuit in the external device key detection chip sends digital logic signals to the audio codec through the I2C bus.
19. The key detection method according to claim 16, 17 or 18, wherein the preset threshold is set according to a sampling rate and a sampling time of a chip on which the filter circuit is located.
20. A method for filtering a key signal, the method comprising:
a comparator sampling circuit in the filter circuit compares the reference voltage of each key with the voltage of the key signal through each comparator; a sampling result register in the filter circuit counts at an output port corresponding to a comparator triggered by a key signal through a pulse counter, and sends counting results of all the output ports to a logic processing circuit; and the logic processing circuit in the filter circuit determines the pressed key according to the counting result of each output port and outputs a digital logic signal corresponding to the key.
21. The filtering method of claim 20, further comprising: comparators with the same number as the keys are arranged, the first signal input end of each comparator receives the reference voltage of each key, and the second signal input end receives the key signal.
CN201210099872.9A 2012-03-30 2012-03-30 Button detection and filtering method, interlock circuit, external equipment button detection chip Active CN103364718B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201210099872.9A CN103364718B (en) 2012-03-30 Button detection and filtering method, interlock circuit, external equipment button detection chip
US13/852,812 US9456272B2 (en) 2012-03-30 2013-03-28 Button-press detection and filtering

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210099872.9A CN103364718B (en) 2012-03-30 Button detection and filtering method, interlock circuit, external equipment button detection chip

Publications (2)

Publication Number Publication Date
CN103364718A CN103364718A (en) 2013-10-23
CN103364718B true CN103364718B (en) 2016-11-30

Family

ID=

Similar Documents

Publication Publication Date Title
CN202600109U (en) Button detection circuit, filter circuit and external equipment button detection chip
US9680980B2 (en) Electronic device accessory
CN102056051B (en) Electronic device, electronic system, and method for processing signals from an audio accessory thereof
US9654859B2 (en) Mobile terminal earphone line control circuit and line control method
EP2461553B1 (en) Apparatus, systems and methods for controlling an electronic device using an accessory
US8787589B2 (en) Electronic device and system and method thereof for identifying electronic accessory and controlling electronic device
CN101102348A (en) A keyboard circuit and method for recognizing hand-held mobile device
CN103135686A (en) Startup control circuit
CN103379419A (en) Audio frequency access test system
CN103634723B (en) Audio input circuit and the electronic equipment with audio input
CN103364718B (en) Button detection and filtering method, interlock circuit, external equipment button detection chip
CN102608931A (en) System and method for controlling electronic equipment
CN103364718A (en) Button detection and filtering method, relevant circuit and external device button detection chip
TW201508559A (en) Input device and control unit
CN204316455U (en) A kind of Novel earphone volume control circuit of built-in testing state
CN109581093B (en) Detection circuit and related detection method
CN104202000A (en) Earphone volume control circuit with built-in charge pump and mute function
CN205608435U (en) Touch MIDI controller
KR20080065165A (en) Touch earphone, portable terminal having touch earphone and operation method thereof
US9167332B2 (en) Electronic device and method for measuring electric current of external electronic devices using the electronic device
CN107222809B (en) Input device and mobile terminal control method
GB2460501A (en) Electronic device accessory
KR100639327B1 (en) KeyPad of Mobile communication terminal using piezo-electric element
CN105934931A (en) Terminal device
KR20160068025A (en) Application system using I/O signals of earphone

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant