Timers - Frequency - Mega2560 instead of 328P based Arduino

Hi All

I am trying to get some help with Reply #12 on the Timers post, on Nick Gammons page (Thank you Nick for all this info by the way).

I am trying to use this same code on a Mega2560. I have had it working on a Duemilanove for some time, but today I managed to make the board go Pop, and the only other one I have is a Mega2560.

However due to all the timers being different, I am unsure how to proceed.

Is anyone able to assist with getting the code in Post #12 of the Timers page, to work on a Mega2560?

https://www.gammon.com.au/forum/?id=11504&reply=12#reply12

Many thanks in advance

The Gammon sketch is written for Timer1 with ICP pin 8.

On the Mega, from the pin out document I'm looking at, Timer1 does not have a broken out ICP1 pin.

Timer4 and Timer5 are both 16bit timers with icp pins broken out on 48 and 49.

You should be able to just substitute one of these timers for Timer1

Thanks very much Cattledog

This worked.
Changed them all to Timer4 things, and it seems to be working nicely.

Many thanks for the nudge in the right direction