Ahmad Syazwan

Questions about KBI, Falling/Rising-Edge

Discussion created by Ahmad Syazwan on Feb 15, 2009
Latest reply on Feb 4, 2013 by Russell Sher
Hello.

Correct me if I'm wrong but this is what I have understood so far:

If KBIE is set and pin for pushbutton is set as input, then KBF flag will be set to 1 on switch press, hence performing interrupt request.

My question is, how do I, or rather, what is the correct way to execute the ISR only once, and not like it's in an infinite loop once KBF is set?

For example I want to switch to toggle the LED. Currently it toggles very fast once switch is pressed, and doesn't stop doing so once the switch is released. Although I can think of a workaround of executing the ISR only once using if(once == true) or a loop that runs only once, but is that how people usually go about doing this? Plus if I do it this way how do I know how long switch is pressed or what if I want to execute ISR only on switch release?

The other question is, what is Rising and Falling-edge? Please explain keeping in mind I'm very new to embedded & hardware programming.

Thanks in advance.

Outcomes