Ceska verze

The simplest frequency meter (counter) up to 10 MHz

    This is probably the simplest frequency meter (counter) with Atmel AVR. It allows to measure frequencies up to 10 MHz in 4 automatically selected ranges. Lowest range has a resolution of 1Hz. A 4-digit LED display is used to display the measured frequency. It is based on a Atmel AVR ATtiny2313A or ATTiny2313 microcontroller. The program to download and configuration bits setting you can find below. The microprocessor is clocked from 20MHz crystal (the maximum allowable frequency). The measurement accuracy is determined by the accuracy of this crystal. Minimum length of half period of the measured signal must be greater than the period of the crystal oscillator (restriction of the MCU architecture). At 50% duty cycle can therefore you can measure frequencies up to 10 MHz. The measured signal is input to pin 9 (T1). Counting is performed by a 16-bit timer/counter1, which is externally clocked. Overflow increments a 8-bit register, making in a 24-bit result. It is then transferred to the decadic form and displayed. The frequency is always displayed in kHz. Automatic range selection changes the position of the decimal point. The refresh rate is 1Hz. Cathodes of displays are connected to port B, the anodes to bits 0-3 of port D. Using the superbright display allows you to omit usual current amplifying transistors. The display is controlled in multiplex and connected the usual multiplex manner. Frequency of the multiplex is 156.25 Hz. You can use the display for example CA56-12SRWA. Resistors R1 to R8 determine the current into the display and thus its brightness. They are chosen so that the current does not exceed the maximum output current (40 mA) of pins. This frequency meter is powered from a supply of approximately 5V (+/- 10%). Consumption at 5V is about 15-35 mA, depending on the number of lit segments (most current consumption has the LED display). If the input of the frequency counter is "in free air", it can cause display meaningless values ​​because the input impedance is very high. You can prevent this by adding a resistor around 100k in parallel to the input.
You may also like: 6 digit 10 MHz frequency meter (counter) II..

Range 1 ... max 9.999 kHz, the resolution to 1Hz.
Range 2 ... max 99.99 kHz, the resolution to 10Hz.
Range 3 ... Max 999.9 kHz, the resolution to 100Hz.
Range 4 ... max 9999 kHz, the resolution to 1kHz.

The program for download:
source code in Assembler (ASM)
compiled in HEX file (496 Bytes)
How to write the program into the AVR is described here.

I can send you the programmed microcontroller. For more info click here.


The schematic of the simplest frequency meter (counter) with AVR up to 10 MHz.


Configuration bits setting (in PonyProg).


Testing the simplest frequency meter (counter) with AVR - measuring frequency cca 505 kHz.


Video - testing the simplest frequency meter (counter) with AVR.



Added: 6. 3. 2013
home