PDA

View Full Version : Timer-based interrupts?



djsz
11-28-2012, 12:42 PM
Is there an easy command to set up a timer-based interrupt? I've seen threads on manipulating interrupt registers but I think that's beyond my current understanding. Just checking to see if there's a simpler way to handle this before I dive into the tricky stuff.

What I want to do is turn an LED on after a button triggers a CHANGE interrupt event and have a timer turn it off after a set interval. There are a few buttons and LEDs, and some other things happen on the button press event, so I'd rather keep the button event processing triggered by interrupts.

If this isn't easy I'll move the timer stuff to the main loop.

Thanks!

mercapto
11-28-2012, 04:31 PM
It seems that we have a similar task http://http://forum.pjrc.com/threads/1272-PinChangeInt-h-Teensy2

You should move the timer stuff to the main loop. As long as you process the ISR of one button you can not process another button press. If you add the delay for the LED in the ISR the programm will stop and wait for the LED off. All other button presses will be ignored during this delay. Therefore you can only switch one LED at the time

Joerg