1

I'm new to microcontrollers, so I'm interested is it possible to set correct frequency mode on TCCR2 8bit timer?I need it to control a servo; On TCCR1 I do smth like this:

DDRB |= (1<<1) | (1<<2); 
ICR1 = 20000;
TCCR1A = (1<<WGM11)|(1<<COM1A1) | (1<<COM1B1);
TCCR1B = (1<<WGM13) | (1<<WGM12) | (1<<CS10);
OCR1A = 1500;//middle pos

And it works fine, but it seems there is no "ICR2" register and no capture mode on this timer, so I don't understand how can I set frequency to control servo on PB3.Is there any onter ways to control servos?

Thanks!

user3696488
  • 53
  • 1
  • 5

1 Answers1

0

Input Capture does not set a pin, so it can't be used to control a servo. ICR1 is usually used for input compare, but is also used for output compare on Timer 1 in some PWM modes.

PB3 is controlled by the output compare on Timer 2. You have do set it up similarly to what you have for Timer 1. The OCR2 register may be relevant to your needs.

UncleO
  • 8,299
  • 21
  • 29