From the above figure, we can see that there is a difference between the ideal waveform and the actual waveform. The actual waveform has jitter at the moment of pressing and releasing. The length of the jitter time is related to the mechanical characteristics of the key, generally 5~10ms. Usually we press the key manually and then release it. The stable closure time in this action exceeds 20ms. Therefore, the microcontroller must add a de-jitter operation when detecting whether the keyboard is pressed. There are dedicated de-jitter circuits and dedicated de-jitter chips, but usually we can solve the jitter problem by using software delay method.
\/* Software debounce*/
if (0 == K1 ) //If a key is pressed
{
delay_ms(8); //delay for a while to debounce
if (0 == K1) //If a key is really pressed, it is detected to be in a stable closed state
{
... //What to do after pressing the button
}
while(!K1); // Release detection, if you hold down the button, it will continue in the loop
}
Previous article:VGA Timing and Its Principle
Next article:The role of interrupts
Recommended ReadingLatest update time:2024-11-16 14:33
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- Zynq UltraScale+MPSOC Development Board Feature List
- Why is the American Fluke 15B more durable than domestic multimeters? Take a look and you will understand
- Electronic computing software
- MCO (PA8) does not output waveform during DEBUG. What is the reason?
- Patch reverse check
- EEWORLD University ---- Control system of 100 quantum bits
- The difference between USART, USI, USCI and eUSCI serial communication modules in MSP430 microcontroller (updated on March 4, 2019)
- Polarity of EPWMA pulse
- RF Sampling DAC Spurious Troubleshooting and Optimization
- CH549EVT development board test - solution to the problem of data segment exceeding the limit