Research and application of key bounce elimination module based on FPGA

Publisher:自由思考Latest update time:2010-08-02 Source: 同济大学微电子中心Keywords:FPGA Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Buttons are often used in digital circuit design. The bouncing phenomenon of buttons is an objective problem in digital system design. Buttons are mechanical contacts, and jitter will occur when the contact point is open or closed. In order to make each button respond only once, the jitter must be removed. This article analyzes the jitter signal of the button and completes the design of the jitter elimination circuit module by means of a counter. The module is applied to the system of button-controlled LCD display, and the system is implemented on the Virtex-4 MB system experiment board represented by Memec. The effect of the de-jitter circuit is good, and the button-controlled LCD display result is normal.

The key switch is one of the main components of human-computer interaction in electronic devices. Most keys are mechanical switch structures. Since the core component of the mechanical switch is an elastic metal reed, the contact point will bounce back and forth at the moment of switching. For circuits with relatively high sensitivity, the signal jitter caused by this bouncing phenomenon will cause false operation and affect the correctness of the system. Therefore, we need to design a key bounce elimination circuit to remove the jitter.

1. Principle and function of bounce elimination circuit

The typical connection of a push button switch is divided into low-level valid and high-level valid. The one in this article is low-level valid.

There are three types of jitter in mechanical switches: jitter when pressed and jitter when released; jitter when pressed and no jitter when released; no jitter when pressed and jitter when released. The jitter waveform, jitter frequency, and jitter time of a mechanical switch are all random, and jitter does not occur every time.

The maximum jitter time of different switches is also different. The length of the jitter time is related to the mechanical switch characteristics, generally 5ms to 10ms. However, the jitter time of some switches is as long as 20ms or even longer. Therefore, in the specific design, specific analysis should be made and the design should be adjusted according to the actual situation.

The bounce phenomenon and bounce elimination are shown in Figure 1. Although the key is only pressed once and then released, multiple segment pulses appear after the key signal stabilizes. If such a signal is directly sent to a timing circuit such as a counter, it may result in a false operation of counting more than once, thus mistakenly thinking that the keyboard has been pressed multiple times. Therefore, a bounce elimination circuit must be added to remove short pulses and avoid erroneous operations.

Bounce and bounce elimination [page]

2. Implementation of the button bounce elimination module

In order to make the key bounce elimination module more concise and portable, a counter is used here to implement the function of eliminating key jitter.

2.1 Calculation of counter modulus value

Determining the counter modulus value is the key issue in eliminating key bounce. If the value is too large, that is, the sampling time is too long, the correct signal will be missed; if the value is too small, the sampling time is too short, the burr will be mistaken for the input signal.

The module value n of the counter is determined by the pulse width of the jitter signal and the period of the sampling signal clk. Since the speed of a general person pressing a key is less than 10Hz (less than 10 times per second), the key press time is greater than 100ms. Calculated at a duty cycle of 50%, the pressing time is greater than 50ms. According to this convention, we believe that the pressing time less than 50ms is a jitter signal, and the pressing time greater than 50ms is a key signal. That is, n=50ms/sampling pulse signal period, so the jitter signal with a pressing time less than 50ms can be filtered out.

Here, the actual required modulus is determined based on the system clock provided by the experimental board. The system clock provided by the experimental board is 100mHz, and a 25mHz clock is obtained by frequency division. The modulus of count obtained by 50ms*25mHz is 21'h1312D0. The debounce time obtained by using this modulus is about 50ms, which meets the requirements.

2.2 Programming

Design a high pulse counter count1 and a low pulse counter conut0. Introduce a sampling pulse signal clk, sample the input signal button_in, and count clk. If button_in is high, count1 counts up until all bits of count1 are 1, stops counting, returns to zero, and makes the output signal button_out output 1 after debounce. If button_in is low, count0 counts up until all bits of count0 are 1, stops counting, returns to zero, and makes the output signal button_out output 0 after debounce.

Some of the procedures are as follows:

program

Simulation waveform of the bounce elimination module [page]

3 Practical application of the key bounce elimination module

Using the Memec virtex-4 development board, the 8-bit 01 control code is input through the button on the development board, and the state control bit is input with the switch on the development board, thereby controlling the display mode and content of the 1602 C-type character LCD module on the board.

