![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | Thread Tools | Display Modes |
| | (permalink) |
| Experienced Member | hey guys I'm using PIC16F877a...i'm connecting a DC motor on pin RC2/CCP1 (PWM) and getting the speed back from an optical interrupter on pin RC1/CCP2 (capture mode)...I'm using a 4 MHz crystal I'm letting CCP2 generating an interrupt every 16th rising edge, then i display the values of CCPR1L and CCPR1H on LCD I want to know how can i calculate this value to be the RPM of the motor?? I know how to calculate the period of the signal,but what next?? Thank you guys for ur help |
| | |
| | (permalink) |
| Super Moderator | It's simple maths, dividing 1 by the time taken per revolution gives you revs per second, you then multiply that by 60 to give RPM. I've shown that as two steps, but in practice you would do it in a single step. Presume one revolution takes 10mS (0.01 seconds), you simply divide 60 by 0.01 to give 6000 RPM. If you have more than one pulse per revolution, you just alter the top value accordingly - so if you had two pulses per revolution then you would divide into 30 instead of 60. |
| | |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |