CN102594362A - Key circuit based on analog-digital conversion - Google Patents
Key circuit based on analog-digital conversion Download PDFInfo
- Publication number
- CN102594362A CN102594362A CN2012100473773A CN201210047377A CN102594362A CN 102594362 A CN102594362 A CN 102594362A CN 2012100473773 A CN2012100473773 A CN 2012100473773A CN 201210047377 A CN201210047377 A CN 201210047377A CN 102594362 A CN102594362 A CN 102594362A
- Authority
- CN
- China
- Prior art keywords
- key
- button
- keys
- resistance
- analog
- 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
Links
Images
Abstract
The invention relates to a key circuit based on analog-digital conversion. The key circuit comprises a plurality of keys and resistors, wherein each key is connected with a resistor in parallel to form a key group, all the key groups are further sequentially connected in series, one ends of the series-connected key groups are connected with a power supply VDD (virtual device driver), and the other ends of the series-connected key groups are grounded through the resistors; signals are taken between any two key groups connected in series for being used as the signal output end, and the end is connected with an AD (analog-digital) sampling port of a control chip; and when any key is triggered, the control chip acquires analog voltage signals, performs conversion, then finds the corresponding keys by looking up a key value and key operation corresponding table according to voltage numerical values and controlling and implementing corresponding operations. Compared with the implementation way of scanning the keys, the key circuit disclosed by the invention can effectively avoid the problem that the repeated keys can not be detected or the keys are missed and expand a plurality of keys by only occupying a CPU (central processing unit) interface, and is further conductive to design of a hardware system of an electronic product; the key identification adopts the A/D sampling port to match with the table lookup way; and compared with the way of scanning the keys, the program occupying time is short and the key identification is stable and reliable.
Description
Technical field
The present invention relates to the button designing technique, specifically be meant a kind of based on analog-to-digital key circuit.
Background technology
As a kind of man-machine interaction mode, button is the requisite part of current electronic device.On electronic equipment, several at least buttons, dozens of button at most, their function be convert user's operation to electronic equipment can identified signal.
Existingly by key class is on its principle, mainly be divided into two kinds:
(1) free-standing button; This button implementation is simple, is used in the few scene of number of keys more.Like Fig. 1; This button one end is exported as push button signalling; Pull-up resistor RU_* is pulled to supply voltage VDD to signal; Guarantee that the high level of push button signalling can reach the high level threshold requirement of CPU, the button other end directly is connected on system reference ground GND, guarantees that the low level of signal can reach the low level threshold requirement of CPU.Each button (KEY_*) is corresponding to a key-press status signal SK*; When not having button to press; Because the effect of pull-up resistor RU_* makes key-press status signal SK* remain high level, when button KEY_* presses; The SK* signal is with ground short circuit, and this signal has become low level by high level.CPU can judge whether that through judging SK* signal logic value button presses and detect the corresponding key numbering.
(2) scan-type button (matrix form button); This kind button is applied in the more occasion of number of keys more; Principle is as shown in Figure 2; Push button signalling is made up of row signal SH* and column signal SV*, and wherein the effect of pull-up resistor RU_* and pull down resistor RD_* is to guarantee that the level of signal can satisfy the logic threshold requirement of CPU.Scanning is during button, and CPU gives row signal SH* output low level earlier and detects the level of column signal SV*, if the whole high level not of SV*; Then showing does not have button to press, if the last a certain position of column signal SV* (is example with SV2) is a low level, then representes the KEY5 on the secondary series; KEY8, KEY11 ... Have button to press in these buttons of KEY14, CPU gives column signal SV* output high level immediately and detects row signal SH* then, and a certain position (is example with SH3) is high level among the SH* if detect; Show that then the current KEY11 of being presses, promptly accomplished one-touch scanning this moment.
Above-mentioned two kinds of buttons need take a large amount of cpu data interfaces, and free-standing button is because each button all has an independently data-signal, so will realize the function of N button, CPU just must provide N data interface; And the scan-type button is owing to adopted the mode of matrix; Can realize a button at each node of matrix; Therefore the shared data-interface quantity of this kind method is line data and columns data bulk sum, for example will realize 12 keypress functions, then can use 1X12; 2X6 or 3X4 matrix will be used 12,8,7 data interfaces respectively.Because the cpu data interface resource of a lot of miniaturized electronicss is limited, can not take out too much interface to support button.In the scan-type button, support that the port of line scanning and column scan all must be the bi-directional data interface in addition, and the software realization is very complicated, there is inconvenience in the research and development design aspect.
Summary of the invention
Technical problem to be solved by this invention provide a kind of practice thrift the cpu port extensibility strong based on analog-to-digital key circuit.
For solving the problems of the technologies described above, the present invention adopts following technical scheme to realize:
A kind of based on analog-to-digital key circuit, comprising: several buttons and resistance, signal output part, key assignments and button operation correspondence table is characterized in that,
Said each button all composes in parallel key groups with a resistance, and each key groups is series connection successively again, and series connection key groups one end connects power vd D, and the other end is connected with ground GND through resistance;
Signal output part is taken between the key groups of any two series connection, is connected with control chip one A/D sample port;
Trigger any button, control chip A/D sample port collects analog voltage signal, after the conversion, looks into key assignments and button operation correspondence table according to voltage value, finds corresponding key, and corresponding operation is carried out in control.
Another kind of scheme provided by the invention is: a kind of based on analog-to-digital key circuit, comprising: and several buttons and resistance, signal output part, key assignments and button operation correspondence table is characterized in that,
Said each button all is composed in series key groups with a resistance; Each key groups is parallel with one another again; Parallel connection key groups one end ground connection; The other end meets power vd D through first divider resistance, and through the second divider resistance ground connection, this end also is connected with control chip one A/D sample port as signal output part simultaneously;
Trigger any button, control chip A/D sample port collects analog voltage signal, after the conversion, looks into key assignments and button operation correspondence table according to voltage value, finds corresponding key, and corresponding operation is carried out in control.
Compared with prior art, beneficial effect of the present invention is:
(1) only need take the interface of a CPU, can expand a plurality of buttons, be beneficial to the electronic product Hardware Design;
(2) button identification adopts the A/D sample port to cooperate lookup table mode, compares the scanning key mode, and it is few to take program time, and button identification is reliable and stable;
(3) than scanning button implementation; The problem that can effectively avoid Multiple Bonds can't detect or leak key, the scanning key mode can only return a scanning result in a scan period; Therefore some key-press status can be because the problem of scan period can't detect; Cause leakage key,, otherwise will cause Multiple Bonds to detect only if just support Multiple Bonds to detect in the software design.
Description of drawings
Fig. 1 is a first embodiment of the invention circuit theory sketch map;
Fig. 2 is a circuit working schematic flow sheet according to the invention;
Fig. 3 is a second embodiment of the invention circuit theory sketch map.
Embodiment
Below will combine accompanying drawing and embodiment that the present invention is explained in further detail for the ease of it will be appreciated by those skilled in the art that.
Like Fig. 1, key circuit described in this embodiment is made up of a plurality of buttons and a plurality of resistance, wherein; Each button all composes in parallel key groups with a resistance; Each key groups is series connection successively again, and series connection key groups one end connects power vd D, and the other end is connected with ground GND through resistance; And between the key groups of any two series connection, take out signal as signal output part, it is connected with control chip one A/D sample port.
The present invention is based on analog-to-digital conversion (ADC) principle, and the push button signalling that promptly inputs to control chip CPU is an analog signal, and the AD conversion unit of CPU is to this analog signal sampling, quantification, and coding becomes digital signal with conversion of signals.Simultaneously; A tables of data VKS table that signal voltage is corresponding with button is set in software; Enumerate in the table N button connecting on this ADC mouth might make up the relation with applied signal voltage, CPU looks into the VKS table according to the value of this digital signal can judge whether that button is pressed and the corresponding key numbering.As long as guarantee the result that the combination in any summation of this N resistance can not duplicate, this circuit just can be realized the combination operation of arbitrary number button so.
The concrete operation principle of this circuit is:
(1) when not having button to press, the magnitude of voltage VS0 of output signal VS does
Rx is connected on the resistance in the circuit for all in the formula 1, and a is the resistance numbering of output signal upper end, and b is the resistance numbering of output signal lower end, and n is the total number of button in the circuit.
To realize that 5 buttons are example, suppose supply voltage VDD=5V, resistance R 1=1K Ω is set, R2=2K Ω; R3=4K Ω, R4=8K Ω, R5=16K Ω, R6=32K Ω; Output signal VS is set between the R5 between the R6, then when not having button to press, the value of output voltage of signals VS0eg is:
(2) when a button is pressed under the KEYE, resistance R E is by short circuit, this moment circuit to become be N except RE resistance series connection, output signal VS1E at this moment is:
In formula 2 and the formula 3, Rx is connected on the resistance in the circuit for all, and RE is the corresponding resistance that pushes button, and a numbers for the resistance of output signal upper end, and b is the resistance numbering of output signal lower end, and n is the total number of button in the circuit, and VDD is a supply voltage.
With the above-mentioned example that is set to, when KEY3 pressed, the value of output signal voltage VS13 was:
(3) when any m button is pressed, m corresponding resistance is promptly arranged by short circuit in the circuit, this moment, circuit became remaining (N+1)-m resistance series connection, and the output signal VSm of this moment does
formula 4
In the formula 4, Rx is connected on the resistance in the circuit for all, and Ry is the corresponding resistance that pushes button, and b is the resistance numbering of output signal lower end, and n is the total number of button in the circuit, the number of keys of m for pressing simultaneously, and VDD is a supply voltage.
With the above-mentioned example that is set to, work as KEY2, when KEY3, KEY4 pressed simultaneously, the value of output signal voltage VS31 did
The concrete workflow of circuit according to the invention is shown in accompanying drawing 2.The ADC of CPU is according to the sample rate that configures; Conversion accuracies etc. are carried out analog-to-digital conversion to the signal VS of input, obtain the magnitude of voltage VS_DATA of VS, and CPU searches the pairing key combination of VS_DATA in the VKS table then; Return this key combination, promptly accomplished the button detection.
Wherein, the formulation of VKS table is relevant with the configuration of circuit, therefore if adding up of not duplicating of the resistor satisfied combination in any of the N+1 in the circuit and.With the above-mentioned example that is set to for example, the corresponding VKS of this configuration shows as shown in table 1 below.
The VKS table of 5 buttons of table 1 (series resistance circuit)
Sequence number | Button | The VS value |
1 | NULL | 2.5397 |
2 | KEY1 | 2.5806 |
3 | KEY2 | 2.6230 |
4 | KEY1+KEY2 | 2.6667 |
5 | KEY3 | 2.7119 |
6 | KEY1+KEY3 | 2.7586 |
7 | KEY2+KEY3 | 2.8070 |
8 | KEY1+KEY2+KEY3 | 2.8571 |
9 | KEY4 | 2.9091 |
10 | KEY1+KEY4 | 2.9630 |
11 | KEY2+KEY4 | 3.0189 |
12 | KEY1+KEY2+KEY4 | 3.0769 |
13 | KEY3+KEY4 | 3.1373 |
14 | KEY1+KEY3+KEY4 | 3.2000 |
15 | KEY2+KEY3+KEY4 | 3.2653 |
16 | KEY1+KEY2+KEY3+KEY4 | 3.3333 |
17 | KEY5 | 3.4043 |
18 | KEY1+KEY5 | 3.4783 |
19 | KEY2+KEY5 | 3.5556 |
20 | KEY1+KEY2+KEY5 | 3.6364 |
21 | KEY3+KEY5 | 3.7209 |
22 | KEY1+KEY3+KEY5 | 3.8095 |
23 | KEY2+KEY3+KEY5 | 3.9024 |
24 | KEY4+KEY5 | 4.1026 |
25 | KEY1+KEY4+KEY5 | 4.2105 |
26 | KEY2+KEY4+KEY5 | 4.3243 |
27 | KEY3+KEY4+KEY5 | 4.5714 |
28 | KEY2+KEY3+KEY4+KEY5 | 4.8485 |
29 | KEY1+KEY2+KEY3+KEY4+KEY5 | 5.0000 |
As shown in Figure 3, in the another embodiment of the present invention circuit, resistance adopts series relationship to be connected with button; Be that each button all is composed in series key groups with a resistance; Each key groups is parallel with one another again, parallelly connected key groups one end ground connection, and the other end meets power vd D through divider resistance RBU; Through RB0 divider resistance ground connection, this end also is connected with control chip one A/D sample port as signal output part simultaneously; Trigger any button, control chip A/D sample port collects analog voltage signal, after the conversion, looks into key assignments and button operation correspondence table according to voltage value, finds corresponding key, and corresponding operation is carried out in control.Its design principle and operation principle specifically repeat no more with first embodiment.
The preferred version that the foregoing description is realized for the present invention; And indefiniteness is exhaustive, and the present invention can also have other variations under same idea, need to prove; Conceive under the prerequisite not breaking away from the present invention, any conspicuous replacement and minor variations are all within protection scope of the present invention.
Claims (2)
1. one kind based on analog-to-digital key circuit, comprising: several buttons and resistance, and signal output part, key assignments and button operation correspondence table is characterized in that,
Said each button all composes in parallel key groups with a resistance, and each key groups is series connection successively again, and series connection key groups one end connects power vd D, and the other end is connected with ground GND through resistance;
Signal output part is taken between the key groups of any two series connection, is connected with control chip one A/D sample port;
Trigger any button, control chip A/D sample port collects analog voltage signal, after the conversion, looks into key assignments and button operation correspondence table according to voltage value, finds corresponding key, and corresponding operation is carried out in control.
2. one kind based on analog-to-digital key circuit, comprising: several buttons and resistance, and signal output part, key assignments and button operation correspondence table is characterized in that,
Said each button all is composed in series key groups with a resistance; Each key groups is parallel with one another again; Parallel connection key groups one end ground connection; The other end meets power vd D through first divider resistance, and through the second divider resistance ground connection, this end also is connected with control chip one A/D sample port as signal output part simultaneously;
Trigger any button, control chip A/D sample port collects analog voltage signal, after the conversion, looks into key assignments and button operation correspondence table according to voltage value, finds corresponding key, and corresponding operation is carried out in control.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2012100473773A CN102594362A (en) | 2011-12-06 | 2012-02-28 | Key circuit based on analog-digital conversion |
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201120500089 | 2011-12-06 | ||
CN201120500089.X | 2011-12-06 | ||
CN2012100473773A CN102594362A (en) | 2011-12-06 | 2012-02-28 | Key circuit based on analog-digital conversion |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102594362A true CN102594362A (en) | 2012-07-18 |
Family
ID=46482617
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2012100473773A Pending CN102594362A (en) | 2011-12-06 | 2012-02-28 | Key circuit based on analog-digital conversion |
CN2012200679610U Expired - Fee Related CN202455337U (en) | 2011-12-06 | 2012-02-28 | Key circuit based on analog-to-digital conversion |
Family Applications After (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2012200679610U Expired - Fee Related CN202455337U (en) | 2011-12-06 | 2012-02-28 | Key circuit based on analog-to-digital conversion |
Country Status (1)
Country | Link |
---|---|
CN (2) | CN102594362A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103701472A (en) * | 2013-11-12 | 2014-04-02 | 青岛歌尔声学科技有限公司 | Digital keying circuit and keying equipment |
CN104363022A (en) * | 2014-10-13 | 2015-02-18 | 惠州市德赛西威汽车电子有限公司 | AD (analog-digital) keyboard circuit and method for adaptively adjusting AD keys |
CN104461035A (en) * | 2014-11-10 | 2015-03-25 | 深圳市元征科技股份有限公司 | MCU keyboard circuit capable of enabling multiple keys to be pressed simultaneously and implementation method thereof |
CN110531272A (en) * | 2019-08-27 | 2019-12-03 | 烟台创为新能源科技有限公司 | A kind of battery thermal runaway detection system automatic coding |
CN111064460A (en) * | 2019-12-30 | 2020-04-24 | 广州视源电子科技股份有限公司 | Switch circuit, switch identification method, storage medium, and terminal |
CN111781545A (en) * | 2020-07-10 | 2020-10-16 | 迈普通信技术股份有限公司 | Port state management circuit, method, device and readable storage medium |
CN113581334A (en) * | 2021-09-07 | 2021-11-02 | 重庆隆鑫新能源科技有限公司 | Control circuit combination and motorcycle |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102594362A (en) * | 2011-12-06 | 2012-07-18 | 广东九联科技股份有限公司 | Key circuit based on analog-digital conversion |
CN104360752A (en) * | 2014-11-10 | 2015-02-18 | 深圳市元征科技股份有限公司 | MCU (micro control unit) keyboard circuit and implementation method for same |
CN109510628B (en) * | 2018-11-05 | 2022-10-25 | 珠海市杰理科技股份有限公司 | Key circuit, matrix key circuit and key identification method of matrix key circuit |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070247339A1 (en) * | 2006-04-04 | 2007-10-25 | Zippy Technology Corp. | Keyboard without ghost keys |
CN101102348A (en) * | 2007-06-28 | 2008-01-09 | 中兴通讯股份有限公司 | A keyboard circuit and method for recognizing hand-held mobile device |
CN101795139A (en) * | 2010-01-27 | 2010-08-04 | 中山市嘉科电子有限公司 | Method and circuit for detecting press key |
CN201662609U (en) * | 2010-01-27 | 2010-12-01 | 中山市嘉科电子有限公司 | Key detection circuit |
CN201859203U (en) * | 2010-11-03 | 2011-06-08 | 中航华东光电有限公司 | Key detection circuit of a singlechip or microprocessor with an analog-digital converter |
CN202455337U (en) * | 2011-12-06 | 2012-09-26 | 广东九联科技股份有限公司 | Key circuit based on analog-to-digital conversion |
-
2012
- 2012-02-28 CN CN2012100473773A patent/CN102594362A/en active Pending
- 2012-02-28 CN CN2012200679610U patent/CN202455337U/en not_active Expired - Fee Related
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070247339A1 (en) * | 2006-04-04 | 2007-10-25 | Zippy Technology Corp. | Keyboard without ghost keys |
CN101102348A (en) * | 2007-06-28 | 2008-01-09 | 中兴通讯股份有限公司 | A keyboard circuit and method for recognizing hand-held mobile device |
CN101795139A (en) * | 2010-01-27 | 2010-08-04 | 中山市嘉科电子有限公司 | Method and circuit for detecting press key |
CN201662609U (en) * | 2010-01-27 | 2010-12-01 | 中山市嘉科电子有限公司 | Key detection circuit |
CN201859203U (en) * | 2010-11-03 | 2011-06-08 | 中航华东光电有限公司 | Key detection circuit of a singlechip or microprocessor with an analog-digital converter |
CN202455337U (en) * | 2011-12-06 | 2012-09-26 | 广东九联科技股份有限公司 | Key circuit based on analog-to-digital conversion |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103701472A (en) * | 2013-11-12 | 2014-04-02 | 青岛歌尔声学科技有限公司 | Digital keying circuit and keying equipment |
CN104363022A (en) * | 2014-10-13 | 2015-02-18 | 惠州市德赛西威汽车电子有限公司 | AD (analog-digital) keyboard circuit and method for adaptively adjusting AD keys |
CN104363022B (en) * | 2014-10-13 | 2018-03-09 | 惠州市德赛西威汽车电子股份有限公司 | A kind of AD buttons self-adapting regulation method |
CN104461035A (en) * | 2014-11-10 | 2015-03-25 | 深圳市元征科技股份有限公司 | MCU keyboard circuit capable of enabling multiple keys to be pressed simultaneously and implementation method thereof |
CN104461035B (en) * | 2014-11-10 | 2017-06-20 | 深圳市元征科技股份有限公司 | Many buttons can be processed while the MCU keyboard circuits pressed and its implementation |
CN110531272A (en) * | 2019-08-27 | 2019-12-03 | 烟台创为新能源科技有限公司 | A kind of battery thermal runaway detection system automatic coding |
CN111064460A (en) * | 2019-12-30 | 2020-04-24 | 广州视源电子科技股份有限公司 | Switch circuit, switch identification method, storage medium, and terminal |
CN111781545A (en) * | 2020-07-10 | 2020-10-16 | 迈普通信技术股份有限公司 | Port state management circuit, method, device and readable storage medium |
CN113581334A (en) * | 2021-09-07 | 2021-11-02 | 重庆隆鑫新能源科技有限公司 | Control circuit combination and motorcycle |
Also Published As
Publication number | Publication date |
---|---|
CN202455337U (en) | 2012-09-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN202455337U (en) | Key circuit based on analog-to-digital conversion | |
KR101598559B1 (en) | Key press detecting circuit | |
CN201859203U (en) | Key detection circuit of a singlechip or microprocessor with an analog-digital converter | |
US10408862B2 (en) | Multiple channel capacitive voltage divider scanning method and apparatus | |
CN110856448A (en) | Capacitance detection circuit, touch device and terminal equipment | |
CN102467241A (en) | Keyboard of mobile terminal and method for realizing keying and keyboard lock for same | |
CN101394185A (en) | Press-key detection circuit and method thereof | |
CN103701472A (en) | Digital keying circuit and keying equipment | |
CN101951263B (en) | Key scanning method and system | |
CN107168452B (en) | A kind of key-press input processing circuit | |
US5983116A (en) | Radio telephone having analog key signal output for power conservation | |
CN213875939U (en) | Key detection circuit | |
CN101162906A (en) | Keyboard scanning system and method | |
CN102857231B (en) | A kind of key press detecting circuit | |
CN104898853A (en) | Novel three-terminal tact switch | |
US20130283077A1 (en) | Wake-up circuit and electronic device | |
US20130275632A1 (en) | Key detection circuit | |
CN101211324A (en) | Input system | |
CN102111467A (en) | Mobile phone and key detection device thereof | |
CN201113981Y (en) | Press key detection circuit | |
CN107332568B (en) | Key coding circuit and keyboard scanning circuit | |
CN207817640U (en) | A kind of keyboard circuit based on NE555 multi-harmonic-oscillations | |
CN114003147A (en) | Signal detection device, touch pad and electronic equipment | |
CN202261221U (en) | General key board | |
CN202512520U (en) | Key array input device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20120718 |