[fpc-devel] AVR embedded Atmega 328p interrupts
andrewd207 at aol.com
Mon Nov 30 23:57:09 CET 2015
On 11/29/2015 06:54 PM, Jeppe Johansen wrote:
> Don't use noreturn. It signals to the compiler that your function will
> not return (i.e. do an infinite loop).
Ok, this is good to know.
> Use the interrupt directive for interrupt handlers. That makes them
> emit the iret instruction instead of ret to return from the interrupt.
> If you don't use that when you return from the ISR it will not have
> interrupts enabled. That's why it only blinks once.
This is also good to know. Interrupts are new to me. On a side note the
procedure is called repeatedly using the noreturn keyword, but I'll
change it to interrupt.
I had not used "interrupt" because this warning was emitted when I used it:
project1.lpr(139,25) Warning: Calling convention directive ignored:
> Only enable interrupts that you have written handlers for otherwise
> they end up in the default handler which is an infinite loop as you saw.
> TIMER0_COMPB and TIMER0_OVF are not called because you don't set
> OCIE0B or OCIE0A in TIMSK0.
This makes sense.
Thanks very much for your input!
More information about the fpc-devel