2012年10月18日 星期四

PushButton_Debouncer

源自

module PushButton_Debouncer (Do, Di, clk, rst);
output  Do;
input   Di;  
input   clk,rst;   

reg   [24:0] buff;   

reg     Do;   
    
always @ (posedge clk or posedge rst)    
begin  
if(rst)
begin
buff=0;
end
else
begin
if(Di)
begin

if (buff>25'd10_000_000)
  buff=buff;
else
buff=buff+25'd1;
end
else
 begin
    buff=0;
end
end
end



always @ (posedge clk)
begin
if (buff>25'd5_000_000)
Do=1;
else
Do=0;
end

endmodule

沒有留言:

張貼留言

Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --3

  Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --3 AngularJS 實例 <!DOCTYPE html> <html> <head> <meta charse...