CN109799919A - A kind of single channel ADC realizes the method and device of key and knob - Google Patents

A kind of single channel ADC realizes the method and device of key and knob Download PDF

Info

Publication number
CN109799919A
CN109799919A CN201811595907.1A CN201811595907A CN109799919A CN 109799919 A CN109799919 A CN 109799919A CN 201811595907 A CN201811595907 A CN 201811595907A CN 109799919 A CN109799919 A CN 109799919A
Authority
CN
China
Prior art keywords
key
knob
adc
single channel
threshold value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811595907.1A
Other languages
Chinese (zh)
Inventor
查全超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Hui Lian Technology Co Ltd
Original Assignee
Zhuhai Hui Lian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Hui Lian Technology Co Ltd filed Critical Zhuhai Hui Lian Technology Co Ltd
Priority to CN201811595907.1A priority Critical patent/CN109799919A/en
Publication of CN109799919A publication Critical patent/CN109799919A/en
Pending legal-status Critical Current

Links

Landscapes

  • Input From Keyboards Or The Like (AREA)

Abstract

The present invention relates to the method and device that a kind of single channel ADC realizes key and knob, for realizing: the voltage value that enabled ADC generates key circuit is sampled and is read;The voltage range threshold value being arranged in read voltage and chip is compared, user's input behavior is determined according to comparing result, wherein voltage range threshold value includes knob input voltage threshold value and the corresponding input voltage threshold value of multiple keys;The behavior of corresponding knob or key is executed according to judgement result.The invention has the benefit that realizing the function of knob and key under not increasing the cost of peripheral circuit using single channel ADC, the ADC or IO in a channel are saved.The rotation and key behavior of knob use interrupt mode to notify MCU, occupy few MCU resource and knob or key behavior response is timely.

Description

