This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
Hi! I am trying to setup the RTC_C module. I used other examples for the actual setup and I think it is about right, but I cannot get the RTCIV_RTCAIFG (alarm interrupt) interrupt to fire. RTCIV_RTCTEVIFG and RTCIV_RTCRDYIFG interrupts are working so I think it has something to only do with the alarm setup. Any help or suggestions would be appreciated! Thank you!
Here's what I have done:
unsigned int PollingInterval = 1;
int main(void){
// **RTC_C SETUP**
RTCCTL0_H = RTCKEY_H; //Unlock RTC Registers
RTCCTL0_L = RTCTEVIE_L | RTCRDYIE_L; //Enable RTC Read Ready Interrupt and Time Event Interrupt
RTCCTL13 = RTCBCD | RTCMODE | RTCHOLD; //Enable BCD mode, enable RTC in calendar mode, hold RTC while date/time values are set
//Set date and time information
RTCYEAR = 0x2018;
RTCMON = 0x7;
RTCDAY = 0x25;
RTCDOW = 0x4;
RTCHOUR = 0x12;
RTCMIN = 0x50;
RTCSEC = 0x00;
//RTC ALARM SETUP
unsigned int Temp_time = 0;
Temp_time = (((RTCMIN >> 4) & 0x0F) * 10) + (RTCMIN & 0x0F);
Temp_time += PollingInterval;
if(Temp_time > 59){
Temp_time -=60;
RTCAMIN = (Temperary_time / 10) << 4;
RTCAMIN |= (Temperary_time % 10);
}else{
RTCAMIN = (Temp_time/10) << 4;
RTCAMIN |= (Temp_time%10);
}
RTCAMIN |= RTCAE; //enable minute alarm
RTCCTL13 &= ~(RTCHOLD); // Start RTC
RTCCTL0_H = 0; //Lock RTC Registers
}
#pragma vector = RTC_C_VECTOR
__interrupt void RTC_C_ISR(void){
switch(__even_in_range(RTCIV, RTCIV__RT1PSIFG)){
case RTCIV_RTCTEVIFG: // minute interrupt
break;
case RTCIV_RTCRDYIFG: //second interrupt
break;
case RTCIV_RTCAIFG: // can give an interrupt every hour at a specific minute;
MEAS_RTC_RATE(PollingInterval);
break;
default:
break;
}
}
edit: tried to fix formatting
Hi Cash Hao,
Yes, that helped me set it up, as the code shows, since I am setting the RTCAMIN and and the AE bit for it. I tried clearing it all, but the interrupts are still not happening.
Sanskriti
Hi Cash Hao,
Yes, I added that after I read the snippet you shared the first time so it's not in the code I posted. Yes, I debugged by looking at the registers and they all were all as expected.
Thanks,
Sanskriti
Hi Sanskriti,
If it still doesn't work, you can send out your current code.
Best regards,
Cash Hao
Is there any other information I can provide? I am still puzzled as to why only the alarm interrupt is not working
**Attention** This is a public forum