本人没有弄明白,来这找答案,使用定时器定时,使用连续计数模式,从0计数到65535,书上说到65535后中断标志TAIFG置位,为什么中断里面不需要清除??
void TimerA1Init( void )
{
TA1CTL = TASSEL_2 + MC_2 + ID_3; // Timer_A1: Continous mode, SMCLK, clock source divided by 8 = 8MHz/8 =1MHz
TA1CCR1 = TIMEA1_TIME_CONSTANT; // 10 ms compare interrupt as key scanf
TA1CCTL1 = CCIE;
TA1CTL |= TAIE; //interrupt enable
}
#pragma vector=TIMER1_A1_VECTOR
__interrupt void TIMER1_A1_ISR(void)
{
uint8_t ucKeyValue;
switch(__even_in_range(TA1IV,14))
{
case 0: break; // No interrupt
case 2:
TA1CCR1 += TIMEA1_TIME_CONSTANT; // timer 10ms
下面其他的函数...........
|