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.
我想用F28027的CPU Timer做一个计时,由外部中断控制计时开始和停止。每次中断后,希望重新开始计数,就是清除当前计数器的计数值,重新载入初始值,我看了一下,这个函数TIMER_reload(),可以自动重新载入初始值,可是为什么我调用了之后,不能在进入中断后就立即载入初始值,貌似要等到当前周期计数完成,才能载入。。。难道是芯片本身决定的,还是我没有配置好?
你好,Shunli
F28xx系列的Timer都是在完成一整个计数周期之后,才会重新对新的初始值进行载入,这是芯片本身决定的。
想请教一下,你所提到的TIMER_reload()这个函数的定义是在哪里?
timer.c中的TIMER_reload()函数中写:
// clear the bits
timer->TCR &= (~(uint32_t)TIMER_TCR_TRB_BITS);
TRB:
CPU-Timer Reload bit.
0 The TRB bit is always read as zero. Writes of 0 are ignored.
1 When you write a 1 to TRB, the TIMH:TIM is loaded with the value in the PRDH:PRD,
and the prescaler counter (PSCH:PSC) is loaded with the value in the timer dividedown
register (TDDRH:TDDR).
置一才reload,所以例程函数写错了。