CN109450414A - The acquisition method of triggering key based on FPGA - Google Patents

The acquisition method of triggering key based on FPGA Download PDF

Info

Publication number
CN109450414A
CN109450414A CN201811189671.1A CN201811189671A CN109450414A CN 109450414 A CN109450414 A CN 109450414A CN 201811189671 A CN201811189671 A CN 201811189671A CN 109450414 A CN109450414 A CN 109450414A
Authority
CN
China
Prior art keywords
key
fpga
triggering
acquisition method
data variation
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
CN201811189671.1A
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.)
AVIC Huadong Photoelectric Co Ltd
Original Assignee
AVIC Huadong Photoelectric 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 AVIC Huadong Photoelectric Co Ltd filed Critical AVIC Huadong Photoelectric Co Ltd
Priority to CN201811189671.1A priority Critical patent/CN109450414A/en
Publication of CN109450414A publication Critical patent/CN109450414A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03KPULSE TECHNIQUE
    • H03K5/00Manipulating of pulses not covered by one of the other main groups of this subclass
    • H03K5/125Discriminating pulses
    • H03K5/1252Suppression or limitation of noise or interference
    • H03K5/1254Suppression or limitation of noise or interference specially adapted for pulses generated by closure of switches, i.e. anti-bouncing devices
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03KPULSE TECHNIQUE
    • H03K5/00Manipulating of pulses not covered by one of the other main groups of this subclass
    • H03K5/153Arrangements in which a pulse is delivered at the instant when a predetermined characteristic of an input signal is present or at a fixed time interval after this instant
    • H03K5/1534Transition or edge detectors

Landscapes

  • Physics & Mathematics (AREA)
  • Nonlinear Science (AREA)
  • Input From Keyboards Or The Like (AREA)

Abstract

The acquisition method for the triggering key that the invention discloses a kind of based on FPGA, it include: to be sampled to triggering key, and classified to button operation according to following modes according to the time by key pressing: when button operation bounces in the first preset time, it is determined as that short-press operates, then executes data variation;When button operation does not bounce in the first preset time, it is determined as long press operation, then each prefixed time interval executes a data variation, until the data variation is termination when limiting value or key bounce.The acquisition method of the triggering key based on FPGA, which overcomes FPGA in the prior art, does not have the problem of triggering collection method, realizes the acquisition of the triggering key of FPGA.

Description

