CN204631788U - A kind of novel three end touch-switchs - Google Patents

A kind of novel three end touch-switchs Download PDF

Info

Publication number
CN204631788U
CN204631788U CN201520328110.0U CN201520328110U CN204631788U CN 204631788 U CN204631788 U CN 204631788U CN 201520328110 U CN201520328110 U CN 201520328110U CN 204631788 U CN204631788 U CN 204631788U
Authority
CN
China
Prior art keywords
line
alignment
row
touch
switchs
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.)
Withdrawn - After Issue
Application number
CN201520328110.0U
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.)
Sichuan University
Original Assignee
Sichuan University
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 Sichuan University filed Critical Sichuan University
Priority to CN201520328110.0U priority Critical patent/CN204631788U/en
Application granted granted Critical
Publication of CN204631788U publication Critical patent/CN204631788U/en
Withdrawn - After Issue legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

Novel three end touch-switchs substitute a traditional two ends formula, and the occasion that button is many often adopts matrix keyboard, the detection of complex of the matrix keyboard of traditional touch-switch composition and be inconvenient to use the mode of interruption to complete keyboard detection.The utility model designs a kind of novel three end touch-switchs and gives a kind of method of attachment and detection method of 4 × 4 matrix keyboards, the method of attachment of the matrix keyboard of m capable n row and detection method are also described in detail in detail in the claims, the detection of the matrix keyboard formed with this touch-switch becomes very simple, directly can draw by the level state of read line alignment line the button be pressed, and single-chip microcomputer only needs to be connected with matrix keyboard by an interrupt source and several common I/O ports just to complete matrix keyboard in the mode of interrupting and detect, because single-chip microcomputer is with the mode monitoring matrix keyboard interrupted, single-chip microcomputer can be operated in Low-power-consumptiodormancy dormancy pattern, just waken up when there being button to press, this is conducive to reducing system power dissipation.

Description

