EmbeddedRelated.com
Forums

LMP mode and RTC

Started by Unknown December 1, 2004
Hi All,

 

Can anyone tell me if it's possible to put the mcu in sleep and wake up
after my timerA0 has occured.

 

Here's part of my code. But the MCU never wakes shows me the time what am I
missing??

 

int main(void) 

{

  // Stop watchdog.

  WDTCTL = WDTPW + WDTHOLD;

  _DINT();

  

    rtcInit();

    PCD8544_init();

  _EINT();

  

  PCD8544_gotoxy(0,0);  printf("It's a clock");

 

  /* put MCU in sleep and wake up every sec after time update occured. */

  while (1) 

  {                         //main loop, never ends...

    LPM0;                 //sync, wakeup by irq

    ShowTime();

  }

}

 

 

// Timer A0 interrupt service routine

void rtcService(void) __interrupt[TIMERA0_VECTOR]

{

            timer++;

}

 

 

met vriendelijke groet,

Martijn Broens

 

 

mBedit

Golden Deliciousstraat 40

6679 BL  Oosterhout-Nijmegen

0642 703 502

martijn@mart...

 

 






Beginning Microcontrollers with the MSP430

Your interrupt MUST exit from LPM0 before exiting the interrupt, 
otherwise when the status register is fetched from the stack the micro 
will go straight back to sleep.

Al

martijnbroens@mart... wrote:

> Hi All,
> 
>  
> 
> Can anyone tell me if it's possible to put the mcu in sleep and wake
up
> after my timerA0 has occured.
> 
>  
> 
> Here's part of my code. But the MCU never wakes shows me the time what
am I
> missing??
> 
>  
> 
> int main(void) 
> 
> {
> 
>   // Stop watchdog.
> 
>   WDTCTL = WDTPW + WDTHOLD;
> 
>   _DINT();
> 
>   
> 
>     rtcInit();
> 
>     PCD8544_init();
> 
>   _EINT();
> 
>   
> 
>   PCD8544_gotoxy(0,0);  printf("It's a clock");
> 
>  
> 
>   /* put MCU in sleep and wake up every sec after time update occured. */
> 
>   while (1) 
> 
>   {                         //main loop, never ends...
> 
>     LPM0;                 //sync, wakeup by irq
> 
>     ShowTime();
> 
>   }
> 
> }
> 
>  
> 
>  
> 
> // Timer A0 interrupt service routine
> 
> void rtcService(void) __interrupt[TIMERA0_VECTOR]
> 
> {
> 
>             timer++;
> 
> }
> 
>  
> 
>  
> 
> met vriendelijke groet,
> 
> Martijn Broens
> 
>  
> 
>  
> 
> mBedit
> 
> Golden Deliciousstraat 40
> 
> 6679 BL  Oosterhout-Nijmegen
> 
> 0642 703 502
> 
> martijn@mart...
> 
>  
> 
>  
> 
> 
> 
> 
> 
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 


Hi,

does your compiler support a macro like this one? 
_BIC_SR_IRQ(LPM0_bits)

This macro must be called in the interrupt function that the interrupt
function returns to main in active mode.

Regards
Stefan
 


-----Ursprgliche Nachricht-----
Von: martijnbroens@mart... [mailto:martijnbroens@mart...]
Gesendet am: Mittwoch, 1. Dezember 2004 22:35
An: msp430@msp4...
Betreff: [msp430] LMP mode and RTC


Hi All,

 

Can anyone tell me if it's possible to put the mcu in sleep and wake up
after my timerA0 has occured.

 

Here's part of my code. But the MCU never wakes shows me the time what am I
missing??

 

int main(void) 

{

  // Stop watchdog.

  WDTCTL = WDTPW + WDTHOLD;

  _DINT();

  

    rtcInit();

    PCD8544_init();

  _EINT();

  

  PCD8544_gotoxy(0,0);  printf("It's a clock");

 

  /* put MCU in sleep and wake up every sec after time update occured. */

  while (1) 

  {                         //main loop, never ends...

    LPM0;                 //sync, wakeup by irq

    ShowTime();

  }

}

 

 

// Timer A0 interrupt service routine

void rtcService(void) __interrupt[TIMERA0_VECTOR]

{

            timer++;

}

 

 

met vriendelijke groet,

Martijn Broens

 

 

mBedit

Golden Deliciousstraat 40

6679 BL  Oosterhout-Nijmegen

0642 703 502

martijn@mart...

 

 








.

 
Yahoo! Groups Links



 



Thanks al,

 

I'll try it

 

  _____  

From: onestone [mailto:onestone@ones...] 
Sent: donderdag 2 december 2004 2:38
To: msp430@msp4...
Subject: Re: [msp430] LMP mode and RTC

 

Your interrupt MUST exit from LPM0 before exiting the interrupt, 
otherwise when the status register is fetched from the stack the micro 
will go straight back to sleep.

Al

martijnbroens@mart... wrote:

> Hi All,
> 
>  
> 
> Can anyone tell me if it's possible to put the mcu in sleep and wake
up
> after my timerA0 has occured.
> 
>  
> 
> Here's part of my code. But the MCU never wakes shows me the time what
am
I
> missing??
> 
>  
> 
> int main(void) 
> 
> {
> 
>   // Stop watchdog.
> 
>   WDTCTL = WDTPW + WDTHOLD;
> 
>   _DINT();
> 
>   
> 
>     rtcInit();
> 
>     PCD8544_init();
> 
>   _EINT();
> 
>   
> 
>   PCD8544_gotoxy(0,0);  printf("It's a clock");
> 
>  
> 
>   /* put MCU in sleep and wake up every sec after time update occured. */
> 
>   while (1) 
> 
>   {                         //main loop, never ends...
> 
>     LPM0;                 //sync, wakeup by irq
> 
>     ShowTime();
> 
>   }
> 
> }
> 
>  
> 
>  
> 
> // Timer A0 interrupt service routine
> 
> void rtcService(void) __interrupt[TIMERA0_VECTOR]
> 
> {
> 
>             timer++;
> 
> }
> 
>  
> 
>  
> 
> met vriendelijke groet,
> 
> Martijn Broens
> 
>  
> 
>  
> 
> mBedit
> 
> Golden Deliciousstraat 40
> 
> 6679 BL  Oosterhout-Nijmegen
> 
> 0642 703 502
> 
> martijn@mart...
> 
>  
> 
>  
> 
> 
> 
> 
> 
> 
> 
> 
> .
> 
>  
> >  Terms of Service.