Forum Discussion
Altera_Forum
Honored Contributor
8 years agoNo control Nested If condition ?
Hi All, I am trying to code an alarm-clock; The problems that I have right now is in setting up the alarm when SW2 is ON Currently when I run the program, it automatically enters the loop ...
Altera_Forum
Honored Contributor
8 years agoYou'll need to do an edge detect on key2. You do this by comparing a registered version of the key to the current state. If it changes, you have an edge.
// inside synchronous always
key2_r <= key2
if(key2 & ~key2_r) begin
// edge on key