Confirm calculations - please someone !
Posted: Mon Mar 15, 2010 9:33 am
I have made a program for RPM and COUNTING revolutions with 4 digits LED.
The RB0INT is counting incomming pulses and is used in both parts - in the RPM part it counts for a periode of time by TRM0 and a prolonging variable - RPMUpdateInit.
In the counting part of it I have some problems in the HW witch I'll have to investigate more - so never mind that for now.
In the RPM, I count incomming pulses for a periode of time calculated like this:
RPM = InCommingPuls / PulsPrRevolution * 60 / ( 13 * RPMUpdateInit )
where I did these calculations on TMR0 interrupts:
External ressonator: 20 MHz
System clock: 5 MHz
Prescaler 256 19531,25 Hz
Overflow at 256: 76,29394531 Hz
Counting periode: 13,1072 mSec INT_TMR0
with these numbers I try to investegate my "limits" = MAX RPM I can measure:
InCommingPuls 32767 because it's an INT
PulsPrRevolution 1 in the first place just 1
RPMUpdateInit 15 If I want a longer 'Counting periode' for more stable display
Counting periode 196,608 mSec
RPM calculates to 10000
With my 4 digits I can measure max 9999 with 1 pulse pr revolution.
Unfortunately I have 80 pulses pr revolution on my lathe and this gives this calculation:
InCommingPuls 32767 because it's an INT
PulsPrRevolution 80 on my lathe
RPMUpdateInit 15 If I want a longer 'Counting periode' for more stable display
Counting periode 196,608 mSec
RPM calculates to 125 !!!!!!!!!!
Then I can measure max 125 RPM and that's NOT god !
I maybe then HAVE to shorten my "counting periode", but it's can't do it and I think the "error reading" becomes bigger this way - right ?
Is my calculations correct ?
How should I else do it to measure max 9999 RPM ?
The RB0INT is counting incomming pulses and is used in both parts - in the RPM part it counts for a periode of time by TRM0 and a prolonging variable - RPMUpdateInit.
In the counting part of it I have some problems in the HW witch I'll have to investigate more - so never mind that for now.
In the RPM, I count incomming pulses for a periode of time calculated like this:
RPM = InCommingPuls / PulsPrRevolution * 60 / ( 13 * RPMUpdateInit )
where I did these calculations on TMR0 interrupts:
External ressonator: 20 MHz
System clock: 5 MHz
Prescaler 256 19531,25 Hz
Overflow at 256: 76,29394531 Hz
Counting periode: 13,1072 mSec INT_TMR0
with these numbers I try to investegate my "limits" = MAX RPM I can measure:
InCommingPuls 32767 because it's an INT
PulsPrRevolution 1 in the first place just 1
RPMUpdateInit 15 If I want a longer 'Counting periode' for more stable display
Counting periode 196,608 mSec
RPM calculates to 10000
With my 4 digits I can measure max 9999 with 1 pulse pr revolution.
Unfortunately I have 80 pulses pr revolution on my lathe and this gives this calculation:
InCommingPuls 32767 because it's an INT
PulsPrRevolution 80 on my lathe
RPMUpdateInit 15 If I want a longer 'Counting periode' for more stable display
Counting periode 196,608 mSec
RPM calculates to 125 !!!!!!!!!!
Then I can measure max 125 RPM and that's NOT god !
I maybe then HAVE to shorten my "counting periode", but it's can't do it and I think the "error reading" becomes bigger this way - right ?
Is my calculations correct ?
How should I else do it to measure max 9999 RPM ?