CN102866351A - Switch state detection circuit - Google Patents

Switch state detection circuit Download PDF

Info

Publication number
CN102866351A
CN102866351A CN2012103387591A CN201210338759A CN102866351A CN 102866351 A CN102866351 A CN 102866351A CN 2012103387591 A CN2012103387591 A CN 2012103387591A CN 201210338759 A CN201210338759 A CN 201210338759A CN 102866351 A CN102866351 A CN 102866351A
Authority
CN
China
Prior art keywords
switch
module
analog
digital
judge
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.)
Granted
Application number
CN2012103387591A
Other languages
Chinese (zh)
Other versions
CN102866351B (en
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.)
SHIYAN KERNEL TRONIX CO Ltd
Original Assignee
SHIYAN KERNEL TRONIX 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 SHIYAN KERNEL TRONIX CO Ltd filed Critical SHIYAN KERNEL TRONIX CO Ltd
Priority to CN201210338759.1A priority Critical patent/CN102866351B/en
Publication of CN102866351A publication Critical patent/CN102866351A/en
Application granted granted Critical
Publication of CN102866351B publication Critical patent/CN102866351B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention relates to a switch state detection circuit, which belongs to a state detection circuit, and solves the problems that the existing single chip microprocessor cannot utilize the input/output (I/O) port to simultaneously detect three states of a low-speed switch for power connection, grounding and suspension and the resource is limited when an analog/digital (A/D) port of a central processing unit (CPU) is used for detecting the low-speed switch. In the switch state detection circuit, a clock generating module generates a periodic triggering signal to be respectively transmitted to a square wave generating module and a judging module; and the square wave generating module generates periodically overturned high level and low level to be transmitted to a level conversion circuit, an electric signal after the level conversion of the level conversion circuit is transmitted to a drive circuit to be subjected to voltage and current amplification, the output end of the drive circuit is connected with N analog-digital conversion modules through N first limiting resistances and N second limiting resistances, which are sequentially connected with one another in serial, and the N analog-digital conversion module outputs digital quantity to be transmitted to the judging module to be judged. The switch state detection circuit only utilizes the I/O port of the CPU and is free from utilizing the A/D port, so that the high state, low state and suspension state of the switch can be detected, and the switch state detection circuit is applicable to the low-speed switch with the switch frequency of 100Hz and less.

Description

