Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

High-efficiency key detection method

A detection method and high-efficiency technology, applied in error detection/correction, detection of faulty computer hardware, instruments, etc., can solve problems such as increasing program complexity, reducing program real-time performance, and low detection efficiency, and saving MCU resources. Effect

Inactive Publication Date: 2018-03-30
杭州天马时控科技股份有限公司
View PDF4 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0002] For the button detection of electronic devices with button functions, the traditional method is to detect the IO port corresponding to the button when using it. This detection method needs to be filtered and the button is debounced when it is used, and the detection efficiency is low. Improve the real-time performance of the program, while increasing the complexity of the program

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0016] Provide a high-efficiency button detection method,

[0017] First define some variables, which are used to control the button scanning frequency, record the result of the last button detection PrevKeyValue, the result of this detection button KeyValue, the long press time count KeyLongCount and the long press flag KeyLongFlag;

[0018] Add one to the variable used to control the key scanning frequency every specific time, and the specific time is less than 10ms. When the accumulated time is greater than or equal to 20ms, start detecting the key and clear the variable used to control the key scanning frequency for the next time detection;

[0019] Then assign the value of the result KeyValue of this detection button to the result PrevKeyValue of the last button detection, and then clear the value of the result KeyValue of this detection button;

[0020] Then start to detect the value of the key this time, read the state of the IO port connected to the key, and then assi...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a high-efficiency key detection method. The method comprises the following steps of: firstly defining certain variables which are respectively used for controlling key scanningfrequencies, and recording a previous key detection result PrevKeyValue, a current key detection result KeyValue, a long-press time count KeyLongCount and a long-press flag KeyLongFlag; adding 1 to each specific time of the variables which are used for controlling key scanning frequencies, and when the cumulative time is greater than or equal to 20ms, starting to detect keys and carrying out zeroclearing on the variables which are used for controlling key scanning frequencies, so as to facilitate the next detection. The high-efficiency key detection method is capable of improving the instantaneity of programs, reducing the complexity of the programs and realizing the high efficiency of the detection.

Description

Technical field: [0001] The invention relates to the technical field of electronic control, in particular to a high-efficiency button detection method. Background technique: [0002] For the button detection of electronic devices with button functions, the traditional method is to detect the IO port corresponding to the button when using it. This detection method needs to be filtered and the button is debounced when it is used, and the detection efficiency is low. It improves the real-time performance of the program and increases the complexity of the program at the same time. Invention content: [0003] The technical problem to be solved by the present invention is to provide a high-efficiency button detection method with high detection efficiency, which improves the real-time performance of the program and reduces the complexity of the program. [0004] The technical solution of the present invention is to provide a high-efficiency button detection method, [0005] Fir...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F11/22
CPCG06F11/2221
Inventor 王祖卫
Owner 杭州天马时控科技股份有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products