The acquisition method of triggering key based on FPGA
Technical field
The present invention relates to the displays of Aeronautics and Astronautics, and in particular, to a kind of acquisition side of the triggering key based on FPGA Method.
Background technique
In the display field of Aeronautics and Astronautics, platform of the keystroke light conducting plate as human-computer interaction usually will use, and needle It to showing that most common function is brightness and contrast's adjusting, is realized by individually triggering key.For brightness Then there is short-press to realize that lasting change of rank is realized in the variation of 1 grade, long-pressing respectively with function required for contrast adjustment, And the situation that the adjusting grade that there is also brightness and contrast sometimes is inconsistent, i.e. the adjusting grade of brightness are 100 grades, and it is right Adjusting grade than degree is only 64 grades or 16 grades.Meanwhile key acquisition also needs have the functions such as stabilization processing, power down preservation. Since in the display field of Aeronautics and Astronautics, FPGA has its certain convenience and necessity, in order to cope with key acquisition side The applicability and reliability of method realize that the case where acquisition for triggering key is following using FPGA.
Summary of the invention
The acquisition method for the triggering key that the object of the present invention is to provide a kind of based on FPGA, should triggering based on FPGA press The acquisition method of key, which overcomes FPGA in the prior art, does not have the problem of triggering collection method, realizes the triggering key of FPGA Acquisition.
To achieve the goals above, the present invention provides a kind of acquisition method for triggering key based on FPGA, the acquisition Method includes:
Triggering key is sampled, and button operation is divided according to following modes according to the time by key pressing Class:
When button operation bounces in the first preset time, it is determined as that short-press operates, then executes data variation;
When button operation does not bounce in the first preset time, it is determined as long press operation, then each prefixed time interval A data variation is executed, until the data variation is termination when limiting value or key bounce.
Preferably, the method sampled to triggering key includes: by adopting to triggering by the failing edge of key pressing Sample.
Preferably, include: to the method that is sampled of triggering key
The clock frequency of programmable button sampling is 50KHz, in the case where key press time is more than the second preset time, is determined The button operation is effective, otherwise, it is determined that the button operation is invalid.
Preferably, in the case where being determined as long press operation, timer is opened in control, and a sending at regular intervals has Effect positive pulse execute a data variation in the case where detecting effective positive pulse, until the data variation be limiting value or Termination when person's key bounces.
Preferably, data variation is change of brightness levels.
Preferably, the change of brightness levels is recorded and saved.
According to the above technical scheme, the present invention is by confirming the mode of operation of key simultaneously to the acquisition of button operation time Execute corresponding data manipulation, at the same can also according to customer demand, adjusted by parameter configuration the short-press time, it is long temporally, The relevant parameters such as long-pressing data variation time, have stronger adaptability and flexibility, the key being applicable in various situations Operation, while this method has certain key stabilization processing, has higher reliability.
Other features and advantages of the present invention will the following detailed description will be given in the detailed implementation section.
Detailed description of the invention
The drawings are intended to provide a further understanding of the invention, and constitutes part of specification, with following tool Body embodiment is used to explain the present invention together, but is not construed as limiting the invention.In the accompanying drawings:
Fig. 1 is to illustrate a kind of key acquisition hardware circuit diagram of the invention;
Fig. 2 is to illustrate a kind of acquisition of key and flow chart of data processing figure of the invention.
Specific embodiment
Below in conjunction with attached drawing, detailed description of the preferred embodiments.It should be understood that this place is retouched The specific embodiment stated is merely to illustrate and explain the present invention, and is not intended to restrict the invention.
The present invention provides a kind of acquisition method of triggering key based on FPGA, which includes:
Triggering key is sampled, and button operation is divided according to following modes according to the time by key pressing Class:
When button operation bounces in the first preset time, it is determined as that short-press operates, then executes data variation;
When button operation does not bounce in the first preset time, it is determined as long press operation, then each prefixed time interval A data variation is executed, until the data variation is termination when limiting value or key bounce.
According to the above technical scheme, the present invention is by confirming the mode of operation of key simultaneously to the acquisition of button operation time Execute corresponding data manipulation, at the same can also according to customer demand, adjusted by parameter configuration the short-press time, it is long temporally, The relevant parameters such as long-pressing data variation time, have stronger adaptability and flexibility, the key being applicable in various situations Operation, while this method has certain key stabilization processing, has higher reliability.
In a kind of specific embodiment of the invention, the method sampled to triggering key may include: by right Triggering is sampled by the failing edge of key pressing.
Key is acquired, we are considering key just firstly the need of the clock frequency for confirming that lower FPGA samples it The duration often operated and stabilization processing, the clock frequency that key samples is traditionally arranged to be 50KHz by us.To the hard of key Part design is key one end to be pulled to 3.3V using resistance, while the I/O pin for being connected to FPGA is acquired, the key other end Then it is connected to ground.As shown in Figure 1.When key is not pressed, the collected key-press status of FPGA is high level, when by key pressing When, the collected key-press status of FPGA is to become low level from high level, after key unclamps, and becomes high level again.
The key-press status of input is acquired in real time using the sampling clock of 50KHz in FPGA program.
In original state 0, the state waited by key pressing is had been at, when pressing key pressing, high level becomes low electricity The failing edge pulse for showing no increases in output raw can be collected, and enter state 1 at this time.
Be to be acquired to the low level duration in state 1, there is the judgement of a duration in state 1, i.e., it is short By the judgement with long-pressing, if the low level duration is more than 500ms (judging the time according to the long-pressing of customer demand), then it is assumed that Key is in long-pressing state, into state 3, if the duration is less than 500ms and has been detected by rising edge (rising at this time Edge shows that key unclamps), then it is assumed that key has just performed a short-press state, enters state 2.
State 2 is the processing of key short-press state, while having the processing of key stabilization.Firstly, being adopted to the key in state 1 The sample time is judged, confirms that the time of key is greater than 10ms and just confirms key effectively (stabilization processing).If it is confirmed that key has Current data is then changed 1 grade by effect, realizes button operation.
State 3 is the processing of key long-pressing state.Firstly, at this time opening a timer, the timer interval is certain Time issue an effective positive pulse, it is then detected that current data is changed 1 grade, if being constantly in length to after positive pulse By state, then can between at regular intervals, data accumulated change 1 this, terminate after key release.The purpose handled in this way is It to keep the variation of product current state more smooth, rather than is mutated, such as long-pressing brightness regulation, handles, then produce in a manner described The brightness regulation of product is seamlessly transitted by certain speed, rather than in a manner of being mutated or jump, it is easier to people be allowed to receive.
In a kind of specific embodiment of the invention, the method sampled to triggering key may include:
The clock frequency of programmable button sampling is 50KHz, in the case where key press time is more than the second preset time, is determined The button operation is effective, otherwise, it is determined that the button operation is invalid.
In a kind of specific embodiment of the invention, in the case where being determined as long press operation, timer is opened in control, And effective positive pulse is issued at regular intervals, in the case where detecting effective positive pulse, a data variation is executed, directly It is termination when limiting value or key bounce to the data variation.
In a kind of specific embodiment of the invention, data variation is change of brightness levels.
In a kind of specific embodiment of the invention, the change of brightness levels is recorded and saved.
In above-mentioned key acquisition and process flow, the data of key short-press are not necessarily to extra process, primary by key pressing, then count It according to 1 grade of variation, but needs to guarantee the range of normal data, cannot overflow.
And the data of key long-pressing then need the configuration of some parameters, under long-pressing state, how long data variation 1 It is secondary.Firstly, according to user demand, e.g., the data variation that user needs to complete in long-pressing 5s from 0 grade to 99 grade, then basis Total time and variation grades can substantially judge under long-pressing state that the time of 1 grade of variation is about 5/100=50ms.Therefore, The triggered time of pulse is set herein as 50ms.
In view of the versatility and convenience of the program module, it would be desirable to which there are two the parameters of configuration:
First is that the upper limit value of button data, general lower limit value is 0, and upper limit value is then needed according to user demand, such as brightness tune Perhaps 255 grades of contrast adjustments are generally 16 grades or 64 grades etc. to generally 100 grades of section.The variable of this data maximums exists Data_max is defined as in program module.
Second is that the pulsed time, 100 grades of adjusting is completed by the long-pressing 5s of above-mentioned requirements, then the burst length be 50ms completes 64 grades of adjusting if it is 5s, then the burst length is about 5/64=78ms.Since the time that pulse generates is by fixed When device determine that then we sets the parametric variable of the timer of generation pulse according to demand, and the chronomere of timer sets It is set to 1ms, the variable-definition of time configuration parameter is time_data.
Variable data_max and time_data are defined in the interface of program module, i.e., in the interface of the program module The middle numerical value using a needs carries out assignment to it.As in the interface respectively by data_max and time_data assignment For 99 and 50, then the range of the adjusting data is 0~99, and long-pressing transformation period is 50ms, i.e. completes from 0 grade to 99 in long-pressing 5s The data of grade are adjusted.
Data storage
The brightness of product or contrast adjustment is required to require have memory function now, i.e. data power down saves function Can, therefore, we need the data that will be adjusted to be deposited into EEPROM, when designing the work of key acquisition to realize function Energy.
Data are deposited into the FPGA program module that EEPROM is also a standard, we only need to write to one data Flag bit and the data value write of needs.
In above-mentioned key acquisition module, it would be desirable in key short-press and two states of long-pressing data processing all Data write-in functions are set.When key short-press operates, after data update, the home position that data are write is high, key When long press operation, then need again by the home position write height after long-pressing, rather than after data update.Because of long press operation It is a lasting process, if data are every to update the operation for being once carried out and once writing data, then under a long press operation Come, multiple data write-in functions can be executed, and if it is long-pressing after execute, then only can execute a data writing operation, Final data is stored in EEPROM.Because the write-in number of each EEPROM is limited, it can effectively extend EEPROM's in this way Service life.
The flow chart of entire key acquisition and data handling procedure is illustrated in fig. 2 shown below.
Hardware design is simple, convenient, and reliable, realizes powerful;
Content is simple logical language description, and the internal resource for occupying FPGA is few;
Have stronger applicability and convenience, be applicable in and acquired with key in most cases, configuration parameter is convenient, calls Simply, reduce the development cycle;
Method has certain versatility, and independent of specific PFGA platform, transplanting is convenient, in common FPGA platform It can realize, such as Xilinx, Altera, Lattice etc..
It is described the prefered embodiments of the present invention in detail above in conjunction with attached drawing, still, the present invention is not limited to above-mentioned realities The detail in mode is applied, within the scope of the technical concept of the present invention, a variety of letters can be carried out to technical solution of the present invention Monotropic type, these simple variants all belong to the scope of protection of the present invention.
It is further to note that specific technical features described in the above specific embodiments, in not lance In the case where shield, can be combined in any appropriate way, in order to avoid unnecessary repetition, the present invention to it is various can No further explanation will be given for the combination of energy.
In addition, various embodiments of the present invention can be combined randomly, as long as it is without prejudice to originally The thought of invention, it should also be regarded as the disclosure of the present invention.

