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