A kind of single channel ADC realizes the method and device of key and knob
Technical field
The present invention relates to the method and devices that a kind of single channel ADC realizes key and knob, belong to electricity field.
Background technique
Human-computer interaction is the input by computer, and output and equipment realize pair of people and computer in an efficient way Words, the main information exchange studied between people and computer.People inputs relevant information, response meter to computer by input equipment The request of calculation machine sends instruction etc. to computer.Computer is shown or is exported relevant information by output equipment, is prompted and is asked It asks.With the development of science and technology, great variety also has occurred in human-computer interaction, and by traditional keyboard, mouse, key is by now Touch, speech recognition, gesture operation, eyeball and iris recognition etc..
Vehicle-mounted in speaker, key and knob are still main interactive device in the products such as household electrical appliances and observing and controlling.Such as speaker In, it is played with key realization, pause, last track, next track etc., realizes volume plus-minus, reverberation and EQ adjusting etc. with knob.Key The damping of sense of touch and knob feel and bring good human-computer exchange to experience to user.Key behavior can detect I/O port by MCU Voltage on level or chip interior ADC capture button is realized.Digit pulse potentiometer and simulation current potential can be used in knob Device is realized.Direction of rotation can be obtained in the phase information in MCU detection two channel of digit pulse potentiometer.Chip interior ADC is adopted Direction of rotation and angle can be obtained in voltage on collection simulation potentiometer.Existing scheme has the disadvantage in that
(1) largely there is while possessing knob and key in existing electronic product, and knob and key respectively occupy a channel ADC.Considered based on cost and encapsulation, the ADC channel number of a chips and the chip I/O money of IO limited amount, especially small package Source is most valuable.The channel of ADC is generally multiplexed with IO, if there is multiple knobs in scheme, the port number or IO quantity of ADC It may be not enough.The present invention can realize key and knob by single channel ADC, save the ADC or IO in a channel.
(2) existing scheme is generally by the sampled value of the inquiry ADC of MCU timing to determine whether there is knob behavior hair It is raw.This scheme can occupy more MCU resource and knob response not in time.The resource for occupying MCU and response time are and MCU Polling interval it is related, the polling interval that the maximum delay of response time is 2 times.The present invention may be implemented knob rotation or Pressing in a manner of interruption for key notifies MCU to respond, and occupancy MCU resource is few, and knob behavior can timely respond to.
Summary of the invention
It is real by single channel ADC the invention mainly relates to the method and device that a kind of single channel ADC realizes key and knob The function of existing knob and key, knob rotate or carry out knob by the ADC of key pressing chip interior with interrupt mode notice MCU Or key behavior processing
Technical solution of the present invention includes a kind of method that single channel ADC realizes key and knob, which is characterized in that described Method is the following steps are included: S1, the voltage value that enabled ADC generates key circuit are sampled and read;S2, to read Voltage is compared with the voltage range threshold value being arranged in chip, determines user's input behavior according to comparing result, wherein voltage Range threshold includes knob input voltage threshold value and the corresponding input voltage threshold value of multiple keys;S3, according to the judgement of step S2 As a result the behavior of corresponding knob or key is executed.
According to the method that the single channel ADC realizes key and knob, wherein this method further include: determine user be by Key behavior, including the user key-press time is judged according to voltage generation time, judge that the user key-press time specifically includes acquisition user Press and discharge the time difference of key.
According to the method that the single channel ADC realizes key and knob, wherein this method further include:
When being lower than the first preset time between when a user presses a button, then handled the secondary key as short-press behavior, and generate Interrupt and execute subsequent judgement;When being higher than the second preset time between when a user presses a button, then using the secondary key as abnormal behaviour Processing, and generate interruption;Between when a user presses a button in the second preset time and the first preset time, then the secondary key is made It is handled for long-pressing behavior, and generates interruption and execute subsequent judgement.
According to the method that the single channel ADC realizes key and knob, wherein this method further includes by ADC twice Sampled value judges the direction of knob and angle.
According to the method that the single channel ADC realizes key and knob, wherein knob input voltage threshold value and multiple press It further includes a kind of single channel for above-mentioned any means that the corresponding input voltage threshold value of key, which is not overlapped technical solution of the present invention, ADC realizes that the device of key and knob, the device include: key and knob circuit, including a knob and connects not with multiple With the key and reference voltage of resistance value, corresponding voltage is exported for knob to be pressed the button or rotated according to user;Sampling cartridge It sets, is sampled using voltage value of the single channel ADC to key and knob circuit;Comparator, for what is stored to chip interior Knob voltage input threshold value and the corresponding input threshold value of multiple keys are compared with sampled value, and export comparing result;It executes Device, for executing corresponding key or knob behavior according to comparing result.
The device of key and knob is realized according to the single channel ADC, wherein key circuit is configured as: according to chip The resistance value of ADC internal sample precision key number and series resistance can customize adjustment.
The invention has the benefit that realizing knob and key using single channel ADC under not increasing the cost of peripheral circuit Function, save the ADC or IO in a channel.Knob and key behavior use interrupt mode to notify MCU, occupy MCU Resource is few and knob or key behavior response it is timely.
Detailed description of the invention
Fig. 1 show the method overview flow chart of embodiment according to the present invention;
The pin that Fig. 2 show embodiment according to the present invention realizes knob and key schematic diagram;
Fig. 3 show the working-flow figure of embodiment according to the present invention.
Specific embodiment
Technical solution of the present invention suitable for speaker, it is vehicle-mounted control, household electrical appliances and measuring and controlling equipment, below with reference to embodiment and Attached drawing carries out clear, complete description to the technical effect of design of the invention, specific structure and generation, to be completely understood by this Purpose, scheme and the effect of invention.
It should be noted that unless otherwise specified, when a certain feature referred to as " fixation ", " connection " are in another feature, It can directly fix, be connected to another feature, and can also fix, be connected to another feature indirectly.In addition, this The descriptions such as the upper and lower, left and right used in open are only the mutual alignment pass relative to each component part of the disclosure in attached drawing For system.The "an" of used singular, " described " and "the" are also intended to including most forms in the disclosure, are removed Non- context clearly expresses other meaning.In addition, unless otherwise defined, all technical and scientific terms used herein It is identical as the normally understood meaning of those skilled in the art.Term used in the description is intended merely to describe herein Specific embodiment is not intended to be limiting of the invention.Term as used herein "and/or" includes one or more relevant The arbitrary combination of listed item.
It will be appreciated that though various elements, but this may be described using term first, second, third, etc. in the disclosure A little elements should not necessarily be limited by these terms.These terms are only used to for same type of element being distinguished from each other out.For example, not departing from In the case where disclosure range, first element can also be referred to as second element, and similarly, second element can also be referred to as One element.The use of provided in this article any and all example or exemplary language (" such as ", " such as ") is intended merely to more Illustrate the embodiment of the present invention well, and unless the context requires otherwise, otherwise the scope of the present invention will not be applied and be limited.
The present invention provides the explanations to following term:
EQ (Equalizer): balanced device, for adjusting the yield value of each frequency band signals.
ADC (Analog to Digital Converter): analog-digital converter refers to continuously varying analog signal Be converted to discrete digital signal.
IO (Input/Output): chip input/output pin.
MCU (Microcontroller Unit): miniature control unit.
Fig. 1 show the method overview flow chart of embodiment according to the present invention.This method process are as follows: S1 enables ADC pairs The voltage value that key circuit generates is sampled and is read;S2, to the range threshold being arranged in read voltage and chip into Row comparison, according to comparing result determine user's input behavior, wherein range threshold include knob input voltage threshold value and it is multiple by The corresponding input voltage threshold value of key;S3 executes the behavior of corresponding knob or key according to the judgement result of step S2.
The single pin that Fig. 2 show embodiment according to the present invention realizes knob and key schematic diagram.Resistance value shown in Fig. 2 A kind of only implementation, concrete scheme can be determined according to number of keys and ADC sampling precision.As shown in Fig. 2, when rotation knob When RW resistance value change, the input of ADC also changes therewith.The input of ADC are as follows:
ADC input=(R2+RW)/(R2+RW+R1) * VCC
When RW is 0, knob input is 1V up to minimum value, and it is 1.8V that when RW is 10K, knob, which is inputted up to maximum value,.Revolve The input range of button is 1.0V~1.8V.When having by key pressing, the input of ADC can also change, by taking SW2 is pressed as an example, The input of ADC are as follows:
ADC input=(R4* (R2+RW))/(R2*R4+R4*RW+R1*R4+R1*R2+R1*RW) * VCC
When RW is 0, the input of SW2 key is 0.138V up to maximum value, and when RW is 10K, SW2 input is up to minimum value The input range that 0.13V, i.e. SW2 press ADC is 0.13~0.138V.The electricity that other keys press down ADC can similarly be calculated Press input range.The input voltage range of knob and key shown in Fig. 2 is as shown in table 1.The voltage range of knob and key does not have Overlapping, the sampled value of MCU root ADC can distinguish knob behavior or key behavior.
Knob/key Input voltage range
Knob 1.0~1.8V
SW1 0V
SW2 0.13~0.18V
SW3 0.23~0.26V
SW4 0.31~0.36V
SW5 0.375~0.45V
SW6 0.473~0.6V
The input voltage range of knob and key shown in 1 Fig. 2 of table
Fig. 3 show the working-flow figure of embodiment according to the present invention.Resistance with key be it is concatenated, key it Between be it is in parallel, specifically include:
When a chip is powering up, whether software enables the value that ADC reads current ADC input, judge ADC input value in rotation The voltage range of button.If then carrying out corresponding knob behavior processing according to the input value of ADC and setting current ADC sampled value For last sampled value, and corresponding threshold value is set, the setting of threshold value and the sampling precision of ADC and the degree of regulation phase of knob It closes.It is not to judge that key is long-pressing or short-press and carries out corresponding behavior processing.User completes key behaviour under normal circumstances Make, the input value of ADC can all be in the voltage range of knob, enable ADC interruption after setting up last sampled value and threshold value.
The input voltage range of ADC is in the input range of knob voltage always in the case where not by key pressing.When Knob rotates, and the absolute value of the difference between the sampled value of ADC and last sampled value is more than threshold value, and interrupt status is set It rises, the fiducial value of comparator is updated to the sampled value of current ADC by hardware automatically.Software is according to sampled value and last sampled value Between difference be that can determine whether direction of rotation and the angle of knob.With should have by key pressing and release when, the sampled value of ADC with The absolute value of difference between last sampled value also can be more than threshold value, and interrupt status has been set, and hardware automatically compares comparator Value is updated to the sampled value of current ADC.Interruption can be all generated by key pressing and release.Software can be sentenced according to the interval interrupted twice Disconnected is long-pressing or short-press.
It should be appreciated that the embodiment of the present invention can be by computer hardware, the combination of hardware and software or by depositing The computer instruction in non-transitory computer-readable memory is stored up to be effected or carried out.Standard volume can be used in the method Journey technology-includes that the non-transitory computer-readable storage media configured with computer program is realized in computer program, In configured in this way storage medium computer is operated in a manner of specific and is predefined --- according in a particular embodiment The method and attached drawing of description.Each program can with the programming language of level process or object-oriented come realize with department of computer science System communication.However, if desired, the program can be realized with compilation or machine language.Under any circumstance, which can be volume The language translated or explained.In addition, the program can be run on the specific integrated circuit of programming for this purpose.
In addition, the operation of process described herein can be performed in any suitable order, unless herein in addition instruction or Otherwise significantly with contradicted by context.Process described herein (or modification and/or combination thereof) can be held being configured with It executes, and is can be used as jointly on the one or more processors under the control of one or more computer systems of row instruction The code (for example, executable instruction, one or more computer program or one or more application) of execution, by hardware or its group It closes to realize.The computer program includes the multiple instruction that can be performed by one or more processors.
Further, the method can be realized in being operably coupled to suitable any kind of computing platform, wrap Include but be not limited to PC, mini-computer, main frame, work station, network or distributed computing environment, individual or integrated Computer platform or communicated with charged particle tool or other imaging devices etc..Each aspect of the present invention can be to deposit The machine readable code on non-transitory storage medium or equipment is stored up to realize no matter be moveable or be integrated to calculating Platform, such as hard disk, optical reading and/or write-in storage medium, RAM, ROM, so that it can be read by programmable calculator, when Storage medium or equipment can be used for configuration and operation computer to execute process described herein when being read by computer.This Outside, machine readable code, or part thereof can be transmitted by wired or wireless network.When such media include combining microprocessor Or other data processors realize steps described above instruction or program when, invention as described herein including these and other not The non-transitory computer-readable storage media of same type.When methods and techniques according to the present invention programming, the present invention It further include computer itself.
Computer program can be applied to input data to execute function as described herein, to convert input data with life At storing to the output data of nonvolatile memory.Output information can also be applied to one or more output equipments as shown Device.In the preferred embodiment of the invention, the data of conversion indicate physics and tangible object, including the object generated on display Reason and the particular visual of physical objects are described.
The above, only presently preferred embodiments of the present invention, the invention is not limited to above embodiment, as long as It reaches technical effect of the invention with identical means, all within the spirits and principles of the present invention, any modification for being made, Equivalent replacement, improvement etc., should be included within the scope of the present invention.Its technical solution within the scope of the present invention And/or embodiment can have a variety of different modifications and variations.

