CN101795139A - Method and circuit for detecting press key - Google Patents

Method and circuit for detecting press key Download PDF

Info

Publication number
CN101795139A
CN101795139A CN201010113192A CN201010113192A CN101795139A CN 101795139 A CN101795139 A CN 101795139A CN 201010113192 A CN201010113192 A CN 201010113192A CN 201010113192 A CN201010113192 A CN 201010113192A CN 101795139 A CN101795139 A CN 101795139A
Authority
CN
China
Prior art keywords
mouth
chip microcomputer
voltage signal
input
button
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
CN201010113192A
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.)
ZHONGSHAN CITY JACK ELECTRONIC CO Ltd
Original Assignee
ZHONGSHAN CITY JACK ELECTRONIC 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 ZHONGSHAN CITY JACK ELECTRONIC CO Ltd filed Critical ZHONGSHAN CITY JACK ELECTRONIC CO Ltd
Priority to CN201010113192A priority Critical patent/CN101795139A/en
Publication of CN101795139A publication Critical patent/CN101795139A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Input From Keyboards Or The Like (AREA)

Abstract

The invention discloses a method for detecting a press key. The method comprises the following steps: setting a circuit for detecting the press key; detecting whether the press key is pressed down; carrying out voltage A/D conversion; judging which press key is pressed down concretely; and waiting for the press keys to be pressed down next time. The invention also discloses the circuit for detecting the press key, which comprises a plurality of divider resistances with different resistance values and a singlechip, wherein one end of each divider resistance is respectively and correspondingly connected with one end of each press key; the other ends of a plurality of press keys are earthed; the other ends of a plurality of divider resistances are connected together to form a voltage signal detecting end; the voltage signal detecting end is connected to a power supply after passing through another resistance; and a multiplexed IO port of the singlechip, which serves as both an interrupt input IO port and an A/D conversion input port, is connected to the voltage signal detecting end. The method and the circuit for detecting the press key are characterized by capability of realizing scanning dozens of press keys only by utilizing one or two IO ports of the singlechip and have the advantages of few occupied IO ports of the singlechip, low cost of the singlechip and the like.

Description

