cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Observer
Observer
8,823 Views
Registered: ‎02-24-2015

Debouncing Problem

I am actually implementing a Binary sequence detector in a Basys-2 spartan 3e CP132 board.I have given my program,but I am not aware of the debouncing problem.It is a mealey FSM which detects "1010".How will I give the clock input.Please help me with a debouncing circuit for my program.

module melfsmolp(din, reset, clk, y);
output reg y;
input din;
input clk;
input reset;
reg [1:0] cst, nst;
parameter S0 = 2'b00,
          S1 = 2'b01,
          S2 = 2'b10,
          S3 = 2'b11;
always @(cst or din)
 begin
 case (cst)
   S0: if (din == 1'b1)
          begin
         nst = S1;
          y=1'b0;
          end
      else
          begin
           nst = cst;
          y=1'b0;
          end
   S1: if (din == 1'b0)
          begin
        nst = S2;
          y=1'b0;
          end
       else
          begin
           nst = cst;
          y=1'b0;
          end
   S2: if (din == 1'b1)
          begin
         nst = S3;
          y=1'b0;
          end    
            else
          begin
           nst = S0;
          y=1'b0;
          end
   S3: if (din == 1'b0)
          begin
         nst = S2;
          y=1'b1;
          end
       else
          begin
          nst = S1;
          y=1'b0;
          end
   default: nst = S0;
  endcase
end
always@(posedge clk)
begin
           if (reset)
             cst <= S0;
           else
             cst <= nst;
end
endmodule



 

0 Kudos
4 Replies
Highlighted
Teacher
Teacher
8,801 Views
Registered: ‎08-14-2007

Re: Debouncing Problem

hi,

why didn't you just search the forum for "debouncer".

You could have found this:

http://forums.xilinx.com/t5/General-Technical-Discussion/bouncing-switches-and-debouncers-principles-and-implementations/m-p/407789/highlight/true#M16880

 

Have a nice synthesis

  Eilert

0 Kudos
Highlighted
Observer
Observer
8,794 Views
Registered: ‎02-24-2015

Re: Debouncing Problem

Can you please provide the Debouncing code in verilog as I am confused with the forums.It would be really great if you could atleast provide me a gist of the debouncing code to my project which is been implemented in Basys-2 Spartan 3E board.

Tags (1)
0 Kudos
Highlighted
Observer
Observer
8,773 Views
Registered: ‎02-24-2015

Re: Debouncing Problem

Can you please provide the Debouncing code in verilog as I am confused with the forums.It would be really great if you could atleast provide me a gist of the debouncing code to my project which is been implemented in Basys-2 Spartan 3E board.
0 Kudos
Highlighted
Historian
Historian
8,746 Views
Registered: ‎02-25-2008

Re: Debouncing Problem


@rva.raghav wrote:
Can you please provide the Debouncing code in verilog as I am confused with the forums.It would be really great if you could atleast provide me a gist of the debouncing code to my project which is been implemented in Basys-2 Spartan 3E board.

Start here: http://lmgtfy.com/?q=Verilog+debounce+code

----------------------------Yes, I do this for a living.
0 Kudos