??? 09/06/05 18:16 Read: times |
#100708 - Measuring RPM - the software side Responding to: ???'s previous message |
Measuring RPM often requires two asynchronous processes.
One is the interrupt that occurs every time the magnet passes the sensor and triggers the INT. The time from the last occurrence tells you the RPM of course, but you also need to support the worst-case condition (which will happen) when the RPM is slow or the rotation stops. This will overflow your timer in all likelihood (so you need to monitor timer overflows too). Anyway, every time you get an interrupt you can calculate the RPM and store it in some RAM location. Better yet, store the timer count in the RAM location, set a flag and do the actual RPM calculation in main where the flag is sensed (being aware of problems that can occur by having a variable shared between an ISR and main). The second issue is how often you want to update the display for the user (or log it to a data set). This is often based on completely different criteria such as how often you do an LCD refresh or how often you log to your data set. You may have a 1:1 correspondence between RPM changes and display update, or you may not. Typically the RPM would be unreadable on a digital display if it changes too often. Food for thought... GB |
Topic | Author | Date |
Triggering Hall Effect sensors | 01/01/70 00:00 | |
Comparator | 01/01/70 00:00 | |
Analog output? | 01/01/70 00:00 | |
Nope. | 01/01/70 00:00 | |
Little magnets | 01/01/70 00:00 | |
Wow ! | 01/01/70 00:00 | |
Nice link | 01/01/70 00:00 | |
bar magnets? | 01/01/70 00:00 | |
bar magnets | 01/01/70 00:00 | |
Got the point, | 01/01/70 00:00 | |
The earth magnetism | 01/01/70 00:00 | |
Made it work ! | 01/01/70 00:00 | |
BLDC motor, Gear tooth sensor, etc | 01/01/70 00:00 | |
Geartooth sensors good ;) | 01/01/70 00:00 | |
Analog output? | 01/01/70 00:00 | |
speaker magnets | 01/01/70 00:00 | |
Ditto that | 01/01/70 00:00 | |
Flux | 01/01/70 00:00 | |
C like motor magnets | 01/01/70 00:00 | |
Open-Collector output | 01/01/70 00:00 | |
I did | 01/01/70 00:00 | |
How to attach more than one magnet | 01/01/70 00:00 | |
symmetric placement | 01/01/70 00:00 | |
photo coupler | 01/01/70 00:00 | |
Measuring RPM - the software side | 01/01/70 00:00 | |
Timing routines are alright | 01/01/70 00:00 | |
Unipolar vs bipolar sensors | 01/01/70 00:00 | |
try here | 01/01/70 00:00 | |
Thanks for your contribution erik![]() | 01/01/70 00:00 |