Forum Discussion
Altera_Forum
Honored Contributor
14 years agoYou are right, I am still playing with this code for demo only as I am not aware of your inputs behaviour.
remember you can only detect switch edge one clock period after it rises. I am not sure if switch will rise once only or many times. you can run count 0~7 instead of 0 ~ 8 then it will set back to 0 ready waiting for switch to go up again. if switch = '1' and switch_d = '0' then count <= 1; else count <= count + 1; -- 0~7 free running end if; output(count) <= input; ...etc.