Claims (7)

1. a kind of method that single channel ADC realizes key and knob, which is characterized in that the described method comprises the following steps:
S1, the voltage value that enabled ADC generates key circuit are sampled and are read;
S2 compares the voltage range threshold value being arranged in read voltage and chip, determines user according to comparing result Input behavior, wherein voltage range threshold value includes knob input voltage threshold value and the corresponding input voltage threshold value of multiple keys;
S3 executes the behavior of corresponding knob or key according to the judgement result of step S2.
2. the method that single channel ADC according to claim 1 realizes key and knob, which is characterized in that this method is also wrapped It includes:
Determine that user is key behavior, including the user key-press time is judged according to voltage generation time, judges the user key-press time Specifically include the time difference that acquisition user pressed and discharged key.
3. the method that single channel ADC according to claim 2 realizes key and knob, which is characterized in that this method is also wrapped It includes:
When being lower than the first preset time between when a user presses a button, then handled the secondary key as short-press behavior, and generate interruption And execute subsequent judgement;
When being higher than the second preset time between when a user presses a button, then using the secondary key as abnormal behaviour processing, and interruption is generated;
Between when a user presses a button in the second preset time and the first preset time, then using the secondary key as long-pressing behavior at Reason, and generate interruption and execute subsequent judgement.
4. the method that single channel ADC according to claim 1 realizes key and knob, which is characterized in that this method is also wrapped It includes and the direction of knob and angle is judged by the sampled value of ADC twice.
5. the method that single channel ADC according to claim 1 realizes key and knob, which is characterized in that the knob is defeated Enter voltage threshold and the corresponding input voltage threshold value of multiple keys is not overlapped.
6. a kind of single channel ADC realizes the device of key and knob, any method in 1-5 is required for perform claim, It is characterized in that, the device includes:
Key and knob circuit, key and reference voltage including a knob and the different resistance values of multiple series connection, for according to Family presses the button or rotates knob and exports corresponding voltage;
Sampling apparatus is sampled using voltage value of the single channel ADC to key and knob circuit;
Comparator, the corresponding input voltage threshold value of knob input voltage threshold value and multiple keys for being stored to chip interior with Sampled value compares, and exports comparing result;
Actuator, for executing corresponding key or knob behavior according to comparing result.
7. the device that single channel ADC according to claim 6 realizes key and knob, which is characterized in that the key electricity Road is configured as:
It can customize adjustment according to the resistance value of chip ADC internal sample precision key number and series resistance.
CN201811595907.1A 2018-12-25 2018-12-25 A kind of single channel ADC realizes the method and device of key and knob Pending CN109799919A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811595907.1A CN109799919A (en) 2018-12-25 2018-12-25 A kind of single channel ADC realizes the method and device of key and knob

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811595907.1A CN109799919A (en) 2018-12-25 2018-12-25 A kind of single channel ADC realizes the method and device of key and knob