LCD control signal generation module: Generates an 8-bit control signal for controlling the display module based on the button input. The 1-bit (0/1) signal sent to the module by the button is saved and converted so that every 8 inputs form an 8-bit signal. If the input is less than 8 bits or needs to be re-entered, the last result is cancelled; if the input result is determined to be correct, the 8-bit signal is saved and output.

LCD display control module: completes the initialization of the 1602 C-type character LCD module and completes the state conversion according to the control signal.

LCD initialization simulation waveform

The overall system design is shown in Figure 4:

Overall system design diagram

Conclusion

This paper conducts modular design and realizes the specific functions of the system composed of bounce elimination circuit module, LCD control signal generation module and LCD display control module, which runs well on the Memec experimental board. And when debugging the circuit with FPGA, the system can be embedded in other circuits to add the required test points and observation points. By controlling the display through buttons, the circuit can be tested dynamically to find out the problems, making the debugging more intuitive, thereby improving the observability of the internal signals of FPGA and improving the verification efficiency.

Keywords:FPGA Reference address:Research and application of key bounce elimination module based on FPGA

Previous article:Design of Sine Signal Generator Based on FPGA and DDS Technology
Next article:Design and Implementation of Digital Video Conversion Interface Based on FPGA

Recommended ReadingLatest update time:2024-11-16 16:35

Real-time Analysis of DSP Design Using FPGA Dynamic Probe and Digital VSA
As FPGAs become a viable option for high-performance signal processing circuits in digital communications designs (cellular base stations, satellite communications, and radar), analysis and debugging tools must include new technologies that help you get the best performance from your circuits in the shortest possible t
[Test Measurement]
Real-time Analysis of DSP Design Using FPGA Dynamic Probe and Digital VSA
Design of CCD Image Acquisition System Based on TMS320DM642
1 System overall design 1.1 System Structure This system uses TMS320DM642 as the core and adopts modular design concept. The whole system is mainly composed of video decoding chip (A/D conversion chip), programmable logic gate array (OSD FPGA), TMS320DM642 and peripheral circuits. The peripheral circuits mainly includ
[Embedded]
Design of CCD Image Acquisition System Based on TMS320DM642
FPGA Implementation and Application Based on 51 Single Chip Microcomputer IP Core
1 Introduction For a long time, single-chip microcomputers have been widely used for their unique advantages such as high cost performance, small size, and flexible functions. However, due to the limitation of its internal resources, single-chip microcomputers need to expand related resources outside th
[Microcontroller]
FPGA Implementation and Application Based on 51 Single Chip Microcomputer IP Core
Improving the performance of wireless subsystems using FPGA coprocessing
您可以显著提高无线系统中信号处理功能的性能。怎样提高呢?有效方法是利用FPGA结构的灵活性和目前受益于并行处理的FPGA架构中的嵌入式DSP模块。 Common in wireless applications such processing includes finite impulse response (FIR) filtering, fast Fourier transform (FFT), digital up and down conversion and forward error correction (FEC).Xilinx? Virtex-4 and Virtex-5 architectures
[Embedded]
Improving the performance of wireless subsystems using FPGA coprocessing
Solutions to improve FPGA design performance
As FPGA density increases, system designers can develop larger and more complex designs to maximize the density advantage. These large-scale designs are based on design requirements - the need to add new functions to existing applications such as wireless channel cards or line cards, or to reduce board area by com
[Embedded]
Solutions to improve FPGA design performance
Design and implementation of remote monitoring system based on FPGA+DSP
The purpose and main research content of the project Research purposes In order to remotely manage equipment and monitor the environment on site, and simplify on-site monitoring equipment, effectively improve The stability and security of the entire system. It is planned to develop a remote controller , referred to
[Embedded]
Design and implementation of remote monitoring system based on FPGA+DSP
High-definition video surveillance becomes mainstream, and FPGA welcomes a broad market space
As we know, the communication field has always been the traditional mainstream market for FPGA applications, and it is also a large market that the industry's leading FPGA manufacturers have been competing for. However, since 2009, as the megapixel high-definition standards (720p and 1080p) have gone from niche to mai
[Analog Electronics]
High-definition video surveillance becomes mainstream, and FPGA welcomes a broad market space
Implementing power quality monitoring using TMS320LF2407 and FPGA
  As people's requirements for power quality increase day by day, how to ensure power quality has become a hot topic. One of the main contents of power quality monitoring is harmonic detection, which is to collect multiple analog signals and conduct harmonic analysis. This system samples 16 channels of 50Hz module sig
[Embedded]
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号