Traditional textbooks, without exception, all use the delay method to detect key presses , but this method has many flaws. I’m posting this today to talk about it. I hope you guys will forgive me, but beginners can use it as a reference.
Traditional processing method: When a key is pressed for the first time, a subroutine with a delay of 10ms is executed to confirm whether the key level can maintain the closed state level. If the closed state level is maintained, it is confirmed that a key is really pressed, thereby eliminating the influence of jitter.
shortcoming:
1. The traditional processing method executes a 10ms delay subroutine, which will reduce the real-time performance of the program.
2. The traditional processing method confirms a key action by only checking twice, which may cause false key actions in a high anti-interference environment.
suggestion:
1. The recommended bounce time is 100ms to effectively pass the EFT noise certification.
2. It is recommended that the main program continuously check for a stable low level of 100ms before determining that the key has been pressed.
3. Similarly, the key can be determined to be popped up only if the high level is continuously checked for 100ms.
4. In order to ensure the execution efficiency of MCU, try not to use the Delay method for key detection . You can consider using the combination of polling detection and timer.
Here’s how:
After finding the low level, we read the level once in each cycle (time base) and compare it with the last time. If they are the same, the counter is incremented by 1 until a sufficient number of times are reached for processing. Otherwise, the counter is cleared and starts again.
Previous article:Some suggestions for newcomers who switch from 51 to ARM
Next article:Basic knowledge summary for novices: MCU literacy post, a must-read for beginners
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Application of switch Hall sensor DRV5032 in TWS headset design
- Some learning experiences of NBIoT
- EEWORLD University Hall ---- Digital Signal Processing Beihang Wang Jun
- Application analysis of CC1310 low power consumption advantage
- I am currently using powerSTEP01 to drive a 86mm stepper motor. Does anyone have a driver for this chip?
- C6000 Program Optimization Process and Method
- "Analog input signal" protection circuit
- Simple---a TMS320F28035 key driver
- Reference Design for EtherCAT Slave without DDR
- Crystal Oscillator PPM Small Parameters, Big Effect