VHDL model of a push button debouncer

F

fpgawizz

Guest
I have this deboucing logic that i have using 2 d flip flops to sense an
push button input..the trouble here is that this also needs to be level
sensitive..i.e. as long as this push button is pushed i must display
something..

my code right now is

process(clk,button)
begin
if clk'event and clk = '1' then
button1 <= button;
button2 <= button1;
end if;
end process Debounce_Process;
mybutton <= button2 and (not(button1));

mybutton is my debounced version of button..but this signal mybutton does
not take care of the scenario when "button" is pushed and held high. In
that case i want button to be debounced when the first edge happens as
well as stay high since the user has still not taken his finger off of the
button.

Any thoughts on how i can achieve that?
thanks
 
"fpgawizz" <bhaskarstays@yahoo.com> wrote in message
news:e38de0e98172bb1559f387d5be19bc58@localhost.talkaboutelectronicequipment.com...
I have this deboucing logic that i have using 2 d flip flops to sense an
push button input..the trouble here is that this also needs to be level
sensitive..i.e. as long as this push button is pushed i must display
something..

my code right now is

process(clk,button)
begin
if clk'event and clk = '1' then
button1 <= button;
button2 <= button1;
end if;
end process Debounce_Process;
mybutton <= button2 and (not(button1));

mybutton is my debounced version of button..but this signal mybutton does
not take care of the scenario when "button" is pushed and held high. In
that case i want button to be debounced when the first edge happens as
well as stay high since the user has still not taken his finger off of the
button.

Any thoughts on how i can achieve that?
thanks

fpgaWizz,
The button1 register has metastablility issues because your input "button"
is not synchronized to your clock. button2 is a stable version of the
possibly metastable "button1". May I suggest you google metastablity.
mybutton just has a pulse on every rising edge of button2.
This circuit doesn't debounce the input. You may want to google debounce.
I just checked and a few very informative links were right at the top of the
list.
Homework, or hobbyist project?
Doug
 
will give google a try..this portion is a part of my overall design..which
is a simple RISC processor using Xilinx FPGA.Yes its a course as
well..Just trying to learn something that i can hopefully use to move to a
different position in my firm..
 
fpgawizz wrote:
I have this deboucing logic that i have using 2 d flip flops to sense an
push button input..the trouble here is that this also needs to be level
sensitive..i.e. as long as this push button is pushed i must display
something..
See alse-fr.com/archive/debounce.zip !
 
Hello,

"fpgawizz" <bhaskarstays@yahoo.com> schrieb im Newsbeitrag
news:e38de0e98172bb1559f387d5be19bc58@localhost.talkaboutelectronicequipment.com...
I have this deboucing logic that i have using 2 d flip flops to sense an
push button input..the trouble here is that this also needs to be level
sensitive..i.e. as long as this push button is pushed i must display
something..

my code right now is

process(clk,button)
begin
if clk'event and clk = '1' then
button1 <= button;
button2 <= button1;
end if;
end process Debounce_Process;
mybutton <= button2 and (not(button1));

mybutton is my debounced version of button..but this signal mybutton does
not take care of the scenario when "button" is pushed and held high. In
that case i want button to be debounced when the first edge happens as
well as stay high since the user has still not taken his finger off of the
button.

Any thoughts on how i can achieve that?
thanks
under the topic "making a glitch filter" 2 weeks ago, Ulf Samuelsson posted
a VHDL solution for glitches, that are IMHO longer than a clock periode. I
myself wrote something about a schematics solution to debounce the clock
itself, that could be translated into VHDL, but it needs an "analog" delay
line.

Regards, Winfried
 

Welcome to EDABoard.com

Sponsor

Back
Top