A kind of novel three end touch-switchs
Technical field
The present invention relates to a kind of circuit touch-switch, the detection of the matrix keyboard formed with this touch-switch becomes very simple, in addition, single-chip microcomputer only needs to be connected with matrix keyboard by an interrupt source and several common I/O ports just to complete matrix keyboard in the mode of interrupting and detect.
Background technology
Keyboard is the most modal input equipment of microcomputer system, and general keyboard is made up of multiple touch-switch.According to the arrangement mode of touch-switch, keyboard can be divided into linear keyboard and matrix keyboard.In the occasion that button is many, we often adopt matrix keyboard, and touch-switch is lined up the capable m row of n by matrix keyboard, and each button occupies an intersection point of ranks, needs the number of line to be exactly n+m like this, so just can detect n*m touch-switch.And traditional touch-switch is two ends formula, when we press switch, this two ends conducting, under state of nature, two ends are open circuit, not conducting.The key method of translating of the matrix keyboard that this two ends touch-switch is formed often has line scanning method and line reversal process, with line scanning method, line scanning method needs to set low the level on matrix keyboard line successively, the value of read port is with the coding of the button that obtains being pressed again, this detection method is comparatively loaded down with trivial details in program, simple not, need just can identify through several step the touch-switch be pressed.In addition, these methods need processor to detect key scan in the mode of inquiry, this just requires that processor constantly reads the level state of IO, the mode that this button detects is unfavorable often in real-time system, and just cause CPU to be operated in low-power consumption mode with the working method of inquiry detection button, the power consumption of whole system can be improved.If with the mode monitoring matrix keyboard interrupted, then need row (column) line to be connected to the I/O port with interrupt capabilities, and be little for the processor external interrupt resource of some low side, enough I/O ports with interrupt capabilities cannot be provided.The matrix keyboard be made up of traditional two ends touch-switch has this two large shortcoming: detect working method that is simple not and that cannot work to interrupt and complete detection.And this two large shortcoming is determined by the characteristic of traditional two ends touch-switch, overcome these shortcomings to solve, the utility model proposes a kind of new thinking from the structure of touch-switch.
Summary of the invention
In order to the detection of simplification matrix keyboard, and single-chip microcomputer is made only to need to be connected with matrix keyboard by an interrupt source and several common I/O ports just to complete matrix keyboard in the mode of interrupting and detect.
The technical solution used in the present invention is: a kind of novel three end touch-switchs, and it is characterized in that: be made up of three contact jaws, under state of nature, these three ends are opened a way between two, when pressing switch, hold short circuit between two for these three; Three ends of three end touch-switchs are identical, for ease of statement, three of three end touch-switchs ends are numbered 0,1,2 respectively, for m*n touch-switch, be arranged in the capable n row of m, 1 end of every a line n three end touch-switchs is connected by line, each row is designated as ROW_1 ~ ROW_m respectively, 0 end of m three end touch-switchs of each row is connected by alignment, each row are designated as LINE_1 ~ LINE_n respectively, 2 ends of all m*n touch-switch connect together and are designated as COM end, and all three end touch-switchs constitute the matrix keyboard of the capable n row of m.
Inquiry working method: line ROW_1 ~ ROW_m is connected with single-chip I/O mouth respectively, and alignment LINE_1 ~ LINE_n is connected with single-chip I/O mouth respectively, and COM holds ground connection; The value of the I/O port that single-chip microcomputer is connected by reading matrix keyboard obtains the level state on line and alignment, each button is pressed a level state on corresponding unique line and alignment, so the level state that just can be read on line and alignment by single-chip microcomputer identifies the button be pressed, which achieves single-chip microcomputer and detect whole matrix keyboard with the working method of inquiry.
Interrupt working manner 1: line ROW_1 ~ ROW_m is connected with single-chip I/O mouth respectively, alignment LINE_1 ~ LINE_n is connected with single-chip I/O mouth respectively, COM end is received the external interrupt pin of single-chip microcomputer, next whole matrix keyboard is detected in the mode of interrupting, external interrupt is set to negative edge trigger, the I/O port be connected with line alignment is set to recommend output mode and whole output low level, like this, as long as there is any one button to be pressed, COM holds level just to be dragged down, down trigger, enter interrupt service routine, in interrupt service routine, first interrupt pin is set to output mode and output low level, again the I/O port be connected with line alignment is set to pull-up input pattern, the value of single-chip microcomputer read line alignment line again, just the button be pressed can be identified by the level state of read line alignment line, wait button discharges, again external interrupt is set to negative edge after identification completes trigger, the I/O port be connected with line alignment is set to recommend output mode and whole output low level, the arriving that single-chip microcomputer continuation etc. are to be interrupted, which achieves single-chip microcomputer and detect whole matrix keyboard with the working method of interrupting.
Interrupt working manner 2: line ROW_1 ~ ROW_m is connected with single-chip I/O mouth respectively, alignment LINE_1 ~ LINE_n is connected with single-chip I/O mouth respectively, every root line is connected a resistance all respectively with every root alignment, and the other end of all resistance is connected to high level; All lines or all alignments or all lines and alignment are connected to the input end of an AND circuit, and the output terminal of AND circuit is connected to the external interrupt pin of single-chip microcomputer, external interrupt is set to negative edge and triggers; COM end is received low level; Any one button is pressed, and wherein the level of a line and an alignment is dragged down, and AND circuit output terminal exports a low level, down trigger, enter interrupt service routine, in interrupt service routine, utilize interrupt service routine to read the position of the key of input.
The invention has the beneficial effects as follows: the detection of the matrix keyboard that the touch-switch of this structure is formed becomes the same with linear keyboard simple, and single-chip microcomputer only needs to be connected with matrix keyboard by an interrupt source and several common I/O ports just to complete matrix keyboard in the mode of interrupting and detect.The real-time of whole Single Chip Microcomputer (SCM) system is not only increased with the mode monitoring matrix keyboard interrupted, improve efficiency, system is also allowed to work in the hibernation mode, when having button to press, just triggered interrupts wakes CPU up, also reduce the power consumption of system like this, economize energy, simultaneously can serviceable life of keyboard.
Accompanying drawing explanation
Schematic diagram 1 is the basic structure of three end touch-switchs, has 0,1,2 three ends, and each end draws pin;
Schematic diagram 2 gives a kind of method of attachment of the 4*4 matrix keyboard be made up of traditional two ends touch-switch;
Schematic diagram 3 gives a kind of 4*4 matrix keyboard be made up of novel three end touch-switchs with the method for attachment of inquiry mode work;
Schematic diagram 4 gives a kind of 4*4 matrix keyboard be made up of novel three end touch-switchs with the method for attachment of interrupt mode work.
Embodiment
Schematic diagram 2 gives a kind of method of attachment of the 4*4 matrix keyboard be made up of traditional two ends touch-switch and realizes the method for keyboard detection, according to schematic diagram 2, line ROW_1 ~ ROW_4 represents 0 ~ 3 of P1 port respectively with single-chip microcomputer P1^0 ~ P1^3(, some teaching materials or programming language are expressed as P1.0 ~ P1.3, the method for expressing at this place is also one of common tag, lower with, simultaneously, the port had in single-chip microcomputer is bidirectional interface, or be called accurate bidirectional interface, namely can output information, also information can be inputted, P1 herein has bidirectional interface function) be connected and P1^0 ~ P1^3 is set to recommend output mode, alignment LINE_1 ~ LINE_4 is connected with single-chip microcomputer P1^4 ~ P1^7 respectively and P1^4 ~ P1^7 is set to pull-up input pattern (time unsettled, pin is high level), adopt line scanning method monitoring matrix keyboard, successively P1^0 ~ P1^3 is set to low level separately, a low level is often set, all to read the state that P1^4 ~ P1^7 detects each alignment, judge which button is pressed (because the sweep velocity of single-chip microcomputer is far away faster than the input speed of people, the frequency of present single-chip microcomputer can reach 300MHz, assuming that scanning 100 cycles of needs, large about the microsecond order of magnitude, and the input speed of people was at the order of magnitude of 0.1 second, therefore, relative to the input speed of people, time needed for scanning can be ignored).Specific implementation: first by P1^0 output low level, its excess-three bar line (P1^1, P1^2, P1^3) is set to high level, now can detect the state of the first row button, if key1 is pressed, LINE_4 line level is dragged down, all the other alignments are high level, if key2 is pressed, LINE_3 line level is dragged down, and all the other alignments are high level, the rest may be inferred key3, key4, just can obtain the state of the first row button like this by the state of the level reading alignment.Then the button of the second row is detected, by P1^1 output low level, its excess-three bar line (P1^0, P1^2, P1^3) is set to high level, now can detect the state of the second row button, if key5 is pressed, LINE_4 line level is dragged down, and all the other alignments are high level, if key6 is pressed, LINE_3 line level is dragged down, all the other alignments are high level, the rest may be inferred key7, key8, just can be obtained the state of the second row button like this by the state of the level reading alignment.In like manner, then set low the level of P1^2 and P1^3 successively, all the other alignments are high level, just can detect the state of the third line and fourth line button respectively.So just detected whole matrix keyboard by line scanning method.Be made up of traditional two ends touch-switch owing to itself having, the large absolutely how many inquiry mode (single-chip microcomputer needs constantly to read the level of line and alignment) that passes through of this 4*4 matrix keyboard detects, and can find out that testing process is also comparatively complicated loaded down with trivial details.
Next give the method for attachment of the 4*4 matrix keyboard that a kind of three end touch-switchs described by the utility model are formed again and realize the method for keyboard detection.
First provide the method realizing keyboard detection with inquiry mode: according to schematic diagram 3, line ROW_1 ~ ROW_4 is connected with single-chip microcomputer P1^0 ~ P1^3 respectively, and alignment LINE_1 ~ LINE_4 is connected with single-chip microcomputer P1^4 ~ P1^7 respectively, COM termination power ground (low level).P1^0 ~ P1^7 is set to pull-up input pattern.Single-chip microcomputer only constantly need read the value of the whole port of P1^0 ~ P1^7 and P1, just can obtain the state of whole matrix keyboard.When button S1 is pressed, the line be connected with S1 and alignment all hold conducting with COM, be pulled to low level and P1^0 and P1^7 level is all 0, the value now reading P1 port is that 0x7e(0x indicates 16 systems, sexadecimal 0x7e represents binary zero 1111110), P1^0 ~ P1^7 is corresponding in turn to the low level of a byte to high-order, if S16 is pressed, the line be connected with S16 and alignment all hold conducting with COM, be pulled to low level and P1^3 and P1^4 level is all 0, the value now reading P1 port is 0xe7(binary one 1100111), when in like manner button S1 ~ S16 is pressed, the value of the P1 port be corresponding in turn to is { 0x7e, 0xbe, 0xde, 0xee, 0x7d, 0xbd, 0xdd, 0xed, 0x7b, 0xbb, 0xdb, 0xeb, 0x77, 0xb7, 0xd7, 0xe7}, the coding so only needing the value constantly reading P1 port just can obtain pushing button and then obtain is pressed the numbering of button.The detection of the matrix keyboard formed compared to the tradition two sections of touch-switchs described above needs to set low successively the button that value that line reads P1^4 ~ P1^7 again carrys out the every a line of Scanning Detction, the detection of this 4*4 matrix keyboard be made up of three end touch-switchs simplifies greatly, and the value directly by reading P1 port just can detect whole matrix keyboard.
Except simplifying the detection of matrix keyboard, this matrix keyboard be made up of three end touch-switchs can also complete it with the working method of interrupting easily and detect.Next the method realizing keyboard detection with interrupt mode is provided: according to schematic diagram 4, line ROW_1 ~ ROW_4 is connected with single-chip microcomputer P1^0 ~ P1^3 respectively, alignment LINE_1 ~ LINE_4 is connected with single-chip microcomputer P1^4 ~ P1^7 respectively, COM end is received the external interrupt pin of single-chip microcomputer, external interrupt is set to negative edge trigger, P1 mouth is set to recommend output mode and whole output low level, like this, as long as there is any one button to be pressed, COM holds level just to be dragged down, down trigger, enter interrupt service routine, in interrupt service routine, first interrupt pin is set to output mode and output low level, P1 mouth is set to pull-up input pattern, single-chip microcomputer reads the value of P1 port again, to be pressed the numbering of button by the value reading P1 port just can obtain the being pressed coding and then obtain of button, when button S1 ~ S16 is pressed, the value of the P1 port be corresponding in turn to is { 0x7e, 0xbe, 0xde, 0xee, 0x7d, 0xbd, 0xdd, 0xed, 0x7b, 0xbb,
0xdb, 0xeb, 0x77,0xb7,0xd7,0xe7}, after the numbering of the button that obtains being pressed, again P1 mouth is set to output mode and output low level, external interrupt is set to input pattern, exits interruption, like this, single-chip microcomputer can be operated in Low-power-consumptiodormancy dormancy pattern, is just waken up when there being button to press.

