[fpc-devel] AVR embedded Atmega 328p interrupts

Andrew Haines andrewd207 at aol.com
Sun Nov 29 22:28:59 CET 2015

On 11/29/2015 02:13 PM, Jeppe Johansen wrote:
> Not sure the timer initialization is right, but it looks ok.
> One thing you need is the interrupt procedure directive:
> procedure TIMER0_overflow; interrupt; public name 'TIMER0_COMPA_ISR';
> Otherwise it'll probably reset at some point.
> What compiler commandline are you using?

ppcrossavr -Tembedded -Pavr -WpATMEGA328P -XPavr- test.lpr

then after compile, a script with:
avrdude -F -vv -p atmega328p -c arduino -P /dev/ttyUSB2 -b57600 -D -U 
flash:w:test.hex || echo Failed to upload

> Best Regards,
> Jeppe

I added the interrupt keyword with no effect. Also I added interrupt 
handlers for TIMER0_COMPB and TIMER0_OVF just in case.

It looks like the default handler enters an infinite loop. Afaict all 
unassigned interrupts go to the default handler. Maybe I need to assign 
every handler?

procedure Default_IRQ_handler; assembler; nostackframe; public name 
         jmp .Lloop



More information about the fpc-devel mailing list