System clock relationship with timer/counter clock.

Hi,

I have a need to generate a 51uS output through one of the timers yet I cannot see anywhere where the documentation says what frequency the system clock is.

In simple terms I need to know what the relationship between the 16MhZ crystal and the clock that controls the timer/counters is.

In simple terms 16MHz is the system clock frequency.

Not simple: Clock source, can be internal/external, divided. Timer/counter2 can have separate clock source... All is in the MCU's datasheet. Or provide more detailed info if the simple answer is not satisfactory.

Hi,

thanks for responding, but my confusion starts with the MCU data sheet. There is a prescaler that at one point in the data sheet says the internal 8Mhz oscillator divides by 8 to get the system clock. I have found no mention in any of the Arduino literature to say whether the 16Mhz clock on the Mega is divided by the prescaler or not. What I need to know is, is this 16MHz clock the one that feeds the timer/counters?

I can of course just set it going and use pulseln() to measure the frequency. This is what I will do when I get some time to experiment, but I wondered if this knowledge was documented anywhere.

Mega has 16MHz system clock by default. Timer can be run from the system clock prescaled or not, or from external source on Tn pin e.g. You have to read "Timer/Counter Clock Sources" for specific one in the ATmega datasheet if you want know more.