Fri. Nov 15th, 2024

Microprocessor based frequency counter up to 70MHz

Freq_Counter_Mega16

Features:

The software supports the following operations modes:

  • Usage with no prescaler, input frequency up to 70MHz, 10Hz resolution
  • Usage with :64 prescaler, range depending on prescaler, corrected reading in MHz, 1kHz resolution
  • Usage with :128 prescaler, range depending on prescaler, corrected reading in MHz, 1kHz resolution
  • Usage with :640 prescaler, range depending on prescaler, corrected reading in GHz, 10kHz resolution
  • Usage with :1000 prescaler, range depending on prescaler, corrected reading in GHz, 10kHz resolution

Software (version 1.1 is now available):

In order to make the circuit work, it is important to set the fuse bits inside the AVR micro controller correctly. Theses fuse bits can be set with the programmer that is used to flash the software.
Set the fuse bits like this: Have all fuse bits at 1, only CKOPT and SPIEN goes to 0.

For those that are interested to understand the background, have a look at the ATmega16 datasheet pages 254-256. The logic of the bits is active low, i.e. programmed=0, unprogrammed=1. The bits that determine the clock source of the AVR, CKSEL 0..3, come programmed when the chip is shipped, i.e. set to 0. That is the reason why the controller runs on internal clocking, and does not even start the crystal. By setting all CKSEL 0..3 to unprogrammed (1), the external crystal is selected. The CKOPT programmed (0) switches the crystal from weak amplitude to full amplitude, so that the 74HC4040 gets enough input signal.

Schematic:

frequency_counter_schematic