This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Timer_A在增/减计数模式下的CCR1和CCR2中断

Other Parts Discussed in Thread: MSP430G2553

Timer_A在增/减计数模式下的CCR1和CCR2中断无法正常运行,我使用CCR0控制了周期,在中断中想实现P1.0取反操作,下面是代码:

#include <msp430g2553.h>
#include <intrinsics.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // 关闭看门狗定时器
P1DIR |= BIT0; //P1.0输出
TA1CCR0=128; //定时周期
TA1CCTL1 = CCIE; // CCR0 CCR1中断使能
TA1CCTL2 = CCIE;
TA1CCR1=32;
TA1CCR2=64;
TA1CTL = TASSEL_1 + MC_3 +TACLR; // ACLK, up-down 模式
__bis_SR_register(LPM3_bits + GIE); // 进入低功耗模式,使能全局中断
}


#pragma vector=TIMER1_A1_VECTOR
__interrupt void Timer_A1(void)
{
switch( TA1IV )
{
case 2: P1OUT |= 0x01;
break;
case 4: P1OUT &= 0xfe;
break;
case 10:
break;
}
}

感觉结果是进入CCR1中断之后就无法退出中断返回主函数,这是什么原因呢?