PWM: Timer0 Fast PWM Mode 3

Reference: http://darcy.rsgc.on.ca/ACES/Datasheets/ATMEGA328P.pdf#page=93
Purpose: A low-level PWM replacement for the analogWrite() function is required to control the fan speed.

Filename: AnalogWrite.S

If Timer/Counter1 is used as a scheduler, Timer/Counter 0 can be used to generate a PWM signal on Pin 6 (OC0A).

This signal will be placed on the PWM wire (almost always blue) of the DC Computer fan.

The capture to the right reflects OCR0A set to 20 (/255).

The ATmega328p datasheet suggests a frequency of 978 Hz that should be verified with your oscilloscope.

 

 

Example: Sunon MFC0251V2-1Q02U-S99