include <msp430g2231.h>
unsigned int flag = 0;
void main()
{
WDTCTL = WDTPW +WDTHOLD; //STOP WDT
// FLL_CTL0 |= XCAP14PF; //匹配14PF的负载电容
P1SEL &= ~BIT5;
P1DIR |= BIT5;
TACTL = TASSEL1 + TACLR ;
TACCTL0 = CCIE;
TACCR0 = 1748;
TACTL |= MC0;
_EINT();
while (1) { LPM0; }
}
# pragma vector = TIMERA0_VECTOR
__interrupt void TimerA0_ISR(void)
{
P1OUT ^= BIT5;
flag++;
}
我用flag作为标志,发现并没有进入中断,为什么啊?哪里错了?