Claims (4)

1. novel three end touch-switchs, is characterized in that: be made up of three contact jaws, and under state of nature, these three ends are opened a way between two, when pressing switch, hold short circuit between two for these three; Three ends of three end touch-switchs are identical, for ease of statement, three of three end touch-switchs ends are numbered 0,1,2 respectively, for m*n touch-switch, be arranged in the capable n row of m, 1 end of every a line n three end touch-switchs is connected by line, each row is designated as ROW_1 ~ ROW_m respectively, 0 end of m three end touch-switchs of each row is connected by alignment, each row are designated as LINE_1 ~ LINE_n respectively, 2 ends of all m*n touch-switch connect together and are designated as COM end, and all three end touch-switchs constitute the matrix keyboard of the capable n row of m.
2. the novel three end touch-switchs of one according to claim 1, it is characterized in that: line ROW_1 ~ ROW_m is connected with single-chip I/O mouth respectively, alignment LINE_1 ~ LINE_n is connected with single-chip I/O mouth respectively, and COM holds ground connection; The value of the I/O port that single-chip microcomputer is connected by reading matrix keyboard obtains the level state on line and alignment, each button is pressed a level state on corresponding unique line and alignment, so the level state that just can be read on line and alignment by single-chip microcomputer identifies the button be pressed, which achieves single-chip microcomputer and detect whole matrix keyboard with the working method of inquiry.
3. the novel three end touch-switchs of one according to claim 2, it is characterized in that: line ROW_1 ~ ROW_m is connected with single-chip I/O mouth respectively, alignment LINE_1 ~ LINE_n is connected with single-chip I/O mouth respectively, COM end is received the external interrupt pin of single-chip microcomputer, next whole matrix keyboard is detected in the mode of interrupting, external interrupt is set to negative edge trigger, the I/O port be connected with line alignment is set to recommend output mode and whole output low level, like this, as long as there is any one button to be pressed, COM holds level just to be dragged down, down trigger, enter interrupt service routine, in interrupt service routine, first interrupt pin is set to output mode and output low level, again the I/O port be connected with line alignment is set to pull-up input pattern, the value of single-chip microcomputer read line alignment line again, just the button be pressed can be identified by the level state of read line alignment line, wait button discharges, again external interrupt is set to negative edge after identification completes trigger, the I/O port be connected with line alignment is set to recommend output mode and whole output low level, the arriving that single-chip microcomputer continuation etc. are to be interrupted, which achieves single-chip microcomputer and detect whole matrix keyboard with the working method of interrupting.
4. the novel three end touch-switchs of one according to claim 2, it is characterized in that: line ROW_1 ~ ROW_m is connected with single-chip I/O mouth respectively, alignment LINE_1 ~ LINE_n is connected with single-chip I/O mouth respectively, every root line is connected a resistance all respectively with every root alignment, and the other end of all resistance is connected to high level; All lines or all alignments or all lines and alignment are connected to the input end of an AND circuit, and the output terminal of AND circuit is connected to the external interrupt pin of single-chip microcomputer, external interrupt is set to negative edge and triggers; COM end is received low level; Any one button is pressed, and wherein the level of a line and an alignment is dragged down, and AND circuit output terminal exports a low level, down trigger, enter interrupt service routine, in interrupt service routine, utilize interrupt service routine to read the position of the key of input.
CN201520328110.0U 2015-05-21 2015-05-21 A kind of novel three end touch-switchs Withdrawn - After Issue CN204631788U (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201520328110.0U CN204631788U (en) 2015-05-21 2015-05-21 A kind of novel three end touch-switchs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201520328110.0U CN204631788U (en) 2015-05-21 2015-05-21 A kind of novel three end touch-switchs

Publications (1)

Publication Number Publication Date
CN204631788U true CN204631788U (en) 2015-09-09

Family

ID=54050797

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201520328110.0U Withdrawn - After Issue CN204631788U (en) 2015-05-21 2015-05-21 A kind of novel three end touch-switchs

Country Status (1)

Country Link
CN (1) CN204631788U (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104898853A (en) * 2015-05-21 2015-09-09 四川大学 Novel three-terminal tact switch
CN114280981A (en) * 2021-11-30 2022-04-05 宁波普瑞均胜汽车电子有限公司 Method and device for identifying odor type of automobile fragrance block

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104898853A (en) * 2015-05-21 2015-09-09 四川大学 Novel three-terminal tact switch
CN104898853B (en) * 2015-05-21 2017-08-25 四川大学 A kind of three end touch-switch
CN114280981A (en) * 2021-11-30 2022-04-05 宁波普瑞均胜汽车电子有限公司 Method and device for identifying odor type of automobile fragrance block

Similar Documents

Publication Publication Date Title
CN104898853A (en) Novel three-terminal tact switch
CN205581551U (en) Wireless Intelligence control system suitable for strike control
CN103257716B (en) A kind of low-power consumption keyboard and Scan orientation method thereof
CN204631788U (en) A kind of novel three end touch-switchs
CN106095053B (en) False-touch prevention Rouser and method and intelligent terminal
CN104933527A (en) Intelligent goods shelf
CN107423239B (en) Low-power scm complete data frame method of reseptance under Halt mode
CN104461035A (en) MCU keyboard circuit capable of enabling multiple keys to be pressed simultaneously and implementation method thereof
CN211653433U (en) Humidity detection circuit based on single chip microcomputer
CN208424849U (en) A kind of LED drive device with self-checking function
CN207439486U (en) A kind of low-power consumption gas meter, flow meter metering device
CN207650989U (en) A kind of intelligence instrument data collection architecture
CN208076966U (en) A kind of data collecting system applied to Computer Network Project construction
CN205676984U (en) A kind of SCM Based Domestic intelligent water saving device
CN201662719U (en) Wheeled robot controller
CN204791712U (en) Experimental development board based on singlechip
CN105227188A (en) A kind of many key press detecting circuits
CN216217641U (en) Intelligent lighting device for elevator
CN203632650U (en) Matrix key scanning circuit
CN205018854U (en) Two -dimensional code soybean milk machine based on raspberry group
CN203399079U (en) Four-in-one groove type photoelectric switch
CN209978945U (en) Remote measuring terminal for geological disasters
CN204795732U (en) But piece appearance is seen in automatic switch's projection
CN203595787U (en) Handheld device applied to communication type intelligent load-limiting breaker
Yang et al. Intelligence monitoring system based on arm and information fusion

Legal Events

Date Code Title Description
C14 Grant of patent or utility model
GR01 Patent grant
AV01 Patent right actively abandoned

Granted publication date: 20150909

Effective date of abandoning: 20170825

AV01 Patent right actively abandoned