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 '_Default_IRQ_handler';noreturn;
      asm
      .Lloop:
        jmp .Lloop
      end;


Regards,

Andrew
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to