This is using FastPWM for driving a servo.
Three Tutorials concerning controling a analog servo. The servo used for testing is the Hextronic XHT900.
[TUT] ATMEGA328PB, 8-bit timer, servo, pwm, HXT900
8-BIT TIMER not suitable for driving servo, except when only a few positions are needed,on 11 degree multiples, 1 step = 11 degrees. Advantage – replace 16-bit timer for a limited number of cases.
[TUT] ATMEGA328PB, 16-bit timer, servo, PWM, HXT900
16-bit TIMER with Phase Correct PWM. 11 steps/degree. Disadvantage – period
jitter on output wave form.*
[TUT] ATMEGA328PB, 16-bit timer, servo, FastPWM, HXT900
16-bit TIMER with FastPWM. 22 steps/degree.
It appears that the FastPWM Mode is the most useful for driving a servo. However, applications are
different. I would suggest that you write some small programs an test you application ideas.
* jitter happens when changing pulse width.
Attached are 3 files, 1 pdf, 2 programs: