CN107894725A - A kind of method of key switch multiplexing - Google Patents

A kind of method of key switch multiplexing Download PDF

Info

Publication number
CN107894725A
CN107894725A CN201711115272.6A CN201711115272A CN107894725A CN 107894725 A CN107894725 A CN 107894725A CN 201711115272 A CN201711115272 A CN 201711115272A CN 107894725 A CN107894725 A CN 107894725A
Authority
CN
China
Prior art keywords
button
switch
main control
control processor
interrupt
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
CN201711115272.6A
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.)
Guangdong Yada Electric Co Ltd
Original Assignee
Guangdong Yada Electric 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 Guangdong Yada Electric Co Ltd filed Critical Guangdong Yada Electric Co Ltd
Priority to CN201711115272.6A priority Critical patent/CN107894725A/en
Publication of CN107894725A publication Critical patent/CN107894725A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/042Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
    • G05B19/0423Input/output
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/20Pc systems
    • G05B2219/21Pc I-O input output
    • G05B2219/21113Bus interface has multiplexer, control register, data shift register

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Selective Calling Equipment (AREA)

Abstract

The invention discloses a kind of method of key switch multiplexing, the described method comprises the following steps:Step S1, it is that the button sets corresponding preset function using main control processor, and the switch time of every kind of preset function and button is corresponded;Step S2, start button scanning imaging system, and set counter to be monitored the switch time of button;Step S3, when detecting the switch motion of button, counter starts timing, and the switch motion time T of the switch motion of button is obtained, main control processor is according to switch motion time of acquisition and triggers interrupt control unit, and preset function corresponding to button is completed finally by driving relay.Using the present invention can efficiently solve the instrument such as multifunction electric meter because locus is small can not multiple buttons be set the problem of, in the practicality for effectively increasing equipment simultaneously, can also reduce the cost of equipment.

Description