A kind of key detecting method and key press detecting circuit
[technical field]
The present invention relates to a kind of key detecting method and key press detecting circuit.
[background technology]
Have on the existing market and have the button input in many household appliances, wherein great majority are to adopt Single-chip Controlling, common keyboard scanning method generally adopts matrix-style scanning, need use a plurality of IO mouths of single-chip microcomputer, button identification such as the keyboard of 12 keys just needs to adopt 7 IO mouths (3 row, 4 row or 3 row, 4 row) to finish, this button detects and has taken more single-chip microcomputer IO mouth resource, gets over for a long time when the IO of single-chip microcomputer mouth, and needed single-chip microcomputer cost also will be high more.
[summary of the invention]
The present invention has overcome the deficiency of above-mentioned technology, a kind of key detecting method is provided, only need have utilized single-chip microcomputer IO mouth seldom just to realize the scanning of the button of dozens of, made circuit structure very simple by this method, the reliability height, the cost of single-chip microcomputer reduces greatly.
The present invention provides a kind of key press detecting circuit simultaneously, only need utilize the IO mouth seldom of single-chip microcomputer just to realize the scanning of the button of dozens of by this key press detecting circuit, makes circuit structure very simple, the reliability height, and the cost of single-chip microcomputer reduces greatly.
For achieving the above object, the present invention has adopted following technical proposal:
A kind of key detecting method comprises the steps:
A), key press detecting circuit is set: with an end ground connection of a plurality of buttons, the other end of a plurality of buttons is joined together to form the voltage signal test side behind the divider resistance by different resistances respectively, this voltage signal test side is connected on the power supply after by resistance, the interruption input IO mouth and the A/D conversion input IO mouth of single-chip microcomputer is connected with described this voltage signal test side;
B), whether detection has button to press: the voltage that the IO mouth detects described voltage signal test side is imported in the interruption with single-chip microcomputer, and when the voltage of the interruption input IO of single-chip microcomputer mouth detection equaled supply voltage, single-chip microcomputer can be judged as high level, and do not have button and press this moment; When the voltage of the interruption input IO of single-chip microcomputer mouth detection was lower than supply voltage, single-chip microcomputer can be judged as low level, and single-chip microcomputer produces trailing edge and interrupts, and have button to press this moment;
C), the A/D of voltage conversion: produce in the trailing edge interrupt procedure at single-chip microcomputer, import the voltage transitions that the IO mouth will detect described voltage signal test side with the A/D conversion of single-chip microcomputer and become digital voltage;
D), judge it specifically is that certain button is pressed: single-chip microcomputer is changed the size of importing the digital voltage after the IO mouth is changed according to A/D, and judging is that certain button is pressed;
E), wait for that button is pressed next time: after the button judgement is finished, allow interruption input IO mouth wait for that button is pressed next time.
The IO mouth that the IO mouth respectively uses single-chip microcomputer is imported in the interruption input IO mouth and the A/D conversion of single-chip microcomputer.
The IO mouth that the IO mouth uses single-chip microcomputer is jointly imported in the interruption input IO mouth and the A/D conversion of single-chip microcomputer, formed multiplexing IO mouth.
When execution in step b, the multiplexing IO mouth of single-chip microcomputer is set to interrupt input IO mouth, and when execution in step c and d, the multiplexing IO mouth of single-chip microcomputer is set to A/D conversion input IO mouth, when execution in step e, the multiplexing IO mouth of single-chip microcomputer is set to interrupt input IO mouth again.
Described single-chip microcomputer is the PIC16F884 single-chip microcomputer.
Include divider resistance and single-chip microcomputer that a plurality of resistances have nothing in common with each other, one end of a plurality of divider resistances and the corresponding connection respectively of an end of button, the other end ground connection of a plurality of buttons, the other end of a plurality of divider resistances is joined together to form the voltage signal test side, and this voltage signal test side is connected on the power supply after by another resistance; One of described single-chip microcomputer as interrupting IO mouth that input IO mouth uses and another is connected on the described voltage signal test side as IO mouth that A/D conversion input IO mouth uses.
Described single-chip microcomputer is the PIC16F884 single-chip microcomputer.
The employed testing circuit of described key detecting method, it includes divider resistance and single-chip microcomputer that a plurality of resistances have nothing in common with each other, one end of a plurality of divider resistances and the corresponding connection respectively of an end of button, the other end ground connection of a plurality of buttons, the other end of a plurality of divider resistances is joined together to form the voltage signal test side, and this voltage signal test side is connected on the power supply after by another resistance; A double multiplexing IO mouth that interrupts input IO mouth and the use of A/D conversion input IO mouth of doing of described single-chip microcomputer is connected on the described voltage signal test side.
Described single-chip microcomputer is the PIC16F884 single-chip microcomputer.
Compared with prior art, the invention has the beneficial effects as follows: 1, only need utilize one or two IO mouth of single-chip microcomputer, just can realize the key scan of dozens of, it is very simple to make that circuit structure becomes, and reliability is corresponding to be improved; 2, because the fewer IO mouth that takies single-chip microcomputer reduces the cost of single-chip microcomputer greatly.
[description of drawings]
Be described in further detail below in conjunction with accompanying drawing and embodiments of the present invention:
Fig. 1 is the flow chart of detection method among the present invention;
Fig. 2 is the circuit structure diagram of the embodiment 1 of testing circuit among the present invention;
Fig. 3 is the circuit structure diagram of the embodiment 2 of testing circuit among the present invention.
[embodiment]
Fig. 1 is the flow chart of key detecting method of the present invention, and this method comprises the steps:
A), key press detecting circuit is set: with an end ground connection of a plurality of buttons, the other end of a plurality of buttons is joined together to form the voltage signal test side behind the divider resistance by different resistances respectively, this voltage signal test side is connected on the power supply after by resistance, the interruption input IO mouth and the A/D conversion input IO mouth of single-chip microcomputer is connected with described this voltage signal test side;
B), whether detection has button to press: interrupt input IO mouth and be set to trailing edge triggering interruption, detect the voltage of described voltage signal test side with the interruption input IO mouth of single-chip microcomputer, if not having button presses, the voltage that the interruption input IO mouth of single-chip microcomputer detects equals supply voltage, single-chip microcomputer can be judged as high level, and illustrating does not have button and press this moment; If there is button to press, the voltage that the interruption of single-chip microcomputer input IO mouth detects is lower than supply voltage, and single-chip microcomputer can be judged as low level, and single-chip microcomputer produces trailing edge and interrupts, and illustrates that have button to press this moment;
C), the A/D of voltage conversion: have button to press, single-chip microcomputer produces trailing edge and interrupts, and produces in the trailing edge interrupt procedure at single-chip microcomputer, imports the voltage transitions that the IO mouth will detect described voltage signal test side with the A/D conversion of single-chip microcomputer and becomes digital voltage;
D), judge it specifically is that certain button is pressed: when pressing owing to each button, the electric resistance partial pressure value that is produced on the voltage signal test side is different, digital voltage value after the conversion of A/D conversion input IO mouth is also with difference so, the size of the digital voltage after single-chip microcomputer is changed according to A/D conversion input IO mouth, judging correspondence is that certain button is pressed;
E), wait for button next time: after the button judgement is finished, allow interruption input IO mouth wait for that button produces next time.
Said method, employed single-chip microcomputer are the PIC16F884 single-chip microcomputer.
State in the procedure IO mouth that the interruption input IO mouth and the A/D conversion input IO mouth of single-chip microcomputer respectively can be used single-chip microcomputer in realization.
State in the procedure in realization, also the interruption input IO mouth and the A/D conversion of single-chip microcomputer can be imported the IO mouth that the IO mouth use single-chip microcomputer jointly, form multiplexing IO mouth, when using multiplexing IO mouth, will go at times to use so, when execution in step b, the multiplexing IO mouth of single-chip microcomputer is set to interrupt input IO mouth, when execution in step c and d, the multiplexing IO mouth of single-chip microcomputer is set to A/D conversion input IO mouth, when execution in step e, the multiplexing IO mouth of single-chip microcomputer is set to interrupt input IO mouth again, and is made as trailing edge triggering interruption.
Fig. 2 is for realizing a specific embodiment of the employed key press detecting circuit of above-mentioned detection method, the key press detecting circuit of this embodiment includes 5 (can certainly be other number, picture is more than 10) the resistance divider resistance and the single-chip microcomputer that have nothing in common with each other, the resistance of 5 divider resistance R1-R5 is respectively 30K Ω, 24K Ω, 18K Ω, 12K Ω, 5K Ω, 5 divider resistance R1-R5 one ends are distinguished corresponding connection with the end of 5 button S1-S5, the other end ground connection of 5 button S1-S5, the other end of 5 divider resistances is joined together to form the voltage signal test side, and this voltage signal test side is to be connected on the power supply after the resistance R 20 of 100K Ω by another resistance; One of described single-chip microcomputer as interrupting IO mouth that input IO mouth uses and another is connected on the described voltage signal test side as IO mouth that A/D conversion input IO mouth uses.Described single-chip microcomputer is the PIC16F884 single-chip microcomputer.
Fig. 3 is for realizing another specific embodiment of the employed key press detecting circuit of above-mentioned detection method, the key press detecting circuit of this embodiment includes 5 (can certainly be other number, picture is more than 10) the resistance divider resistance and the single-chip microcomputer that have nothing in common with each other, the resistance of 5 divider resistance R1-R5 is respectively 30K Ω, 24K Ω, 18K Ω, 12K Ω, 5K Ω, 5 divider resistance R1-R5 one ends are distinguished corresponding connection with the end of 5 button S1-S5, the other end ground connection of 5 button S1-S5, the other end of 5 divider resistances is joined together to form the voltage signal test side, and this voltage signal test side is to be connected on the power supply after the resistance R 20 of 100K Ω by another resistance; A double multiplexing IO mouth that interrupts input IO mouth and the use of A/D conversion input IO mouth of doing of described single-chip microcomputer is connected on the described voltage signal test side.Described single-chip microcomputer is the PIC16F884 single-chip microcomputer.

