I am using atmega32 micro controller at 8mhz internal freq.I have interface vs2 servo motor with it.I have generated pwm with from 1msec to 2 msec at every 20msec but could not control its angle.it moves in clockwise direction and stays there.I Cant understand the problem.i want help.
I agree with Gobbledok. Your code looks ok so the micro configuration needs verifying. Presumably PORTD,5 is configured for digital ouput and can provide enough current to the servo? Does the micro supply voltage match the servo supply voltage?
Make sure the definition in your project file correctly states the speed the processor is running at, the delay_ms works based on constants created during compile time, if you have the wrong frequency set in the project file it will not work.