A kind of method of key switch multiplexing
Technical field
The present invention relates to technical field of switch control, more particularly to a kind of method of key switch multiplexing.
Background technology
Key switch is primarily referred to as touch key switch, touch-switch is also, because it has contact resistance lotus small, accurate The advantage of operating physical force error, multi-size etc., is widely used in electronic equipment and white domestic appliances etc..It is logical Crossing the various orders of key switch input, character etc. can control effectively to equipment, such as the switching on and shutting down in electronic equipment, and one There can be multiple key switches in kind equipment, but for the equipment of small volume, because locus deficiency is typically on its panel One key switch can only be set, such as single-phase, three-phase multifunctional electrical energy meter.Now to realize all of device-dependent key switch Function, just key switch is needed to be multiplexed, i.e., a key switch realizes multiple functions.
The content of the invention
For overcome the deficiencies in the prior art and the problem of exist, the present invention provides a kind of method of key switch multiplexing, will This method is applied on the instrument and meters such as multifunctional electric energy meter, may be such that a button turns into multifunction push key.
The present invention is achieved by the following technical solutions:A kind of method of key switch multiplexing, methods described include with Lower step:
Step S1, it is that the button sets corresponding preset function using main control processor, and by every kind of preset function and button Switch time corresponded;
Step S2, start button scanning imaging system, and set counter to be monitored the switch time of button;
Step S3, when detecting the switch motion of button, counter starts timing, and obtains the switch of the switch motion of button Actuation time T, main control processor is according to switch motion time of acquisition and triggers interrupt control unit, finally by driving after Electrical equipment completes preset function corresponding to button.
Preferably, in the step S3, when detecting key switch action, main control processor produces hardware interrupts and held Row interrupt service routine, the interrupt register state flag bit of button is will be mapped to after interrupt routine operation, and in memory A state variable is set to indicate the state of respective keys.
Preferably, it is that the concrete function that the button is set includes using main control processor in the step S1:Short-press is pressed Key is function of operating a switch, and the long-press button T1 seconds are closure function, has button to press in the T2 seconds after relay disconnects and learns work(to be local Can, flicking button is local removing function when relay closes a floodgate;Wherein, T1 is less than T2;The short-press refers to the time less than T1's Button operation.
Preferably, the step S3 has been specifically included:
Step S31, when detect key switch be switched to from relay "on" position operate a switch state when, by main control processor The interrupt signal that interrupt control unit obtains, is encoded to interrupt identification corresponding to button, and be passed to master control by interrupt pin Processor;
Step S32, searched by main control processor and interrupt service list, started and interrupt respective interrupt service journey in service list Sequence;
Step S33, main control processor sets white list to contrast program, and whether the loading of detection institute is matched in white list Load;
If step S34, white list mismatches, interrupt processing processing routine operation rear-guard motor type relay, and be by its Status Flag Operate a switch;If white list matches, processor will start Uulearning function, reject white list load, and drive relay by its state It is masked as operating a switch;
Step S35, when detecting that button is switched to "on" position from the relay state of operating a switch, interrupt control unit, transmission are triggered Interrupt signal;
Step S36, main control processor read switch actuation time T, it is complete according to the switch motion time T length, driving relay Into preset function corresponding to button:
As T < T1, main control processor will start local learning functionality, will accordingly load and be added in white list;
Between when reading during T1≤T≤T2, main control processor will first start local learning functionality, and respective load is added into white name Dan Hou, then drive relay by its Status Flag for close a floodgate;
As T > T2, main control processor closes a floodgate its Status Flag driving relay.
It is preferred that the T1 is 3 seconds, the T2 is 5 seconds;The main control processor is single-chip microcomputer.
The method that key switch provided by the invention is multiplexed is applied in the instrument such as multifunction electric meter, and button can be achieved Be multiplexed function, can efficiently solve the instrument such as multifunction electric meter because locus is small can not multiple buttons be set the problem of, In the practicality for effectively increasing equipment simultaneously, the cost of equipment can also be reduced.
Brief description of the drawings
Fig. 1 is the step schematic flow sheet of the method for the invention.
Fig. 2 is the schematic flow sheet that methods described of the embodiment of the present invention is applied to the instrument such as multifunction electric meter.
Embodiment
For the ease of the understanding of those skilled in the art, the present invention is made below in conjunction with the drawings and specific embodiments further It is described in detail.
As shown in Figure 1, a kind of method of key switch multiplexing, the described method comprises the following steps:
Step S1, it is that the button sets corresponding preset function using main control processor, and by every kind of preset function and button Switch time corresponded;
Step S2, start button scanning imaging system, and set counter to be monitored the switch time of button;
Step S3, when detecting the switch motion of button, counter starts timing, and obtains the switch of the switch motion of button Actuation time T, main control processor is according to switch motion time of acquisition and triggers interrupt control unit, finally by driving after Electrical equipment completes preset function corresponding to button.
As preferred embodiment, in the step S3, when detecting key switch action, main control processor produces hard Part is interrupted and performs interrupt service routine, and the interrupt register state flag bit of button is will be mapped to after interrupt routine operation, and A state variable is set to indicate the state of respective keys in memory.
In the present embodiment, included in the step S1 using the concrete function that main control processor is button setting:It is short It is function of operating a switch by button, the long-press button T1 seconds are closure function, have button to press for local in the T2 seconds after relay disconnects Function is practised, flicking button is local removing function when relay closes a floodgate;Wherein, T1 is less than T2, and the short-press refers to that the time is less than T1 button operation.Wherein, the T1 is preferably 3 seconds, and the T2 is preferably 5 seconds, and the button operation less than 3 seconds can be considered short By operation, the short-press operation in the present embodiment is preferably less than the button operation of 1 second.In addition, the main control processor is preferably Single-chip microcomputer.It should be noted that the T1 and T2 value can be configured according to being actually needed, if T1 and T2 can be respectively 2 Second and 4 seconds etc..
In a wherein preferred embodiment, the step S3 has been specifically included:
Step S31, when detect key switch be switched to from relay "on" position operate a switch state when, by main control processor The interrupt signal that interrupt control unit obtains, is encoded to interrupt identification corresponding to button, and be passed to master control by interrupt pin Processor;
Step S32, searched by main control processor and interrupt service list, started and interrupt respective interrupt service journey in service list Sequence;
Step S33, main control processor sets white list to contrast program, and whether the loading of detection institute is matched in white list Load;
If step S34, white list mismatches, interrupt processing processing routine operation rear-guard motor type relay, and be by its Status Flag Operate a switch;If white list matches, processor will start Uulearning function, reject white list load, and drive relay by its state It is masked as operating a switch;
Step S35, when detecting that button is switched to "on" position from the relay state of operating a switch, interrupt control unit, transmission are triggered Interrupt signal;
Step S36, main control processor read switch actuation time T, it is complete according to the switch motion time T length, driving relay Into preset function corresponding to button:
As T < T1, main control processor will start local learning functionality, will accordingly load and be added in white list;
Between when reading during T1≤T≤T2, main control processor will first start local learning functionality, and respective load is added into white name Dan Hou, then drive relay by its Status Flag for close a floodgate;
As T > T2, main control processor closes a floodgate its Status Flag driving relay.
The method that key switch provided in an embodiment of the present invention is multiplexed is applied to the flow chart of the instrument such as multifunction electric meter As shown in Figure 2, using the present invention, the multiplexing function of button can be achieved, effectively solve the instrument such as multifunction electric meter because of space bit Put it is small and the problem of multiple buttons can not be set, in the practicality for effectively increasing equipment simultaneously, also reduce the cost of equipment.
Above-described embodiment is the preferable implementation of the present invention, is not limited to the present invention, is not departing from this hair It is any obviously to replace within protection scope of the present invention on the premise of bright inventive concept.

Claims (6)

1. a kind of method of key switch multiplexing, the described method comprises the following steps:
Step S1, it is that the button sets corresponding preset function using main control processor, and by every kind of preset function and button Switch time corresponded;
Step S2, start button scanning imaging system, and set counter to be monitored the switch time of button;
Step S3, when detecting the switch motion of button, counter starts timing, and obtains the switch of the switch motion of button Actuation time T, main control processor is according to switch motion time of acquisition and triggers interrupt control unit, finally by driving after Electrical equipment completes preset function corresponding to button.
2. according to the method for claim 1, it is characterised in that:In the step S3, when detecting key switch action, Main control processor produces hardware interrupts and performs interrupt service routine, and the interruption deposit of button is will be mapped to after interrupt routine operation Device state flag bit, and a state variable is set to indicate the state of respective keys in memory.
3. according to the method for claim 2, it is characterised in that using main control processor be the button in the step S1 The concrete function of setting includes:For short-press button to operate a switch function, the long-press button T1 seconds be closure function, the T2 seconds after relay disconnection Inside there is button to press for local learning functionality, flicking button is local removing function when relay closes a floodgate;Wherein, T1 is less than T2, The short-press refers to that the time is less than T1 button operation.
4. according to the method for claim 3, it is characterised in that the step S3 has been specifically included:
Step S31, when detect key switch be switched to from relay "on" position operate a switch state when, by main control processor The interrupt signal that interrupt control unit obtains, is encoded to interrupt identification corresponding to button, and be passed to master control by interrupt pin Processor;
Step S32, searched by main control processor and interrupt service list, started and interrupt respective interrupt service journey in service list Sequence;
Step S33, main control processor sets white list to contrast program, and whether the loading of detection institute is matched in white list Load;
If step S34, white list mismatches, interrupt processing processing routine operation rear-guard motor type relay, and be by its Status Flag Operate a switch;If white list matches, processor will start Uulearning function, reject white list load, and drive relay by its state It is masked as operating a switch;
Step S35, when detecting that button is switched to "on" position from the relay state of operating a switch, interrupt control unit, transmission are triggered Interrupt signal;
Step S36, main control processor read switch actuation time T, it is complete according to the switch motion time T length, driving relay Into preset function corresponding to button:
As T < T1, main control processor will start local learning functionality, will accordingly load and be added in white list;
Between when reading during T1≤T≤T2, main control processor will first start local learning functionality, and respective load is added into white name Dan Hou, then drive relay by its Status Flag for close a floodgate;
As T > T2, main control processor closes a floodgate its Status Flag driving relay.
5. according to the method for claim 4, it is characterised in that:The T1 is 3 seconds, and the T2 is 5 seconds.
6. the method according to any one in Claims 1 to 5, it is characterised in that:The main control processor is single-chip microcomputer.
CN201711115272.6A 2017-11-13 2017-11-13 A kind of method of key switch multiplexing Pending CN107894725A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711115272.6A CN107894725A (en) 2017-11-13 2017-11-13 A kind of method of key switch multiplexing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711115272.6A CN107894725A (en) 2017-11-13 2017-11-13 A kind of method of key switch multiplexing

Publications (1)

Publication Number Publication Date
CN107894725A true CN107894725A (en) 2018-04-10

Family

ID=61805011

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711115272.6A Pending CN107894725A (en) 2017-11-13 2017-11-13 A kind of method of key switch multiplexing

Country Status (1)

Country Link
CN (1) CN107894725A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109613312A (en) * 2018-12-18 2019-04-12 宁波三星智能电气有限公司 A kind of ammeter exchange method based on menu

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060058995A1 (en) * 2004-08-31 2006-03-16 Vadim Fux Handheld electronic device with text disambiguation
CN1779728A (en) * 2004-11-23 2006-05-31 厦门华侨电子企业有限公司 Studying remote control method and device for household electrical appliances
CN1900886A (en) * 2006-06-16 2007-01-24 李一新 Method for single click and multiple key combining click mixing input Chinese and English and keyboard
CN101727196A (en) * 2008-10-20 2010-06-09 普天信息技术研究院有限公司 Character input method with self-learning function
CN101776965A (en) * 2009-01-12 2010-07-14 宏达国际电子股份有限公司 Method and system for dynamically studying input characteristics of software keyboard
CN103279203A (en) * 2013-03-28 2013-09-04 深圳市共进电子股份有限公司 Key reuse method and multifunctional key
CN104915203A (en) * 2015-06-08 2015-09-16 苏州西顿家用自动化有限公司 Automatic cooking program generating method of intelligent stove

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060058995A1 (en) * 2004-08-31 2006-03-16 Vadim Fux Handheld electronic device with text disambiguation
CN1779728A (en) * 2004-11-23 2006-05-31 厦门华侨电子企业有限公司 Studying remote control method and device for household electrical appliances
CN1900886A (en) * 2006-06-16 2007-01-24 李一新 Method for single click and multiple key combining click mixing input Chinese and English and keyboard
CN101727196A (en) * 2008-10-20 2010-06-09 普天信息技术研究院有限公司 Character input method with self-learning function
CN101776965A (en) * 2009-01-12 2010-07-14 宏达国际电子股份有限公司 Method and system for dynamically studying input characteristics of software keyboard
CN103279203A (en) * 2013-03-28 2013-09-04 深圳市共进电子股份有限公司 Key reuse method and multifunctional key
CN104915203A (en) * 2015-06-08 2015-09-16 苏州西顿家用自动化有限公司 Automatic cooking program generating method of intelligent stove

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109613312A (en) * 2018-12-18 2019-04-12 宁波三星智能电气有限公司 A kind of ammeter exchange method based on menu

Similar Documents

Publication Publication Date Title
CN204270305U (en) There is the electronic installation of fingerprint sensing function
CN105068745B (en) Pass through pressure touch and the mobile phone display screen curtain operating method and system of rotation detection
CN103593597A (en) Method for controlling flashlight of smart mobile terminal
CN103365669B (en) The method and electric terminal of a kind of control application function
CN104598134A (en) Fingerprint operating method and system for mobile terminal
CN103376435B (en) Coil measurement device and Coil Detector method thereof
CN105335686A (en) Electronic apparatus possessing fingerprint sensing function and calling method of application program
CN101859198A (en) Remote controller with griping recognition function and method thereof
CN101795139A (en) Method and circuit for detecting press key
CN105528170A (en) Starting method and apparatus of applications
CN104360814A (en) Electronic equipment and unlocking method thereof
CN105892927A (en) Mobile terminal control method and device
CN105279477A (en) Electronic device having fingerprint sensing function and call method of application program thereof
WO2014207553A2 (en) Method and device for performing a lock operation on a screen of a touch screen device
CN105893130A (en) Mobile terminal application program processing method and mobile terminal
CN107894725A (en) A kind of method of key switch multiplexing
CN110231911A (en) False-touch prevention method, apparatus and household appliance
CN105426040A (en) Method and system for rapidly displaying interface contents of mobile terminals
CN105511639B (en) Input control method, device and the terminal device of input method
CN106896747A (en) Household electric appliance control method, device and mobile terminal
CN105015611A (en) Steering wheel key adaption method and device
CN214473649U (en) Detection circuit and electronic equipment
CN109189274B (en) Detection device applied to touch technology and fingerprint identification system
CN103414456B (en) Detection circuit with proximity sensing
CN104414480A (en) Touch device and electric cooker

Legal Events

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

Application publication date: 20180410