[Timer 1] Frequency meter for up to 500khz (Library?)

Hi,

I would like to make a frequency meter for up to 500khz (or more if possible), I have the possibility to use a shift register (CD4040) but I would like to try via external input for the timer1 (16 bits, should give a 7 restarts). It seems that it is possible to generate an interrupt when the counter reaches the maximum (when it should restart the count).

Can someone please indicate a library?

(Note: using Atmega328)

Thank you.

Oh yeh!

I was able to do without a library.

Thank you!

Check out Nick Gammon's methods for a frequency counter using external clock source on Timer 1.

https://www.gammon.com.au/timers

The FreqCount Library can also be used
https://www.pjrc.com/teensy/td_libs_FreqCount.html