Pages: 1 [2]   Go Down
Author Topic: Frequency / period counter  (Read 8002 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Offline Offline
Shannon Member
Karma: 223
Posts: 13876
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

is there any way with this library to get Hertz in a decimal?
I need accuracy up to about 850Hz, to calculate engine RPM.
Having hertz only as a whole number is reducing the accuracy.

change the freq to be float iso long wouyld be the first step ...

Rob Tillaart

Nederlandse sectie -,77.0.html -
(Please do not PM for private consultancy)

Newcastle, NSW, Australia
Offline Offline
Karma: 0
Posts: 33
Just a mechanic
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there a way to run 2 instances of this counter at once?
I need to measure 2 discreet frequencies.
One can be an interrupt, the other would have to be with polling (as my other interrupt pin is doing another job in this project).

I try and compile with;

FreqPeriodCounter counter(counterPin, micros, 0);
FreqPeriodCounter counter2(shaftPin, micros, 0);

but it throws up errors as all the variables (counter.hertz, counter.period etc etc) are being defined twice.

Can I copy the library files to another one, call it FreqPeriodCounter2, and add a 2 to all the variable names? Would that work??

Pages: 1 [2]   Go Up
Jump to: