User manual
143
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
For the sake of backward compatibility, user may write also:
procedure int1(); org IVT_ADDR_U1RXINTERRUPT;
begin
asm
nop;
end;
end;
which is equivalent to:
procedure int1(); iv IVT_ADDR_U1RXINTERRUPT;
begin
asm
nop;
end;
end;
It is recommended that interrupts are handled in this way for the sake of better readability of the user projects.
Interrupt Example
Here is a simple example of handling the interrupts from Timer1 (if no other interrupts are allowed):
//-------------- Interrupt routine
procedure Timer1Int; iv IVT_ADDR_T1INTERRUPT;
begin
//** it is necessary to clear manually the interrupt ag:
IFS0 := IFS0 and $FFF7; // clear TMR1IF
//** user code starts here
LATB := not PORTB; // invert PORTB
//** user code ends here
end;