Joseph Uhl Jr.

MC9S08QG8 Stop Mode 2, Exit with RTI -> How?

Discussion created by Joseph Uhl Jr. on Jun 13, 2006
Latest reply on Jun 30, 2006 by Joseph Uhl Jr.
Being new to this processor, I'm having trouble finding the correct way to enter/exit Stop Mode 2 from RTI.  Enter stop mode in main, then somehow exit in the RTI.  Below is minimal code to use to show an example....  I've enabled stop2 in SPMSC2= 0x03 and STOPE in SOPT1.  Any help would be appreciated.
 
void main(void)
{
   // Initialization
   MCU_init();
   
   // Enable Interrupts
   EnableInterrupts;
 
   // Background Loop
   while (1)
   {
           // Feed the dog
           __RESET_WATCHDOG();
       
           // check inputs
           CheckInputs(); 
 
           // Put into Stop Mode
           asm stop;    
   }
}
 
// RTI interrupt for Real Time Clock
void interrupt 23 RTI_Isr (void)
{
   // Acknowledges RTI Flag
   SRTISC_RTIACK = 1; 
  
   // Exit Stop Mode 2 here?
 
 
   // Time Keeping here
 
}
 

Outcomes