I/O系统,计算周期寄存器和一个预分频值

I/O Systems, calculate period register and a prescale value

问题是:

Consider a 16-bit timer that has seven prescaling options: 1:64, 1:32, 1:16, 1:8, 1:4, 1:2, 1:1. The timer is clocked at a frequency of 50 Mhz. Assume further that the timer is configured to trigger an interrupt. Decide on a value for the period register and a prescale value such that the interrupt is triggered every 20 ms.

我的答案是:周期寄存器值 125000 和预分频值 1:8

peruid 寄存器值是正确的,但他们说的预分频值:

"The period value does not fit in the period register".

这是什么意思,我怎么看?

来自你的引述:... a 16-bit timer ...
显然 16 位寄存器不能保存 125000 的值。

您至少需要 1:16

的预分频器

数学:

period * (freq / prescaler) = timer-value

您必须从可能的值中选择预分频器值,以便定时器值在 16 位范围内