A kind of switch condition detection circuit
Technical field
The invention belongs to state detection circuit, particularly a kind of switch condition detection circuit is for detection of the on off state of low speed switch.
Background technology
At present, use single-chip microcomputer that the on off state of low speed switch is detected, common have following four kinds: (1) as shown in Figure 1, use the I/O mouth P0 of CPU, low speed switch to ground connection detects, and can only detect ground connection and the unsettled two states of switch, can not detect and connect power supply status.(2) as shown in Figure 2, use the I/O mouth of CPU, the low speed switch of docking power supply VCC detects, and what can only detect low speed switch connects power supply and unsettled two states, can not detect ground state.(3) as shown in Figure 3, use the I/O mouth of CPU, the moving contact of low speed switch switches between power supply VCC and ground connection, and what can detect low speed switch connects power supply and ground connection two states, but can not detect vacant state.(4) as shown in Figure 4, use the analog to digital conversion mouth AD0 of CPU, the moving contact of low speed switch switches between power supply VCC and ground connection, and what can detect low speed switch connects power supply, ground connection and unsettled three kinds of states, but the A/D mouth resource-constrained of CPU.Described low speed switch refers to that switching frequency is 100Hz and following switch.
Summary of the invention
The invention provides a kind of switch condition detection circuit, when solving existing single-chip microcomputer and using the I/O mouth can not detect simultaneously low speed switch to connect the problem of power supply, ground connection and unsettled three kinds of states and use the A/D mouth of CPU to detect low speed switch, the problem of resource-constrained.
A kind of switch condition detection circuit of the present invention comprises clock generation module, square wave generation module, level shifting circuit, driving circuit, analog-to-digital conversion module and judge module, it is characterized in that:
Described clock generation module produces the periodic triggers signal, delivers to respectively square wave generation module and judge module;
Described square wave generation module is triggered by the periodic triggers signal, produce the high and low level of punctuated turning over, deliver to level shifting circuit, level shifting circuit carries out the electric signal after the level conversion, deliver to driving circuit and carry out the voltage and current amplification, N successively first, second current-limiting resistance of series connection given in driving circuit output simultaneously, and N first, second current-limiting resistance tie point is connected by the slowdown monitoring switch output point with N respectively; N the second current-limiting resistance other end connects respectively N analog-to-digital conversion module, and N analog-to-digital conversion module output digital quantity delivered to judge module; N=1~50;
Described judge module is judged the digital quantity of N analog-to-digital conversion module output respectively: judge whether that the Contemporary Digital amount is not equal to digital quantity last time, be then judge by slowdown monitoring switch unsettled, otherwise judge again whether the Contemporary Digital amount is 0, be then to judge by slowdown monitoring switch ground connection, otherwise judgement is connect power supply by slowdown monitoring switch; Contemporary Digital amount, last time, digital quantity and periodic triggers signal were synchronous.
Described switch condition detection circuit is characterized in that:
Described clock generation module adopts the crystal oscillating circuit among the CPU, and described square wave generation module, analog-to-digital conversion module and judge module all load among the CPU, and the square wave generation module is by the delivery outlet realization of CPU, and analog-to-digital conversion module is realized by the input port of CPU.
The present invention only uses delivery outlet and input port (the I/O mouth) of CPU, without the A/D mouth, can detect switch high/low/unsettled three kinds of states, when solving existing single-chip microcomputer and using the I/O mouth can not detect simultaneously low speed switch to connect the problem of power supply, ground connection and unsettled three kinds of states and use the A/D mouth of CPU to detect low speed switch, the problem of resource-constrained, being applicable to the detector switch frequency is 100Hz and following low speed switch.
Description of drawings
Fig. 1 (A) is existing the first testing circuit; Use the I/O mouth of CPU, the switch of ground connection detected,
Fig. 1 (B) judges schematic flow sheet for existing the first testing circuit;
Fig. 2 (A) is existing the second testing circuit; Use the I/O mouth of CPU, the switch of docking power supply detects,
Fig. 2 (B) judges schematic flow sheet for existing the second testing circuit;
Fig. 3 (A) is existing the third testing circuit; Use the I/O mouth of CPU, switch is for connecing power supply/grounding switch,
Fig. 3 (B) judges schematic flow sheet for existing the third testing circuit;
Fig. 4 (A) is existing the 4th kind of testing circuit; Use the A/D mouth of CPU, switch is for connecing power supply/grounding switch,
Fig. 4 (B) judges schematic flow sheet for existing the 4th kind of testing circuit;
Fig. 5 is principle of the invention schematic diagram;
Fig. 6 is that the embodiment of the invention forms schematic diagram;
Fig. 7 is the judge module schematic flow sheet.
Embodiment
The present invention is further described below in conjunction with drawings and Examples.
As shown in Figure 5, the present invention includes clock generation module, square wave generation module, level shifting circuit, driving circuit, analog-to-digital conversion module and judge module; Described clock generation module produces the periodic triggers signal, delivers to respectively square wave generation module and judge module;
Described square wave generation module is triggered by the periodic triggers signal, produce the high and low level of punctuated turning over, deliver to level shifting circuit, level shifting circuit carries out the electric signal after the level conversion, deliver to driving circuit and carry out the voltage and current amplification, 2 successively the first current-limiting resistance R1, the second current-limiting resistance R2 of series connection are given in driving circuit output simultaneously, and 2 first, second current-limiting resistance tie points are connected with the output point of the first tested switch S 1 and the second tested switch S 2 respectively; 2 second current-limiting resistance R2 other ends connect respectively 2 analog-to-digital conversion modules, and 2 analog-to-digital conversion module output digital quantities are delivered to judge module;
Described judge module is judged the digital quantity of 2 analog-to-digital conversion module outputs respectively: judge whether that the Contemporary Digital amount is not equal to digital quantity last time, be then judge by slowdown monitoring switch unsettled, otherwise judge again whether the Contemporary Digital amount is 0, be then to judge by slowdown monitoring switch ground connection, otherwise judgement is connect power supply by slowdown monitoring switch; Contemporary Digital amount, last time, digital quantity and periodic triggers signal were synchronous.
As shown in Figure 6, the embodiment of the invention comprises clock generation module, square wave generation module, level shifting circuit, analog-to-digital conversion module and judge module, and described clock generation module produces the periodic triggers signal, delivers to respectively square wave generation module and judge module;
Described square wave generation module is triggered by the periodic triggers signal, produce the high and low level of punctuated turning over, deliver to level shifting circuit, level shifting circuit carries out the electric signal after the level conversion, deliver to driving circuit and carry out the voltage and current amplification, 2 successively the first current-limiting resistance R1, the second current-limiting resistance R2 of series connection are given in driving circuit output simultaneously, and 2 first, second current-limiting resistance tie points are connected with the output point of the first tested switch S 1 and the second tested switch S 2 respectively; 2 second current-limiting resistance R2 other ends connect respectively 2 analog-to-digital conversion modules, and 2 analog-to-digital conversion module output digital quantities are delivered to judge module;
In the present embodiment, the crystal oscillating circuit of single-chip microcomputer consists of clock generation module, adopts the interior I/O mouth P0 of single-chip microcomputer as square wave generation module, is that dutycycle is 50% TTL square wave in the A point output cycle; Consist of level shifting circuit from the A point to the circuit the B point, consist of driving circuit from the B point to the circuit the C point, the I/O mouth P1 of single-chip microcomputer, I/O mouth P2 consist of 2 analog-to-digital conversion modules, and judge module is carried in the single-chip microcomputer.
According to circuit power, the voltage of ordering as A is during for high (corresponding TTL is for high) → and triode T1 conducting → B point voltage is that low → triode T2 cut-off/T3 conducting → C point voltage is low; When the voltage of ordering as A on the contrary, is low (corresponding TTL is low) → triode T1 cut-off → B point voltage is that height → triode T2 conducting/T3 cut-off → C point voltage is for high; Just produced square wave with A point equifrequent, equal duty ratio, antiphase at the C point like this.
As shown in Figure 7, judge module is judged the digital quantity of N analog-to-digital conversion module output respectively: judge whether that the Contemporary Digital amount is not equal to digital quantity last time, be then judge by slowdown monitoring switch unsettled, otherwise judge again whether the Contemporary Digital amount is 0, be then to judge by slowdown monitoring switch ground connection, otherwise judgement is connect power supply by slowdown monitoring switch; Contemporary Digital amount, last time, digital quantity and periodic triggers signal were synchronous.

