- This topic has 1 reply, 2 voices, and was last updated 10 years, 6 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
|
Microcontroller › AVR › servo not working
avr studio 5.
#defineF_CPU16000000
#include<avr/io.h>
#include<util/delay.h>
intmain(void)
{ DDRD=0xff;
TCCR1A=0b10100001;
TCCR1B=0b00001010;
ICR1=20000;
while(1)
{
OCCR1A=1000;
_delay_ms(10);
}
}
I took prescalar =8,
Therefore for generating 50hz frequency , ICR1=20000,
1ms= full left= 2.5hz occr1a=1000
1.5ms=middle=3.75hz occr1a=1500
2ms=full right=5hz occr1a=2000
But the servo is not working…!!
whatz wrong in the code??
Hi,
Please comment your code properly and post again, so that it would be easy for us to help you