Forum Discussion
Altera_Forum
Honored Contributor
14 years agoThere are different ways to debounce keys.
In your case you want to detect push = '0' once only over some practical interval. For example I will run a counter for 20 msec. pseudocode, on the clock edge...
if push = '0' and count = max then -- first push detection
push_L <= '1';
end if;
if push = '0' and push_L = '0' then
count <= 0;
end if;
if count < max then
count <= count + 1;
else
push_L <= '0';
end if;
if push = '0' and push_L = '0' then
push_T <= not push_T; -- to your engine, hopefully without smoke
end if;
you will need to test this logic as I wrote it off head.