原帖由 benni 于 2012-7-10 10:32 发表
include unsigned int flag = 0;void main(){ WDTCTL = WDTPW +WDTHOLD; //STOP WDT // FLL_CTL0 |= XCAP14PF; //匹配14PF的负载电容 P1 ...
目测你没有设置TA的计数模式~
#include <msp430g2553.h>
void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT P1DIR |= BIT0; // P1.0 output CCTL0 = CCIE; // CCR0 interrupt enabled CCR0 = 50000; TACTL = TASSEL1 + TACLR + MC_2; //TACTL = TASSEL_2 + MC_2; // SMCLK, contmode
_BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt }
// Timer A0 interrupt service routine #pragma vector=TIMER0_A0_VECTOR __interrupt void Timer_A (void) { P1OUT ^= BIT0; // Toggle P1.0 CCR0 += 50000; // Add Offset to CCR0 } |