Part Number: MSP430G2553
Hello,
I made a project that used the DCO and a timer interrupt with LPM3 that worked fine. Now I am trying to do the same just with the VLOCLK and I simply cannot get it to work. Reason why the VLOCLK is because I don't need a lot of calculating power when awake and the device is usually in LPM4 with button interrupts (not in the code) and it only runns on a CR2032 and should last as long as possible. The interrupt does not fire. I tested the clock and it had about 10 KHZ which seems correct for the VLOCLK (although the range that is specified from 4 to 20 KHz seems rediculous).
#include <msp430.h>
void sleep_ms()
{
TACTL = (TASSEL1 | TACLR | TAIE);
CCTL0 = CCIE;
CCR0 = 0;
TACCR0 = 3;
TACTL |= MC_1;
__bis_SR_register(LPM3_bits | GIE);
}
int main(void)
{
WDTCTL = WDTPW | WDTHOLD;
P1OUT = 0x00;
P1DIR = 0xFF;
P2OUT = 0x00;
P2DIR = 0xFF;
P3OUT = 0x00;
P3DIR = 0xFF;
//P1SEL = BIT0 // to test the frequency
BCSCTL3 |= LFXT1S_2;
//_bis_SR_register(SCG1 | SCG0);
_NOP();
_NOP();
_NOP();
BCSCTL2 |= SELM_3 + DIVM_3;
IFG1 &= ~OFIFG;
__enable_interrupt();
while(1)
{
P1OUT |= 0x02;
sleep_ms();
P1OUT &= ~0x02;
sleep_ms();
}
}
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A (void)
{
LPM3_EXIT;
TACTL = 0;
CCTL0 = 0;
}
So what am I missing? I simply don't see anymore what is going on.
Thanks for any tip.