VHDL model of a push button debouncer

Discussion in 'VHDL' started by fpgawizz, Mar 17, 2005.

  1. fpgawizz

    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, Mar 17, 2005
    #1
    1. Advertising

  2. "fpgawizz" <> wrote in message
    news:...
    > 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
    Douglas Sykora, Mar 17, 2005
    #2
    1. Advertising

  3. fpgawizz

    fpgawizz Guest

    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, Mar 17, 2005
    #3
  4. fpgawizz

    Bert Cuzeau Guest

    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 !
    Bert Cuzeau, Mar 17, 2005
    #4
  5. Hello,

    "fpgawizz" <> schrieb im Newsbeitrag
    news:...
    > 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
    Winfried Salomon, Mar 20, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Aspinall

    Crystal Reports - Push model

    Paul Aspinall, Aug 5, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,892
    Paul Aspinall
    Aug 5, 2003
  2. afd
    Replies:
    1
    Views:
    8,267
    Colin Paul Gloster
    Mar 23, 2007
  3. XyZaa
    Replies:
    0
    Views:
    552
    XyZaa
    Jul 19, 2007
  4. Amit
    Replies:
    4
    Views:
    454
  5. samppi
    Replies:
    27
    Views:
    451
    David A. Black
    Dec 5, 2007
Loading...

Share This Page