AnsweredAssumed Answered

DEFINE AN RTC INTERRUP ROUTINE

Question asked by matias raimondo on Nov 26, 2014
Latest reply on Nov 27, 2014 by Hui_Ma

HI, I AM TRYING TO RUN A ROUTINE WITH THE RTC MODULE OF AN KE02P64. I LEARNED HOW TO DO IT ON A C9S08JM60, BUT IT SEEMS TO BE A LITTLE BIT DIFFERENT. THE EXAMPLE ON THE REFERENCE MANUAL IS:

 

/* Initialize the elapsed time counters */

Seconds = 0;

Minutes = 0;

Hours = 0;

Days=0;

/* Configure RTC to interrupt every 1 second from OSC (32.768KHz) clock source */

RTC_MOD = 511; // overflow every 32 times

RTC_SC = RTC_SC_RTCPS_MASK; // external 32768 clock selected with 1/64 predivider.

RTC_SC = RTC_SC_RTIF_MASK | RTC_SC_RTIE_MASK; // interrupt cleared and enabled

/**********************************************************************

Function Name : RTC_ISR

Notes : Interrupt service routine for RTC module.

**********************************************************************/

void RTC_ISR(void)

{

/* Clears the interrupt flag, RTIF, and interrupt request */

RTC_SC |= RTC_SC_RTIF_MASK;

/* RTC interrupts every 1 Second */

Seconds++;

/* 60 seconds in a minute */

if (Seconds > 59)

{

Minutes++;

Seconds = 0;

}

/* 60 minutes in an hour */

if (Minutes > 59)

{

Hours++;

Minutes = 0;

}

/* 24 hours in a day */

if (Hours > 23)

{

Days ++;

Hours = 0;

}}

 

I UNDERSTAND THE INITIALIZATION BUT I DO NOT KNOW HOW TO DEFINE THAT (IN THIS PARTICULAR CASE) THE void RTC_ISR(void) ROUTINE RUNS WHEN A RTC INTERRUP OCCURS.

I REMEMBER IN THE C9S08JM60 I DEFINE THE VECTOR FOR THE INTERRUPT. SHOULD I DO THE SAME IN THIS ONE?

ENGLISH IS NOT MY FIRST LANGUAGE, THANK YOU FOR UNDESTAND.

Outcomes