Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Advice on measuring RPMS

Status
Not open for further replies.

sensimila

New Member
HI all,

Im working on practice exams for my final which is next week but in doing so, came across a problem i wasnt able to solve. Any advice is highly appreciated. The question is as follows.

You have an embedded system using a mcu with an 8-bit count-up timer. You also have an external sensor which monitors the revolutions of a motor and generates an interrupt once per revolution. The timer which ticks at a 100khz rate doesnt generate interrupts. The timer sets a flag (roll) when it rolls over and this must be manually reset. The question is how can the isr calculate the motor RPM and whats the minimum value that can be calculated.

I have not been able to solve this question. Any help is highly appreciated. Thanks!
 
You set the timer to 0 on a revolution interrupt. On the next revolution interrupt you read the value of the time and check the rollover flag.
Your range of values for the revolution time is 0 to 511 times 10 microseconds, or zero to 5.11 milliseconds.

This corresponds to speeds greater than 195.69 Revolutions per second or about 11,742 RPM. That's moving right along!
 
that solution presumes the timer hasn't rolled over more than once which there is no way of knowing. You can only reliably report a period of 2.55 mS and twice the frequency. of course, I am assuming that the timer keeps counting after the roll-over.

That is one braindead microcontroller.

I think you can do better by polling the timer for rollover and keep track of the number of times. first int starts the process (clears tick flag, starts timer). mainline polls roll-over flag, counting rollovers and reseting the flag. next int reads timer partial and puts it together with rollover count to get the rotational period in 10 uS units. frequency is the inverse. You uipdate what needs to be updated (display, whatever) and then wait for the next interrupt to start to process all over again.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top