VHDL中按键消抖的一种方法--延时性消抖

VHDL中按键消抖的一种方法--延时性消抖

在本例子中,input是按键的输入,output是消抖之后的按键输出

是clk经历8个上升沿之后就让output输出一个CLK周期的高电平!

本程序实例测试好用


library ieee;
use ieee.std_logic_1164.all;


entity PWlock is
port(clk: in std_logic;
input: in std_logic;
output: out std_logic
);
end PWlock;


architecture one of PWlock  is
signal a:std_logic;
signal count:integer range 0 to 9;
begin
process(clk)
begin
if input='0' then 
count<=0;
elsif (clk'event and clk='1') then
if count=9 then 
count<=count;    --like while(1) in the C program

else
count<=count+1;
end if;
end if; --for elsif

if count=8 then 
a<='0';
else
a<='1';
end if;

end process;
output<=a;
end one;

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值