在设置TimerA 中选用了SMCLK作为时钟源。在配置SMCLK使用dco作为源时好像不成功,程序无法运行,大虾们给看看!
另:SMCLK使用VLOCLK或者REFOCLK时没问题。
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P2DIR |= 0xC0; // P1.0 output
//UCSCTL4 = UCSCTL4&(~(SELS_7|SELM_7))|SELS_1|SELM_1; //将SMCLK和MCLK配置为VLOCLK
//UCSCTL3 = SELREF_2;
UCSCTL4 = SELS_4; //将SMCLK配置为DCOCKDIV
TA1CCTL0 = CCIE; // CCR0 interrupt enabled
TA1CCR0 = 50000;
TA1CTL = TASSEL_2 + MC_2 + TACLR; // SMCLK, contmode, clear TAR
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, enable interrupts
__no_operation(); // For debugger
}
// Timer A0 interrupt service routine
#pragma vector=TIMER1_A0_VECTOR
__interrupt void TIMER1_A0_ISR(void)
{
P2OUT ^= 0xC0; // Toggle P1.0
TA1CCR0 += 50000; // Add Offset to CCR0
}
|