Calculate timers interval on BASYS MX3 board

  c++, embedded, timer

I am a software engineer student, and I learn to program on BASYS MX3 board using embedded c++ programing language.

My teacher taught how to use the timers on the board and how to define their priority and interval.

My problem is that the interval calculation he showed doesn’t make sense and I get completely different values from what the he shows (He refuses to calculate it in class for some reason, he just shows the formula and the result).

The formula is: f=crystal frequency/div/prescaler/pr, t=1/f

Where: f – is the timer frequency, crystal frequency is 80M, prescaler=256 and pr is the value I want to find.

For example, he showed us that PR1 = 0xffff, suppose to be 1ms interval but when I put it in the above formula I get a value of 1.67 seconds

My question is, does anyone knows the correct formula¿ Or at least what am I calculating wrong¿

Thanks in advance ☺

Source: Windows Questions C++

LEAVE A COMMENT