#include <avr/io.h>
#include <util/delay.h>
void main()
{
//Configure TIMER1
TCCR1A|=(1<<COM1A1)|(1<<COM1B1)|(1<<WGM11); //NON Inverted PWM
TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10); //PRESCALER=64 MODE 14(FAST PWM)
ICR1=4999; //fPWM=50Hz (Period = 20ms Standard).
DDRD|=(1<<PD4)|(1<<PD5); //PWM Pins as Out
while(1)
{
OCR1A=125; //0 degree-0.5ms pulse
_delay_ms(1000);
OCR1A=316; //90 degree-1.264 ms pulse
_delay_ms(1000);
OCR1A=650; //180 degree-2.6 ms pulse
_delay_ms(1000);
}
}