你(们)好
我有另一个关于计时器的问题。
我将 CCR0设置为239、但计时器似乎会启动 223个时钟周期、有些时钟周期会启动240个时钟周期。
我如何才能在每次计时器启动时都保持一致的时钟周期。
(我还确保没有其他服务例程中断计时器)
谢谢
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector = TIMER0_B0_VECTOR
__interrupt void TIMER0_B0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_B0_VECTOR))) TIMER0_B0_ISR (void)
#else
#error Compiler not supported!
#endif
{
delta[count] = RTCCNT - pre_rtc;
pre_rtc = RTCCNT;
count++;
if (count>=120)
{
HWREG16(TIMER_B0_BASE + OFS_TBxCTL) &= ~MC;
// process data
HWREG16(TIMER_B0_BASE + OFS_TBxCTL) |= MC__UP;
}
}

