我的定时器进不了中断,定时器的TA1CCTL0是1049,发现CCIE为置1使能了,中断标志位CCIFG也置1了,但是就是进不了中断,用的是MSP430g2553单片机
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.
我的定时器进不了中断,定时器的TA1CCTL0是1049,发现CCIE为置1使能了,中断标志位CCIFG也置1了,但是就是进不了中断,用的是MSP430g2553单片机
tesla nigus, 你先使用下面程序测试一下,看看timer可否正常工作。
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= 0x01; // P1.0 output
CCTL0 = CCIE; // CCR0 interrupt enabled
CCR0 = 50000;
TACTL = TASSEL_2 + MC_1; // SMCLK, upmode
_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 ^= 0x01; // Toggle P1.0
}
请确认这几个条件:中断模块配置是否正确,全局中断是否打开。中断向量是否正确,中断函数是否正确返回。