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_setPreScaler问题



C2000 launchpad CCS v5

运行Example_F2802xCpuTimer例程

例程中都未对定时器进行分频

但我把例程中分频系数改为非零值后,并未得到分频的效果

调试窗口截图如下:

TIMER0TPR与TIMER0TPRH值仍为0

timer.c中TIMER_setPreScale定义如下:

void TIMER_setPreScaler(TIMER_Handle timerHandle, 

const uint16_t preScaler)
{
TIMER_Obj *timer = (TIMER_Obj *)timerHandle;


// set the bits
timer->TPR |=
((uint32_t)(preScaler & 0xFF00) << 16) | ((uint32_t)(preScaler & 0x00FF) << 8);

return;
} // end of TIMER_setPreScaler() function

是否这个函数的移位值有误?

若preScaler=0x1111,则按函数定义

分频系数被写入PSCH和PSC,而不是TDDRH和TDDR。

例程中只include了timer.h文件而没有timer.c文件,如果我想修改timer.c文件中的TIMER_setPreScaler函数,应该怎么做?

谢谢