RTCC interrupt occurs but not jumping in interrupt routine

General discussion on mikroC PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
nikola.vasovic
Posts: 7
Joined: 13 May 2016 16:57

RTCC interrupt occurs but not jumping in interrupt routine

#1 Post by nikola.vasovic » 10 Jun 2016 11:14

Hi All,

I have a problem with RTCC internal module alarm interrupt, in fact, what is happening is that i can see in the main() that interrupt alarm flag is raised, by checking IFS3.RTCIF but it does not jumps in the interupt service routine??????????? any idea why is this happening?

controller: PIC24FJ128GA308
compiler: mikroC pro 6.2.1


code:

Code: Select all

void rtc_alarm_interrup() iv IVT_ADDR_RTCCINTERRUPT ics ICS_AUTO
{
   led_RGB(GREEN);
   Delay_ms(1000);
   IFS3 = IFS3 & 0xBFFF;                                                        // Clear RTC flag
}

void main()
{
  uc_init();
  RTC_DeactivateAlarm();
  RTC_SetTime(0, 0, 0); // h m s
  RTC_SetDate(10, 7, 16); // d m y
  Delay_ms(100);
  RTC_ActivateAlarm(0b00000010,1); // 10sec alarm

  while(1)
  {
    if(IFS3.RTCIF==1)
    {
      led_RGB(BLUE);
      Delay_ms(1000);
      IFS3.RTCIF=0;
    }
    
    led_RGB(RED);
  }                                                                             // end while (1)
}     
...

Code: Select all

void RTC_ActivateAlarm(unsigned short alarm_mask, unsigned short alarm_int)
{
  ALCFGRPT = 0xC000 |((alarm_mask & 0x0F) << 10);

  if(alarm_int==1)      // If true, we activate the interrupt
  {
    IFS3 = IFS3 & 0xBFFF;  // Clear RTC flag
    IEC3 = IEC3 | 0x4000;   // Enable RTC Int
  }
}

Regards
Nikola

nikola.vasovic
Posts: 7
Joined: 13 May 2016 16:57

Re: RTCC interrupt occurs but not jumping in interrupt routi

#2 Post by nikola.vasovic » 10 Jun 2016 14:42

Sorted, from some reason works only when interrupt priority is 7 .... :evil: :evil: :evil: :evil: :evil:

Nikola
Last edited by nikola.vasovic on 11 Jun 2016 08:43, edited 1 time in total.

divivoma
Posts: 20
Joined: 12 Dec 2013 19:15

Re: RTCC interrupt occurs but not jumping in interrupt routi

#3 Post by divivoma » 10 Jun 2016 19:34

Any update on this topic?

Post Reply

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