Claims (6)

1. a kind of acquisition method of the triggering key based on FPGA, which is characterized in that the acquisition method includes:
Triggering key is sampled, and is classified to button operation according to following modes according to the time by key pressing:
When button operation bounces in the first preset time, it is determined as that short-press operates, then executes data variation;
When button operation does not bounce in the first preset time, it is determined as long press operation, then each prefixed time interval executes Data variation, until the data variation is termination when limiting value or key bounce.
2. it is according to claim 1 based on FPGA triggering key acquisition method, which is characterized in that triggering key into The method of row sampling includes: by sampling to triggering by the failing edge of key pressing.
3. it is according to claim 1 based on FPGA triggering key acquisition method, which is characterized in that triggering key into Row sampling method include:
The clock frequency of programmable button sampling is 50KHz, in the case where key press time is more than the second preset time, determines that this is pressed Key operation is effective, otherwise, it is determined that the button operation is invalid.
4. the acquisition method of the triggering key according to claim 1 based on FPGA, which is characterized in that be determined as long-pressing In the case where operation, timer is opened in control, and issues effective positive pulse at regular intervals, is detecting effective positive pulse In the case where, a data variation is executed, until the data variation is termination when limiting value or key bounce.
5. the acquisition method of the triggering key according to claim 1 based on FPGA, which is characterized in that data variation is bright Spend grade variation.
6. the acquisition method of the triggering key according to claim 5 based on FPGA, which is characterized in that record and save this Change of brightness levels.
CN201811189671.1A 2018-10-12 2018-10-12 The acquisition method of triggering key based on FPGA Pending CN109450414A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811189671.1A CN109450414A (en) 2018-10-12 2018-10-12 The acquisition method of triggering key based on FPGA

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811189671.1A CN109450414A (en) 2018-10-12 2018-10-12 The acquisition method of triggering key based on FPGA

