How many ticks are required to count the following revolution per minute?

72 Views Asked by At

The timer in my micro-controller is running at 25Mhz. I need to program the hardware timer such that it counts for 6400 rpm. This means 6400 times on bit '1' in 60 seconds. So in 1 seconds it is 1 seconds 6400/60 rotations. Now, I want to achieve this so that hardware timer has 6400/60 times bit 1 in 1 seconds. Thus, the timer should count till 6400/60 if the timer was running at 1 Hz. However, the timer is running at 25 * 10^6 Hz .How can I count 6400/60 here. If I calculate it comes to 6400 * 25 * 10^6 /60 which is a very high value. I cannot program this value on to my hardware timer register. Is my logic correct? Can you please help me on the reasoning here.

1

There are 1 best solutions below

4
On

You have $6400\frac{round}{minute}=6400\frac{round}{60\ seconds}$. These has to be produced by $25\cdot 10^6\frac{round}{second}$. Then you must divide the micro-controller $\frac{round}{second}$ figure into $\frac{6400}{60}\frac{round}{second}$ equal parts. This makes $$ \text{tick-interval}=\frac{60\cdot 25\cdot 10^6}{6400}=234,375 $$ That's it.


To verify the answer, we have found that the micro-controller runs $$ 60\cdot 25\cdot 10^6=1,500,000,000\text{ cycles pr. minute} $$ and in steps of $234,375\text{ cycles}$ we see that $6400$ counts make $$ 6400\cdot 234,375=1,500,000,000\text{ cycles} $$ thus lasting exactly one minute.