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

沒有留言:

張貼留言

ESP32 (ESP-IDF in VS Code) MFRC522 + MQTT + PYTHON TKinter +SQLite

 ESP32 (ESP-IDF in VS Code) MFRC522 + MQTT + PYTHON TKinter +SQLite  ESP32 VS Code 程式 ; PlatformIO Project Configuration File ; ;   Build op...