Altera_Forum
Honored Contributor
12 years agoDebounce Verilog ( I have some questions)
hello everyone. i'm new to verilog programming. i have some questions on debouncer. I already get the concept of debouncing. but how do i compute for the length of the register that i would be using.
i would be using this for a pushbutton on DE1. evrytime i press the button, there are still a lot of increments even with this debouncer. i am using 24MHz clock. here's my code: module dbc(pbnoisy, clk, pbclean); input wire pbnoisy, clk; output reg pbclean; parameter N=8; reg [ N - 1 : 0 ] ctr; always @(posedge clk) begin ctr [ N -1 : 0 ] <= {ctr[N-2:0] , pbnoisy}; if ( ctr[N-1:0] == 8'b00000000) pbclean <= 1; else if ( ctr[N-1:0] == 8'b11111111) pbclean <= 0; else pbclean <= pbclean; end endmodule please help. thanks