Jorge Miguel Dhios

Using RTC in MC9S08SH8 microcontroller to make a Clock Hour

Discussion created by Jorge Miguel Dhios on Nov 24, 2010
Latest reply on Apr 10, 2013 by bigmac

Hi all,   I'm using a Mc908SH8, and I have a issue with the RTC module that  count days, and I have an ERROR of 1 hour  y 1 day. I need please an example to correct this error.

 

I have use this register initialization.

   RTCSC    = 0x1F;

   RTCMOD   = 0x00;

 

The interrupt routine:

 

interrupt void isrRTClk(void){         // RTC interrupt one per second

   RTCSC |= 0x80;

   Seconds++;

   if(Seconds > 59){

      Minutes++; Seconds = 0; 

      if(Minutes > 59){

         Hours++; Minutes = 0;

         if(Hours > 23) Hours = 0;

      } 

   }

}

 

Thanks, and regards

Jorge  

Outcomes