Frequency can be measured using a simple synchronous counter that is counting the number of edges of an input signal over a defined period of time. This period of time is usually referred to as gate time.

Fig. 1 Frequency measurement block diagram

Fig. 1 Frequency measurement block diagram

During the gate time the counter is enabled and incoming pulses are counted.

Example:

 
Gate time Number of pulses Frequency
1s 1 000 000 1 Mhz
1s 10 10Hz
1ms 3000 3Mhz

 

Fig. 2 Timing Diagram

Fig. 2 Timing Diagram

Implementation of frequency measurement using counters

Frequency measurement can be implemented with the resources available in most microcontrollers. Depending on the specifics of the particular microcontroller, different implementation can be achieved.

  • Timers/Counters – used for counting the events (edges of the signal being measured);
  • Interrupts – usually a crystal oscillator is used for the time base. In order to have a programmable time base a dedicated timer can be used.

 

 

 

Was this article helpful?