Hi, I'm tring to use the RTC module on the KL25Z, and I began with the instructions on this page: Using RTC module on FRDM-KL25Z . I have already configured the RTC_LDD component and the clock settings, and now I have to write the C code. There's a fuction in the code example of this post that I didn't totaly understand:
void RTC_isr_Seconds(void)
{
interrupt = 1;
seconds = RTC_TSR;
if (seconds >59){
minutes++;
RTC_SR &= ~RTC_SR_TCE_MASK;
RTC_TSR = 0x00; //Reset counter
seconds = RTC_TSR;
RTC_SR |= RTC_SR_TCE_MASK;
}
}
What are these RTC_TSR and RTC_SR? Where did they come from? I didn't understand why "seconds" is equal to RTC_TSR, and neither any of the last four lines.
Also, he doesn't even seems to use the "GetTime" method. Why? How is he getting the time, then?
And last but not least, this is the function executed when the interrupt occurs, right? Is it automatically created or I must write it myself (or even something different of both)?
Could anybody help me on this, please?
Vítor Pereira