shiva prasad ellendula

problem i execting the  stop3 using RTC in MC9S08SH8

Discussion created by shiva prasad ellendula on Sep 4, 2010
Latest reply on Sep 10, 2010 by Thomas Walsh


i'm using RTC for waking the stop-3 mode. and i'm using MC9S08SH8 8-bit microcontroller in my application.

and the initialisations are:


#define   x   0x01

#define   y   0xFE




        for( ; ; )


                  RTCSC = 0x1F;  //1sec  1khz clock source is enabled.with RTIE enabled

                  if( Z & x)                //refer above for x


                               Z = Z  & y;    //refer above for y



                    __RESET_WATCHDOG(); /* feeds the dog */



void interrupt VectorNumber_Vtpm1ovf timerPWM(void)              //timer interrpt for 0.1sec

     PTAD_PTAD2 = ~ PTAD_PTAD2; //for checking purpose

     Z = 0x01;  



void interrupt VectorNumber_Vrtc  realtimeinterrupt(void)
      RTCSC_RTIF = 1; //for clearing RTIF flag.

      RTCSC_RTIE = 0;



In the above case, RTC not waking properly, and the two ISR's are not working exactly. so, please ttell me where the problem is occuring.i.e, when the stop instruction in the for loop is seen, it enter into stop and after one sec, RTC interrupt comes, because i uased 1KHz clock source. and the RTC interrupt flag clear , and after that bus_clock everything has to work normally but it is not going to timer PWM ISR immediately it is taking large time to go to timer interrupt. so, im thinking some wrong i'm making in the initialisation.

In case of enabling the RTC , initialisation is sufficient or anything has to be done. and 1KHz source can be used for RTC to wake from STOP-3 mode. and please provide the solution for the above problem as early as possible.