[fpc-pascal] Interrupts in ARM Embedded

Jeppe Græsdal Johansen jjohan07 at student.aau.dk
Tue Jan 22 12:05:42 CET 2013


Den 21-01-2013 18:51, Juan Duran skrev:
> Hi all,
>
> I haven't been able to find a clear example on how to program on ARM with
> interrupts. Can somebody post an example? I am specially interested in Systick
> interrupts on LPC1768.
>
> Thanks in advance
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
For peripheral interrupts you'll need to set up the NVIC, but for 
systick(which is a common cortex-m3 core interrupt) something like this 
should work(I am not sure the systick initialization is perfect):

program test;

uses cortexm3;

procedure systick; public name 'SysTick_interrupt';
begin
    // code here
end;

begin
    SysTick.LOAD := 1000;
    SysTick.CTRL := 7; // Enable, Int enable, and source = HCLK

    asm
       cpsie if // enable faults and interrupts
    end;

    while true do;
end.



More information about the fpc-pascal mailing list