Part Number: MSP430F413
hi,Msp430F413 work with 32KHZ, use the watchdog timer time work, program debugging found, each time the frequency is sometimes different, there are two cases, 10 times there are 2 times, the frequency is about 2/1. Don't know what's the reason? Is it wrong to set up 32KHZ, or is it any other reason? Part of the program see the following, thank you!
PS: The program is modified under the fet410_wdt_02 sample of MSP430x41x.
The program is modified under the fet410_wdt_02 sample of MSP430x41x.
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; //
FLL_CTL0 |= XCAP18PF; // Set load cap for 32k xtal
DelayMS(1000);//100MS
P2OUT = 0xff; // led1-led8
P2DIR = 0xff; //
P6OUT = 0xff; // led9-led16
P6DIR = 0xff; //
P5OUT = 0x20; /
//,,,,, Other IO port initialization
Play(90);
WDTCTL = WDT_ADLY_250; // WDT 250ms, ACLK, interval timer
IE1 |= WDTIE; // Enable WDT interrupt
__bis_SR_register(LPM3_bits + GIE); // Enter LPM3 w/interrupt
}
// Watchdog Timer interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=WDT_VECTOR
__interrupt void watchdog_timer(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(WDT_VECTOR))) watchdog_timer (void)
#else
#error Compiler not supported!
#endif
{
unsigned int j;
FLL_CTL0 |= XCAP18PF; // Set load cap for 32k xtal
DelayUS(50);
JS++;
if(JS==120) //
{
P1OUT&=~0x20; //
}
if(JS==121)
{
P1OUT|=0x20; //
JS=0;
}
JS=0;//
P5OUT&=~0x01; //
WDTCTL = WDT_ADLY_250; // WDT 250ms, ACLK, interval timer
}//P3,P4
}