Frequency Counter / F_CPU : 10 MHZ (Help)

Hello masters.

I am using the open source freqcount libraries for frequency counter. I was reading the blog of Mr.Gammon Gammon Forum : Electronics : Microprocessors : Timers and counters about timers/counters However the timers only accept power of 2 MHZ (2,4,8,16) as the clock source.

Previously, I have successfully change the fuse settings of the atmega328p chip to operate with external clock source and it was a real challenge. So I can use a square wave function generator to work with 8 mhz.

The problem is

I need to modify it to the 10MHZ clock source as the clock source will be coming from the function generator again, What has to be be modified in timers ? , I am not good at low level C programming and I really can't see the big picture. I am having hard times to understand modifying the prescalers and timers to divide it to 10 MHZ.

I would appreciate for any help.

However the timers only accept power of 2 MHZ (2,4,8,16) as the clock source.

This is not correct. The timers can have external clock sources, of any frequency you like. See the ATmega data sheet for details.

For Timer0, use the T0 pin (PD4) as input. You can select either rising or falling edges as the trigger.
For Timer1, use the TOSC1 (PB6) pin as a clock source.
For Timer2, same as Timer1 (PB6).

In the last two cases, the ATmega fuses must be set so that the internal RC oscillator is the MCU clock source. Making the timer input connection to PB6 is not particularly easy to do with an Arduino board and may require that you remove the crystal.

Some of the Arduino core functions are only sure to work correctly at 8 MHz, 16 MHz, and in a few cases 20 MHz. If you use any other clock you should expect micros(), delay(), delayMicroseconds(), and SoftwareSerial to not run at the expected rate.

For example, the calculation for micros() involves 64/clockCyclesPerMicrosecond. If that integer division gets truncated (F_CPU doesn't divide evenly into 64 MHz) you will get incorrect answers. That works at 1, 2, 4, 8 and 16 MHz but not at 20 MHz. The delay() function uses micros() so that has the same limitations.

I am already using the XTAL1 as the clock source which is (8mhz) now. My question is about "frequency counter" which would use an 10MHZ external clock source coming from the GPS signal ( divided ). For the test process, I am using the function generator.

I have already changed the fuse bits of the atmega328p chip so I can operate any sketch based on 8MHZ external clock coming from the function generator.

However things change when it comes to setting the f_CPU to 10MHZ, as indicated above, delay, ms, softwareserial get broken.

How can I modify the prescaler or the timer pins efficiently so that the frequency counter work with the 10 MHZ ?

The default frequency counter library uses the timer 1 pin ( I think pin 5 on arduino board). I have taken out the XTAL1 pin of the chip from the board and connect to the 8MHZ function generator, and it works

the only thing needed is modification for the F_CPU which would be the 10MHZ

I'd appreciate for any help/advise