How to measure "Pulse Count" or "Frequency Count" using arduino by Technowave G

Опубликовано: 13 Январь 2019
на канале: Technowave G
1,994
11

Link :https://github.com/PaulStoffregen/Fre...

Frequency counters usually measure the number of cycles of oscillation, or pulses within a specific period of time (preset period known as the gate time).
It is important that the gate time is accurately generated.
This is done by having a highly accurate frequency source within the frequency counter.
Typically these will operate at a frequency of 16 MHz and this needs to be divided to give the required gate time.
Figures of 0.01, 0.1, 1, and 10 seconds may be selected.
The shorter times obviously enable the display to be refreshed more often, but against this the count accuracy is less.
The precisely timed gate enabling signal from the clock is applied to one input of a gate and the other has a train of pulses from the incoming signal.
The resultant output from the gate is a series of pulses for a precise amount of time.
For example if the incoming signal was at 1 MHz and the gate was opened for 1 second, then 1 million pulses would be allowed through.

Procedure :
Timer1 used as counter and Timer2 is used as gate interval time.
Counter values will be store into TCNT1.
When Timer2 interrupt generated then read the value of counter.