Hello Sloth,
Sloth>>Hi, I'm having some trouble reading rotations per minute (RPM) and I was wondering if somone has an example on a capture code. I want it to read the time between 2 pulses in seconds and get the result divided by 60 (seconds per minute). <<
There are a couple of problems with your question...
1. What are you trying to read??? RPM of a Car engine?
2. What chip are you using?
3. Do you have example Code?
4. A more detailed explanaition is MUCH better.
I am going to assume that you are measuring something like a car motor, or something that gives you "Pulses" for each revolution.
First, there is a Pulsein command
Pulsein PinX, 0, Lengthofpulse.
Pulsein PinX, 1, Lengthofpulse.
Both of these statements measure the width of a pulse... whether that pulse is high or low...
With Lengthofpulse, you can calculate your RPM, RPS (per second) or whatever.
If you have a 4 mhz chrystal, (or use a internal clock) your Lengthofpulse will be in 10us increments. that is 1/100,000 of a second.
Thus a return of 1500 will mean 15,000us, which is 15/1000 of a second. Which equates to 67 RPS or 4020 RPM.
Now, if I didn't error on my math (which happens) your project may look something like the above. But please give a more detailed description...We are totally clueless on what you want.
Dwayne
Ability to Fly:
Hurling yourself towards the ground, and missing.
Engineers that Contribute to flying:
Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute
Pilots that are Flying:
Those who know their limitations, and respect the green side of the grass...
Bookmarks