PIC24 Interrupts

General discussion on mikroPascal PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Hristo
Posts: 33
Joined: 20 Oct 2014 14:39

PIC24 Interrupts

#1 Post by Hristo » 18 Mar 2023 12:43

Hello,

I am trying to migration a program from PIC18F26K22 to PIC24FJ256GA702.
On the PIC18, everything works fine. In PIC24 I can't drive any interrupt.
There are only two interrupts - from UART and from TIMER1.
The interrupt flag is raised normally, ie. if I check in the Main Loop whether

Code: Select all

If IFS0.3 = 1 then
  begin
    IFS0.3 := 0;
    Refresh;
  end;
the Refresh procedure is running.

If I use an interrupt procedure

Code: Select all

procedure Timer1Int; iv IVT_ADDR_T1INTERRUPT; ics ICS_AUTO;
begin
   IFS0.T1IF := 0;
   Refresh;
end;
the Refresh procedure is not executed.

The compiler is MikroPascal PRO for dsPIC v.7.1.0.
Just to note that this is my first time writing about the PIC24 and I'm obviously missing something.

I enable interrupt from Timer1, enable global interrupts (which I don't think is needed by default), set interrupt priority

Code: Select all

  IEC0.T1IE := 1;                     { Timer 1 Interrupt Enable               }
  IFS0.T1IF := 0;
  IPC0.T1IP0 := 0;                    { Timer 1 Interupt Priority = 4          }
  IPC0.T1IP1 := 0;
  IPC0.T1IP2 := 1;
  INTCON2.GIE := 1;
Аny advice would be appreciated.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: PIC24 Interrupts

#2 Post by filip » 23 Mar 2023 14:27

Hi,

Did you take a look at the interrupts example in the Examples subfolder of the compiler ?

Regards,
Filip.

Post Reply

Return to “mikroPascal PRO for dsPIC30/33 and PIC24 General”