hello professors,
These days I met a problem when I configure the timer module in fg4619. here is the thing:
I initiate the Timer:
void Init_TIMERA0(void)
{
TA0CCR0 = 1000; //count limit (16 bit) 12000
TA0CCTL0 = CCIE; //enable counter interrupts, bit 4=1, TACCR0 interrupt enabled
TA0CTL = TASSEL_2 + MC_1; //SMCLK
}
#pragma vector = TIMER0_A0_VECTOR
__interrupt void Timer0_A0 (void)
{
milsec_rt++;
if(milsec_rt>999)
{
milsec_rt = 0;
timer++;
if(timer>59)
{
timer = 0;
}
}
asm("nop");
}
But the problem is every one second the millisec counter should be around 1000, cause the interrupt is called in every 1ms, but the millisec counter finished 3 or 4 times when the time goes into 1 second. I didnt find there is some mistakes in the configuration, TACCR0=1000. only when I change the number to 10000 to TACCR0, every one second the millisec runs to 800.... it is wierd also... could you give me some suggestion? thanks so much
Best Regards