I'm new to AtmelStudio. I need to know how to generate a servo control signal using timer modules of atmega2560. I'm using an Arduino Mega board. (please refer the last paragraphs of this page for more info about servo control signals).
I'm not sure about how to do exact timing. The clock selection part is a bit confusing for me always.
How should I configure the timer module (TCCR registers) and how to do the timing? It's better if there's a working code example.
(I've tried using timer 0 under fast PWM mode. It gives pulses accordingly but I don't how to calculate proper timing pre-scalers. I've doubts about the primary clock used. Is it the 16MHz crystal on the Arduino board or is there some other inbuilt clock source inside the atmega2560 so that we have to explicitly mention which clock to use??)