Searching \ for 'maths for tachometers' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/method/math.htm?key=math
Search entire site for: 'maths for tachometers'.

Truncated match.
PICList Thread
'maths for tachometers'
1996\11\14@102535 by Stuart Taylor

flavicon
face
Hi

I recently mailed a couple of people with some tachometer code which I
did for a 16C71 and then a 16C84, but I explained the maths wrongly and
I've forgotten who they were.

I also then sent this to listserv instead of piclist (perhaps I should
go and lie down for the rest of the day)

Here's the correct version.

Based on a 16 MHz clock, the timer is allowed to free run at fosc / 4,
interrupting after every 256 cycles. A 24 bit counter is incremented
at each interrupt.

The external interrupt is used to provide the pulse from the ignition coil.

The time between each timer interrupt is 256 / (16000000 / 4) seconds.

The time between each external interrupt is (256 * count) / (16000000 / 4).

The number of interrupts per second is (16000000 / 4) / (256 * count).

The rpm value is (60 * 16000000 / 4) / (256 * count).

ie rpm = 937500 / count (0xe4e1c / count).

The 24 bit maths required is just an extension of the 16 bit maths found
in the Embedded Control Systems Handbook. It might be slow in some
applications but I had plenty of time available.

I used the prescaler to change the timer interrupt rate for 4/6/8 cyclinder
cars.

Using a different clock just requires a different numbers.

Hope this is of use

Cheers

Stuart Taylor

More... (looser matching)
- Last day of these posts
- In 1996 , 1997 only
- Today
- New search...