I have produced some tables of PWM information for different AVR microcontrollers. I find them a really useful summary of the datasheets when using PWM. Once you've played with PWM a bit, and understood the basics, then these sheets are 90% of what you need from then on! N.B. I haven't embedded them as images as they are quite big and don't show up very well at a small resolution inline with this text.

- ATMega8 (as used by the $50 robot)
- ATMega168 (which you can upgrade the $50 to use) and is also used by the Roboduino
- ATMega32
- ATMega640 as used by the Axon

Click on the name of the processor to download the individual PDF documents.

Alternatively you can download an Excel file for all of them from here

I've done my best to verify the information in these sheets but since I don't own all of the hardware then I can't test them in practice. So if anyone finds any errors then please let me know.

**Calculating the value of TOP**

For 'Fast PWM' modes the formula is as follows:-

Output_PWM_Frequency = Clock_Speed / (Prescaler * (1 + TOP))

or

TOP = (Clock_Speed / (Prescaler * Output_PWM_Frequency)) - 1

For 'Phase Correct' and 'Phase and Frequency Correct' modes the formula is as follows:-

Output_PWM_Frequency = Clock_Speed / (2 * Prescaler * TOP)

or

TOP = Clock_Speed / (2 * Prescaler * Output_PWM_Frequency)