PaulStoffregen / FreqCount

Measures the frequency of a signal by counting the number of pulses during a fixed time.
http://www.pjrc.com/teensy/td_libs_FreqCount.html
145 stars 48 forks source link

Adding support for Adafruit ProTrinket 3V, which runs at 12MHz #5

Closed LieBtrau closed 8 years ago

LieBtrau commented 8 years ago

The ProTrinket 3V runs at 12MHz, so there's no simple factor 2 division possible downto 1KHz for millisecond interval. This leads to Timer2 intervals that are not milliseconds or multiples thereof. The workaround is to correct the count value by multiplying with a floating point correction factor before returning the count value to the user code. I checked the result with a Philips PM6665 Timer/Counter.

Signed-off-by: Christoph Tack prog.send@gmail.com

PaulStoffregen commented 8 years ago

I've added a slight extra check, just in case we ever have another non-AVR board at 12 MHz. https://github.com/PaulStoffregen/FreqCount/commit/8dbce069a983c8ecb70a9464701e3712ea438428

LieBtrau commented 7 years ago

Ok, I guess you can close this one then.