Claims (9)

1. a key detecting method is characterized in that comprising the steps:
A), key press detecting circuit is set: with an end ground connection of a plurality of buttons, the other end of a plurality of buttons is joined together to form the voltage signal test side behind the divider resistance by different resistances respectively, this voltage signal test side is connected on the power supply after by resistance, the interruption input IO mouth and the A/D conversion input IO mouth of single-chip microcomputer is connected with described this voltage signal test side;
B), whether detection has button to press: the voltage that the IO mouth detects described voltage signal test side is imported in the interruption with single-chip microcomputer, and when the voltage of the interruption input IO of single-chip microcomputer mouth detection equaled supply voltage, single-chip microcomputer can be judged as high level, and do not have button and press this moment; When the voltage of the interruption input IO of single-chip microcomputer mouth detection was lower than supply voltage, single-chip microcomputer can be judged as low level, and single-chip microcomputer produces trailing edge and interrupts, and have button to press this moment;
C), the A/D of voltage conversion: produce in the trailing edge interrupt procedure at single-chip microcomputer, import the voltage transitions that the IO mouth will detect described voltage signal test side with the A/D conversion of single-chip microcomputer and become digital voltage;
D), judge it specifically is that certain button is pressed: single-chip microcomputer is changed the size of importing the digital voltage after the IO mouth is changed according to A/D, and judging is that certain button is pressed;
E), wait for that button is pressed next time: after the button judgement is finished, allow interruption input IO mouth wait for that button is pressed next time.
2. a kind of key detecting method according to claim 1 is characterized in that the IO mouth that the IO mouth respectively uses single-chip microcomputer is imported in the interruption input IO mouth and the A/D conversion of single-chip microcomputer.
3. a kind of key detecting method according to claim 1 is characterized in that the IO mouth that the IO mouth uses single-chip microcomputer is jointly imported in the interruption input IO mouth and the A/D conversion of single-chip microcomputer, forms multiplexing IO mouth.
4. a kind of key detecting method according to claim 3, it is characterized in that when execution in step b, the multiplexing IO mouth of single-chip microcomputer is set to interrupt input IO mouth, when execution in step c and d, the multiplexing IO mouth of single-chip microcomputer is set to A/D conversion input IO mouth, when execution in step e, the multiplexing IO mouth of single-chip microcomputer is set to interrupt input IO mouth again.
5. according to claim 2 or 3 or 4 described a kind of key detecting methods, it is characterized in that described single-chip microcomputer is the PIC16F884 single-chip microcomputer.
6. finish the employed key press detecting circuit of the described key detecting method of claim 1, it is characterized in that including divider resistance and the single-chip microcomputer that a plurality of resistances have nothing in common with each other, one end of a plurality of divider resistances and the corresponding connection respectively of an end of button, the other end ground connection of a plurality of buttons, the other end of a plurality of divider resistances is joined together to form the voltage signal test side, and this voltage signal test side is connected on the power supply after by another resistance; One of described single-chip microcomputer as interrupting IO mouth that input IO mouth uses and another is connected on the described voltage signal test side as IO mouth that A/D conversion input IO mouth uses.
7. key press detecting circuit according to claim 6 is characterized in that described single-chip microcomputer is the PIC16F884 single-chip microcomputer.
8. finish the employed testing circuit of the described key detecting method of claim 1, it is characterized in that including divider resistance and the single-chip microcomputer that a plurality of resistances have nothing in common with each other, one end of a plurality of divider resistances and the corresponding connection respectively of an end of button, the other end ground connection of a plurality of buttons, the other end of a plurality of divider resistances is joined together to form the voltage signal test side, and this voltage signal test side is connected on the power supply after by another resistance; A double multiplexing IO mouth that interrupts input IO mouth and the use of A/D conversion input IO mouth of doing of described single-chip microcomputer is connected on the described voltage signal test side.
9. key press detecting circuit according to claim 8 is characterized in that described single-chip microcomputer is the PIC16F884 single-chip microcomputer.
CN201010113192A 2010-01-27 2010-01-27 Method and circuit for detecting press key Pending CN101795139A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010113192A CN101795139A (en) 2010-01-27 2010-01-27 Method and circuit for detecting press key

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010113192A CN101795139A (en) 2010-01-27 2010-01-27 Method and circuit for detecting press key

Publications (1)

Publication Number Publication Date
CN101795139A true CN101795139A (en) 2010-08-04

Family

ID=42587586

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010113192A Pending CN101795139A (en) 2010-01-27 2010-01-27 Method and circuit for detecting press key

Country Status (1)

Country Link
CN (1) CN101795139A (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102386930A (en) * 2011-09-23 2012-03-21 北京易投嘉德投资咨询有限公司 Collecting circuit for recognizing key state
CN102565694A (en) * 2011-12-31 2012-07-11 广东盈科电子有限公司 Non-AD-port key detection circuit and detection method thereof
CN102594362A (en) * 2011-12-06 2012-07-18 广东九联科技股份有限公司 Key circuit based on analog-digital conversion
CN102654540A (en) * 2012-04-26 2012-09-05 蚌埠依爱消防电子有限责任公司 Button detecting device for fire alarm systems
CN102868392A (en) * 2011-07-06 2013-01-09 广东万和新电气股份有限公司 Portability key circuit
CN103135054A (en) * 2013-01-31 2013-06-05 建荣集成电路科技(珠海)有限公司 Press key detection circuit integrating light-emitting diode (LED) driving and infrared remote control receiving function and integration achieving method
CN104270160A (en) * 2014-09-19 2015-01-07 福州瑞芯微电子有限公司 Key detecting device and method
CN105486940A (en) * 2014-09-17 2016-04-13 深圳Tcl数字技术有限公司 Key detection circuit and key detection method of electronic equipment
CN106470038A (en) * 2015-08-17 2017-03-01 光宝电子(广州)有限公司 Keyboard scanning circuit, keyboard and its scan method
CN106569431A (en) * 2015-10-13 2017-04-19 奉化市威克电子厂 Single chip microcomputer I/O interface multiplexing circuit
CN108845688A (en) * 2018-05-24 2018-11-20 四川斐讯信息技术有限公司 A kind of button operation judgment method and system
CN108983666A (en) * 2018-07-27 2018-12-11 青岛海信日立空调***有限公司 control circuit and control method
CN110509867A (en) * 2019-08-19 2019-11-29 华勤通讯技术有限公司 A kind of vehicle-mounted key system
CN111769838A (en) * 2019-04-01 2020-10-13 上海葡萄纬度科技有限公司 Circuit for detecting multiple signals by using single IO port and electronic product

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102868392A (en) * 2011-07-06 2013-01-09 广东万和新电气股份有限公司 Portability key circuit
CN102868392B (en) * 2011-07-06 2014-11-26 广东万和新电气股份有限公司 Portability key circuit
CN102386930A (en) * 2011-09-23 2012-03-21 北京易投嘉德投资咨询有限公司 Collecting circuit for recognizing key state
CN102594362A (en) * 2011-12-06 2012-07-18 广东九联科技股份有限公司 Key circuit based on analog-digital conversion
CN102565694A (en) * 2011-12-31 2012-07-11 广东盈科电子有限公司 Non-AD-port key detection circuit and detection method thereof
CN102565694B (en) * 2011-12-31 2014-06-18 广东盈科电子有限公司 Non-AD-port key detection circuit and detection method thereof
CN102654540A (en) * 2012-04-26 2012-09-05 蚌埠依爱消防电子有限责任公司 Button detecting device for fire alarm systems
CN103135054A (en) * 2013-01-31 2013-06-05 建荣集成电路科技(珠海)有限公司 Press key detection circuit integrating light-emitting diode (LED) driving and infrared remote control receiving function and integration achieving method
CN105486940A (en) * 2014-09-17 2016-04-13 深圳Tcl数字技术有限公司 Key detection circuit and key detection method of electronic equipment
CN105486940B (en) * 2014-09-17 2018-07-13 深圳Tcl数字技术有限公司 Key detection circuit and key detection method of electronic equipment
CN104270160B (en) * 2014-09-19 2018-01-09 福州瑞芯微电子股份有限公司 A kind of button detection device and method
CN104270160A (en) * 2014-09-19 2015-01-07 福州瑞芯微电子有限公司 Key detecting device and method
CN106470038A (en) * 2015-08-17 2017-03-01 光宝电子(广州)有限公司 Keyboard scanning circuit, keyboard and its scan method
CN106569431A (en) * 2015-10-13 2017-04-19 奉化市威克电子厂 Single chip microcomputer I/O interface multiplexing circuit
CN108845688A (en) * 2018-05-24 2018-11-20 四川斐讯信息技术有限公司 A kind of button operation judgment method and system
CN108845688B (en) * 2018-05-24 2021-05-04 杭州吉吉知识产权运营有限公司 Key operation judgment method and system
CN108983666A (en) * 2018-07-27 2018-12-11 青岛海信日立空调***有限公司 control circuit and control method
CN108983666B (en) * 2018-07-27 2019-11-08 青岛海信日立空调***有限公司 Control circuit and control method
CN111769838A (en) * 2019-04-01 2020-10-13 上海葡萄纬度科技有限公司 Circuit for detecting multiple signals by using single IO port and electronic product
CN110509867A (en) * 2019-08-19 2019-11-29 华勤通讯技术有限公司 A kind of vehicle-mounted key system

Similar Documents

Publication Publication Date Title
CN101795139A (en) Method and circuit for detecting press key
CN201859203U (en) Key detection circuit of a singlechip or microprocessor with an analog-digital converter
CN100592637C (en) Keyboard scanning circuit and method
CN101394185A (en) Press-key detection circuit and method thereof
CN201662609U (en) Key detection circuit
CN101860369A (en) Matrix keyboard and scanning method thereof
CN103701472A (en) Digital keying circuit and keying equipment
CN101943742B (en) Keypad test and display driver integrated circuit and control method thereof
CN100593285C (en) Keyboard scanning system and method
CN102789319A (en) Keyboard, key detection device and electronic equipment
CN202364197U (en) Button detection and LED control circuit
CN202661818U (en) Novel button detection circuit
CN102857231B (en) A kind of key press detecting circuit
CN202602621U (en) Tower type keyboard scanning circuit structure
CN102624957A (en) Detection system for earphone drive-by-wire button of mobile phone
CN105511639B (en) Input control method, device and the terminal device of input method
CN202472565U (en) Keyboard circuit, keyboard and input device
CN105024680A (en) Data sending and button detection multiplexing circuit and processing method of program thereof
CN102565694B (en) Non-AD-port key detection circuit and detection method thereof
CN202261244U (en) Combined key scanning panel and home appliance
CN110995276B (en) Three-wire key scanning method for T-shaped scanning key expansion
CN102857232B (en) A kind of key press detecting circuit and detection method
CN201655000U (en) Intelligent remote control with digital compass
CN202798679U (en) Key detection circuit
CN206292323U (en) Many key detection devices

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: 20100804