EICRA = _BV(ISC11); //external interrupt 1 on falling edge _delay_loop_1(2); //allow time for the interrupt caused by setting ISCxx (#include <util/delay_basic.h>) EIFR = _BV(INTF1); //clear the interrupt flag EIMSK = _BV(INT1); //enable external interrupt 1
I wonder if External Interrupts work differently by design, accident, or mistake.
...the minimal code to do the job ends up like this...
Maybe someone can think of a reason that it should work this way
QuoteMaybe someone can think of a reason that it should work this wayFrom a HW point of view, I can imagine circuitry that detects falling and rising edges, as well as levels, that would be active all the time (whether or not interrupts are enabled.) Enabling the pin change interrupt causes an immediate interrupt, because sure enough there HAS BEEN a falling edge some time in the past, even though it wasn't set up to cause interrupts. I think the timer interrupts work like this too. If you've been running the timer for a while without paying attention to the pieces that cause interrupts, the "overflow" bit will be set (you never cleared it, after all) and will cause an interrupt as soon as you enable timer overflow interrupts.
From a HW point of view, I can imagine circuitry that detects falling and rising edges, as well as levels, that would be active all the time...
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16