Claims (2)

1. a switch condition detection circuit comprises clock generation module, square wave generation module, level shifting circuit, driving circuit, analog-to-digital conversion module and judge module, it is characterized in that:
Described clock generation module produces the periodic triggers signal, delivers to respectively square wave generation module and judge module;
Described square wave generation module is triggered by the periodic triggers signal, produce the high and low level of punctuated turning over, deliver to level shifting circuit, level shifting circuit carries out the electric signal after the level conversion, deliver to driving circuit and carry out the voltage and current amplification, N successively first, second current-limiting resistance of series connection given in driving circuit output simultaneously, and N first, second current-limiting resistance tie point is connected by the slowdown monitoring switch output point with N respectively; N the second current-limiting resistance other end connects respectively N analog-to-digital conversion module, and N analog-to-digital conversion module output digital quantity delivered to judge module; N=1~50;
Described judge module is judged the digital quantity of N analog-to-digital conversion module output respectively: judge whether that the Contemporary Digital amount is not equal to digital quantity last time, be then judge by slowdown monitoring switch unsettled, otherwise judge again whether the Contemporary Digital amount is 0, be then to judge by slowdown monitoring switch ground connection, otherwise judgement is connect power supply by slowdown monitoring switch; Contemporary Digital amount, last time, digital quantity and periodic triggers signal were synchronous.
2. switch condition detection circuit as claimed in claim 1 is characterized in that:
Described clock generation module adopts the crystal oscillating circuit among the CPU, and described square wave generation module, analog-to-digital conversion module and judge module all load among the CPU, and the square wave generation module is by the delivery outlet realization of CPU, and analog-to-digital conversion module is realized by the input port of CPU.
CN201210338759.1A 2012-09-13 2012-09-13 Switch state detection circuit Active CN102866351B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210338759.1A CN102866351B (en) 2012-09-13 2012-09-13 Switch state detection circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210338759.1A CN102866351B (en) 2012-09-13 2012-09-13 Switch state detection circuit

