Hi,
I'm having a problem getting the Watchdog interval timer ISR to work while keeping the CPU clock running.
I'm using a msp430g2231 on the Launchpad and compiling using mspgcc
Here's my code:
////////////////////////////////////////////////
#include <msp430.h>
#include<signal.h>
#include "msp430g2231.h"
/*WDT interval timer- code based on msp430 examples*/
//compiler=mspgcc
void main(void) {
P1DIR |=BIT0; // Set the Launchpad redled P1.0 as an output pin
//BCSCTL3 = LFXT1S_2; // use the VLO for ACLK
WDTCTL = (WDTPW+WDTTMSEL+WDTCNTCL); // setup watchdog register as interval timer (same as WDT_MDLY_32)
IE1 |= WDTIE; //enable watchdog interrupt
_BIS_SR(LPM0_bits + GIE); //set LPM0 mode and enable interrupts **** WORKS ****
//_BIS_SR(GIE); //keep cpu running and enable interrupts **** DOES NOT WORK ****
}//end of main
//interrupt service routine
interrupt(WDT_VECTOR) watchdog_timer(void)
{
P1OUT ^= BIT0;
}//end of interrupt
////////////////////////////////////////////////////
The line
_BIS_SR(LPM0_bits + GIE);
works, the interval timer runs and the correctly, but it shuts off the cpu and I want to keep the main cpu running and do other stuff
So if I use
_BIS_SR(GIE);
The interval timer fails to run.
I tried resetting the interrupt flag inside the ISR with
IFG1 &= ~WDTIFG;
But that didn't help.
I couldn't find any reference to this behavior in the documents.
Does anyone know how can I run the watchdog interval timer with the CPU clock still running?
cheers
-mpymike