Thanks Leigh,
I think this should work for you, for now. Change the T1CON assignment to:
T1CON = %00100000 ' TMR1 prescale=1:4 Timer OFF
And, use this formula:
period = period / 2
RPM = 10000
RPM = RPM * RPM ' 100,000,000
RPM = DIV32 period ' 100,000,000 / RevCount
RPM = RPM * 60 ' Per minute
RPM = DIV32 400
Also, for the lookup to the nearest 100 RPM, you might consider this:
Nearest = RPM / 100
if RPM DIG 1 > 5 then Nearest = Nearest + 1
Nearest = Nearest * 100
Hope this works for you.
Darrel
Bookmarks