Publications (1)

Publication Number Publication Date
CN109799919A true CN109799919A (en) 2019-05-24

Family

ID=66557638

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811595907.1A Pending CN109799919A (en) 2018-12-25 2018-12-25 A kind of single channel ADC realizes the method and device of key and knob

Country Status (1)

Country Link
CN (1) CN109799919A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113612478A (en) * 2021-07-22 2021-11-05 珠海海奇半导体有限公司 ADC key circuit calibration method and system, storage medium and key circuit
CN113848466A (en) * 2021-08-02 2021-12-28 惠州市德赛西威汽车电子股份有限公司 Detection circuit and detection method for realizing rapid response of knob
CN115793869A (en) * 2022-10-27 2023-03-14 广芯微电子(广州)股份有限公司 Key state identification method and device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201039440Y (en) * 2007-03-14 2008-03-19 中兴通讯股份有限公司 A cable control earphone for multi-key and single detection end
CN102354265A (en) * 2011-06-28 2012-02-15 埃派克森微电子(上海)股份有限公司 Device and method for detecting key
CN203325824U (en) * 2013-07-09 2013-12-04 东风汽车公司 Knob type gear shifting switch assembly
CN103676729A (en) * 2013-11-29 2014-03-26 青岛歌尔声学科技有限公司 Digital knob switch multiplexing device and electronic equipment using same
CN203588897U (en) * 2013-11-04 2014-05-07 深圳市北鼎晶辉科技股份有限公司 Rotary knob key combination of toaster
CN106603064A (en) * 2017-03-01 2017-04-26 顺德职业技术学院 Functional circuit for achieving multi-way switch detection by virtue of single-channel ADC
CN106936443A (en) * 2017-04-25 2017-07-07 航天科技控股集团股份有限公司 The control circuit of multiple key switches is controlled with A/D modes

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201039440Y (en) * 2007-03-14 2008-03-19 中兴通讯股份有限公司 A cable control earphone for multi-key and single detection end
CN102354265A (en) * 2011-06-28 2012-02-15 埃派克森微电子(上海)股份有限公司 Device and method for detecting key
CN203325824U (en) * 2013-07-09 2013-12-04 东风汽车公司 Knob type gear shifting switch assembly
CN203588897U (en) * 2013-11-04 2014-05-07 深圳市北鼎晶辉科技股份有限公司 Rotary knob key combination of toaster
CN103676729A (en) * 2013-11-29 2014-03-26 青岛歌尔声学科技有限公司 Digital knob switch multiplexing device and electronic equipment using same
CN106603064A (en) * 2017-03-01 2017-04-26 顺德职业技术学院 Functional circuit for achieving multi-way switch detection by virtue of single-channel ADC
CN106936443A (en) * 2017-04-25 2017-07-07 航天科技控股集团股份有限公司 The control circuit of multiple key switches is controlled with A/D modes

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113612478A (en) * 2021-07-22 2021-11-05 珠海海奇半导体有限公司 ADC key circuit calibration method and system, storage medium and key circuit
CN113848466A (en) * 2021-08-02 2021-12-28 惠州市德赛西威汽车电子股份有限公司 Detection circuit and detection method for realizing rapid response of knob
CN115793869A (en) * 2022-10-27 2023-03-14 广芯微电子(广州)股份有限公司 Key state identification method and device
CN115793869B (en) * 2022-10-27 2023-08-25 广芯微电子(广州)股份有限公司 Key state identification method and device

