HI! Question is, can Atmega16 control 4 servos with different timers?
Two servos are continuous rotation and two are normal 180 degrees.
Datasheet says that MCU have Two 8-bit Timer and One 16-bit timer.
180 degrees servos are connected to (OC1B)- PD4 and (OC1A)-PD5.
But where I can connect other two continuous rotation servos? How to activate other timers?
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=316; //90 degree
OCR1B=316; //90 degree
}
}
If I connect them to PB0 and PB1 and write this code
PORTB = 0b00000000;
_delay_ms(0.7);
PORTB = 0b00000001;
_delay_ms(0.7);
PORTB = 0b00000000;
_delay_ms(0.7);
PORTB = 0b00000010;
to main() {...} servos rotate incorect, and I guess that I need another timer or way to control them.
Have any Ideas?
![Huh ???](https://www.societyofrobots.com/robotforum/Smileys/default/huh.gif)