Publications (1)

Publication Number Publication Date
CN109450414A true CN109450414A (en) 2019-03-08

Family

ID=65544817

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811189671.1A Pending CN109450414A (en) 2018-10-12 2018-10-12 The acquisition method of triggering key based on FPGA

Country Status (1)

Country Link
CN (1) CN109450414A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111078118A (en) * 2019-12-03 2020-04-28 湖南强军科技有限公司 Device and method for carrying out anti-shake processing on key
CN111103532A (en) * 2019-12-13 2020-05-05 青岛海信智慧家居***股份有限公司 Method and device for detecting contact of intelligent key panel

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103178825A (en) * 2011-12-22 2013-06-26 联发科技股份有限公司 Apparatus for performing key control
CN103345909A (en) * 2013-07-24 2013-10-09 南车株洲电力机车研究所有限公司 Communication control method and device of train display screen
CN103488405A (en) * 2013-09-24 2014-01-01 上海斐讯数据通信技术有限公司 Electronic device and screen brightness adjusting method
CN107170423A (en) * 2017-07-04 2017-09-15 深圳传音通讯有限公司 Mobile terminal and mobile terminal screen luminance regulating method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103178825A (en) * 2011-12-22 2013-06-26 联发科技股份有限公司 Apparatus for performing key control
CN103345909A (en) * 2013-07-24 2013-10-09 南车株洲电力机车研究所有限公司 Communication control method and device of train display screen
CN103488405A (en) * 2013-09-24 2014-01-01 上海斐讯数据通信技术有限公司 Electronic device and screen brightness adjusting method
CN107170423A (en) * 2017-07-04 2017-09-15 深圳传音通讯有限公司 Mobile terminal and mobile terminal screen luminance regulating method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111078118A (en) * 2019-12-03 2020-04-28 湖南强军科技有限公司 Device and method for carrying out anti-shake processing on key
CN111103532A (en) * 2019-12-13 2020-05-05 青岛海信智慧家居***股份有限公司 Method and device for detecting contact of intelligent key panel

Similar Documents

Publication Publication Date Title
CN101882046B (en) Touch screen unlocking method and system
CN109450414A (en) The acquisition method of triggering key based on FPGA
CN103984532B (en) A kind of mobile terminal function arranges position method to set up and the device of key
CN104735264B (en) A kind of mobile terminal and its control method
CN106293402B (en) Application control method and its device
CN103049280B (en) A kind of method and mobile terminal for realizing key macro definition function
CN107864271A (en) A kind of information loading method and device
CN106648326B (en) The method and mobile terminal of screen time is put out in adjustment
CN103488405A (en) Electronic device and screen brightness adjusting method
CN107678674A (en) Touch control method, electronic equipment and storage medium
CN103336570B (en) Dormancy control method and terminal
CN106325663A (en) Mobile terminal and screen capturing method thereof
CN104090633A (en) Mobile device protective cover and method for enabling touch screen mobile device to be in dormant state
CN106502544A (en) A kind of application program launching method and device
CN106056012A (en) Terminal power key control method and system
CN106095473A (en) A kind of time display method and device thereof
CN110110306A (en) Method for exhibiting data, device, terminal and computer readable storage medium
CN108874261A (en) Remote controler, terminal, the display methods of operation interface and storage medium
EP2063342A2 (en) Power supply switching for an electronic device, computer with a power supply switch and energy saving procedure
CN105573610B (en) A kind of spreadsheet operations method and device
CN104978118B (en) A kind of graphical interface of user display methods, device and terminal device
CN106354273B (en) A kind of method and smart machine manipulating smart machine
CN107024986A (en) A kind of method that intelligent terminal is controlled based on Intelligent bracelet number of taps
US20130082941A1 (en) Wrist-worn device and parameter adjusting method using thereof
CN205375043U (en) Controlling means and cooking device

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