Similar Documents

Publication Publication Date Title
CN109799919A (en) A kind of single channel ADC realizes the method and device of key and knob
CN103426438B (en) Method and system for analyzing baby crying
CN109814717B (en) Household equipment control method and device, control equipment and readable storage medium
JP7377695B2 (en) User terminal hardware detection method, device, computer device, and storage medium
CN103713784B (en) Capacitance touch testing circuit, device and anti-spot thereof cause knows method for distinguishing by mistake
CN106027809A (en) Volume adjusting method and mobile terminal
Elafoudi et al. Power disaggregation of domestic smart meter readings using dynamic time warping
CN203232565U (en) Multifunctional remote network remote controller
CN209562594U (en) Smart machine key control device
CN106714038B (en) A kind of control method and mobile terminal of sound intensity
JP3198430B2 (en) Switch device and computer system
CN104954965B (en) The detection method and device of earphone keystroke
CN104866226A (en) Terminal device and method for controlling same
CN104912164A (en) Intelligent toilet bowl and control system thereof
CN109359665A (en) A kind of family's electric load recognition methods and device based on support vector machines
CN106488019B (en) A kind of starting-up method of mobile terminal and mobile terminal
CN109324516A (en) A kind of method, apparatus, control equipment and the storage medium at switching interface
CN113468737A (en) Water temperature control method and device, water heater, electronic equipment and storage medium
CN109213020B (en) Intelligent closestool control system, method and device, intelligent closestool cover and intelligent closestool
WO2023116108A1 (en) Method and device for controlling air conditioner, and air conditioner
CN105447363B (en) Fingerprint identification device and electronic equipment
CN114839891B (en) Intelligent bedside table control method based on Internet of things, computer and storage medium
TW201921233A (en) Mouse control method and mouse
CN108491325A (en) file system test method, device, storage medium and terminal
CN109407854A (en) Computer keyboard with MIDI controller function

Legal Events

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

Application publication date: 20190524

RJ01 Rejection of invention patent application after publication