Publications (2)

Publication Number Publication Date
CN102866351A true CN102866351A (en) 2013-01-09
CN102866351B CN102866351B (en) 2014-07-09

Family

ID=47445339

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210338759.1A Active CN102866351B (en) 2012-09-13 2012-09-13 Switch state detection circuit

Country Status (1)

Country Link
CN (1) CN102866351B (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104502683A (en) * 2014-12-31 2015-04-08 武汉华中数控股份有限公司 Switch quantity signal detection method and detection circuit
CN104730454A (en) * 2015-03-28 2015-06-24 安徽阿瑞特汽车电子科技有限公司 Automatic detection circuit for digital switch circuit
CN104914376A (en) * 2015-05-08 2015-09-16 武汉合康动力技术有限公司 Digital circuit state detection circuit and digital circuit state detection method
CN104407252B (en) * 2014-12-02 2017-10-13 合肥工大高科信息科技股份有限公司 The safety detection circuit and its detection method of a kind of mining switching machine control button
CN107314886A (en) * 2017-08-15 2017-11-03 昆山金鸣光电科技有限公司 A kind of pulsed light fiber switch condition detection method
CN107526031A (en) * 2017-08-23 2017-12-29 中国电子科技集团公司第四十研究所 A kind of microwave machinery switch test system and method based on work schedule control
CN108541117A (en) * 2018-03-28 2018-09-14 杭州斯力德电器有限公司 A kind of control method of multi gear position desk lamp with dimmer switch
CN109932647A (en) * 2019-03-29 2019-06-25 四川虹美智能科技有限公司 A kind of toggle switch state detection circuit, method and device
CN110161888A (en) * 2018-02-12 2019-08-23 深圳市云海物联科技有限公司 A kind of D conversion method, system, device and single-chip microcontroller
CN110261767A (en) * 2019-07-05 2019-09-20 瑞纳智能设备股份有限公司 A kind of detection device and detection method in on-off switch service life
CN110888049A (en) * 2018-09-11 2020-03-17 法雷奥汽车内部控制(深圳)有限公司 Switch detection system, vehicle, and switch detection method
CN111983437A (en) * 2020-08-25 2020-11-24 深圳市旗开电子有限公司 5G module product GPIO port test circuit and test method
CN113054965A (en) * 2021-03-11 2021-06-29 重庆大学 Detection circuit for closed and suspended states of high-low level effective switch of vehicle

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1110446A (en) * 1994-04-09 1995-10-18 华邦电子股份有限公司 Device for testing switching state of telephone hook switch
CN1687799A (en) * 2005-04-06 2005-10-26 南京师范大学 Combined detector and combined detecting method for switch state of DC ground resistance
CN101408571A (en) * 2007-10-11 2009-04-15 瑞昱半导体股份有限公司 Inserted detection circuit
US20100052705A1 (en) * 2006-04-04 2010-03-04 Airbus France Device for detecting the state of a switch

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1110446A (en) * 1994-04-09 1995-10-18 华邦电子股份有限公司 Device for testing switching state of telephone hook switch
CN1687799A (en) * 2005-04-06 2005-10-26 南京师范大学 Combined detector and combined detecting method for switch state of DC ground resistance
US20100052705A1 (en) * 2006-04-04 2010-03-04 Airbus France Device for detecting the state of a switch
CN101408571A (en) * 2007-10-11 2009-04-15 瑞昱半导体股份有限公司 Inserted detection circuit

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104407252B (en) * 2014-12-02 2017-10-13 合肥工大高科信息科技股份有限公司 The safety detection circuit and its detection method of a kind of mining switching machine control button
CN104502683A (en) * 2014-12-31 2015-04-08 武汉华中数控股份有限公司 Switch quantity signal detection method and detection circuit
CN104730454A (en) * 2015-03-28 2015-06-24 安徽阿瑞特汽车电子科技有限公司 Automatic detection circuit for digital switch circuit
CN104914376A (en) * 2015-05-08 2015-09-16 武汉合康动力技术有限公司 Digital circuit state detection circuit and digital circuit state detection method
CN107314886B (en) * 2017-08-15 2019-07-09 昆山金鸣光电科技有限公司 A kind of pulsed light fiber switch condition detection method
CN107314886A (en) * 2017-08-15 2017-11-03 昆山金鸣光电科技有限公司 A kind of pulsed light fiber switch condition detection method
CN107526031A (en) * 2017-08-23 2017-12-29 中国电子科技集团公司第四十研究所 A kind of microwave machinery switch test system and method based on work schedule control
CN107526031B (en) * 2017-08-23 2019-07-30 中国电子科技集团公司第四十一研究所 A kind of microwave machinery switch test system and method based on working sequence control
CN110161888A (en) * 2018-02-12 2019-08-23 深圳市云海物联科技有限公司 A kind of D conversion method, system, device and single-chip microcontroller
CN108541117A (en) * 2018-03-28 2018-09-14 杭州斯力德电器有限公司 A kind of control method of multi gear position desk lamp with dimmer switch
CN110888049A (en) * 2018-09-11 2020-03-17 法雷奥汽车内部控制(深圳)有限公司 Switch detection system, vehicle, and switch detection method
CN109932647A (en) * 2019-03-29 2019-06-25 四川虹美智能科技有限公司 A kind of toggle switch state detection circuit, method and device
CN109932647B (en) * 2019-03-29 2021-12-28 四川虹美智能科技有限公司 Toggle switch state detection circuit, method and device
CN110261767A (en) * 2019-07-05 2019-09-20 瑞纳智能设备股份有限公司 A kind of detection device and detection method in on-off switch service life
CN111983437A (en) * 2020-08-25 2020-11-24 深圳市旗开电子有限公司 5G module product GPIO port test circuit and test method
CN111983437B (en) * 2020-08-25 2023-09-08 深圳市旗开电子有限公司 5G module product GPIO port test circuit and test method
CN113054965A (en) * 2021-03-11 2021-06-29 重庆大学 Detection circuit for closed and suspended states of high-low level effective switch of vehicle

Also Published As

Publication number Publication date
CN102866351B (en) 2014-07-09

Similar Documents

Publication Publication Date Title
CN102866351B (en) Switch state detection circuit
CN105790754B (en) Digital isolation circuit and control method thereof
CN101710251A (en) Single chip microcomputer halt reset circuit, device and method
CN111812476A (en) IGBT module electrical parameter online measurement device and method
CN203707029U (en) Relay action response and delay detection circuit, circuit board and electrothermal product comprising same
CN202661818U (en) Novel button detection circuit
CN102253334A (en) Circuit for detecting open and close states of relay for electric energy meter
CN104181380A (en) Light load current detection system
CN103488104B (en) Monitoring reset system
CN201594815U (en) Capacitance type touch key circuit
CN202309135U (en) Lithium battery charging prompter
CN204945993U (en) A kind of watchdog circuit being applicable to Safety output
CN102353408B (en) Output signal detection circuit and detection method of dish-washing machine flowmeter
CN202334324U (en) Variable-frequency system and active feedback device thereof
CN103777533B (en) A kind of signal behavior output circuit and control chip and control circuit
CN202049190U (en) Input voltage detecting circuit for power supply unit
CN201909970U (en) Driving and detecting shared circuit
CN202794312U (en) Alternating current power failure detecting circuit
CN104375093A (en) Storage battery performance tester and implementation method of storage battery performance tester
CN206057551U (en) It is a kind of to be used for electric energy meter requirement period measurement pulse output translator
CN205154714U (en) Report an emergency and ask for help or increased vigilance signal generator means
CN201212902Y (en) Wire inspection instrument
CN203909143U (en) Digital resistor and capacitor meter
CN202330617U (en) Testing device for preventing inversion of diodes
CN203299974U (en) Trample type alarm of utilizing diodes to inspect states of electrodes

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant