user27095: I have a problem with the Servo library. 
I need to read a PPM signal and create a PWM signal of each channel. The problem is that PPM has a higher resolution than PWM so I want to use the 16 bit Timer1 for reading PPM. However the Servo library that writes the PWM signal also uses Timer1. 
Is it possible to generate a PWM signal with 8 bit / Timer2? And has someone made an example, or an explanation about, how to do that?

user30005: 
Is it possible to generate a PWM signal with 8 bit / Timer2?

yes. I implemented multiple approaches, some on avrs and some on pics but the basic principles are the same: https://dannyelectronics.wordpress.com/2017/02/18/driving-multiple-servos-off-a-pic-timer2-ranged-extended/
that post provided a list of links to other implementations - one of them off a timer 2 on avr.

user31693: Yes, Arduino Servo library uses Timer1 (and other ones, depending on Arduino boards) to manage FastPWM via software interrupts. Timer2 is used by tone() function: be careful if you are using that function.
A good example using Timer2 to generate PWM is the Infrared remote library for Arduino. If IR_USE_TIMER2 is defined it will use Timer2. The key code is at IRremote.cpp where the ISR is managed.

user10794: Here is a simple example from my page about timers of using Timer 2 to output a square wave of 50 kHz:
const byte LED = 3;  // Timer 2 "B" output: OC2B

const long frequency = 50000L;  // Hz

void setup() 
 {
  pinMode (LED, OUTPUT);

  TCCR2A = bit (WGM20) | bit (WGM21) | bit (COM2B1); // fast PWM, clear OC2B on compare
  TCCR2B = bit (WGM22) | bit (CS21);         // fast PWM, prescaler of 8
  OCR2A =  ((F_CPU / 8) / frequency) - 1;    // zero relative  
  OCR2B = ((OCR2A + 1) / 2) - 1;             // 50% duty cycle
  }  // end of setup

void loop()
  {
  // do other stuff here
  }


27095: <p>I have a problem with the Servo library. </p>

<p>I need to read a PPM signal and create a PWM signal of each channel. The problem is that PPM has a higher resolution than PWM so I want to use the 16 bit Timer1 for reading PPM. However the Servo library that writes the PWM signal also uses Timer1. </p>

<p>Is it possible to generate a PWM signal with 8 bit / Timer2? And has someone made an example, or an explanation about, how to do that?</p>
 30005: <blockquote>
  <p>Is it possible to generate a PWM signal with 8 bit / Timer2?</p>
</blockquote>

<p>yes. I implemented multiple approaches, some on avrs and some on pics but the basic principles are the same: <a href="https://dannyelectronics.wordpress.com/2017/02/18/driving-multiple-servos-off-a-pic-timer2-ranged-extended/" rel="nofollow noreferrer">https://dannyelectronics.wordpress.com/2017/02/18/driving-multiple-servos-off-a-pic-timer2-ranged-extended/</a></p>

<p>that post provided a list of links to other implementations - one of them off a timer 2 on avr.</p>
 31693: <p>Yes, Arduino <a href="https://www.arduino.cc/en/reference/servo" rel="nofollow noreferrer">Servo library</a> uses Timer1 (and other ones, <a href="https://github.com/arduino/Arduino/blob/ide-1.5.x/libraries/Servo/src/avr/ServoTimers.h" rel="nofollow noreferrer">depending on Arduino boards</a>) to manage FastPWM via software interrupts. Timer2 is used by tone() function: be careful if you are using that function.</p>

<p>A good <strong>example using Timer2</strong> to generate PWM is the <strong><a href="https://github.com/z3t0/Arduino-IRremote" rel="nofollow noreferrer">Infrared remote library for Arduino</a></strong>. If IR_USE_TIMER2 is defined it will use Timer2. The key code is at <a href="https://github.com/z3t0/Arduino-IRremote/blob/master/IRremote.cpp" rel="nofollow noreferrer">IRremote.cpp</a> where the ISR is managed.</p>
 10794: <p>Here is a simple example from <a href="http://www.gammon.com.au/timers" rel="nofollow noreferrer">my page about timers</a> of using Timer 2 to output a square wave of 50 kHz:</p>



<pre class="lang-C++ prettyprint-override"><code>const byte LED = 3;  // Timer 2 "B" output: OC2B

const long frequency = 50000L;  // Hz

void setup() 
 {
  pinMode (LED, OUTPUT);

  TCCR2A = bit (WGM20) | bit (WGM21) | bit (COM2B1); // fast PWM, clear OC2B on compare
  TCCR2B = bit (WGM22) | bit (CS21);         // fast PWM, prescaler of 8
  OCR2A =  ((F_CPU / 8) / frequency) - 1;    // zero relative  
  OCR2B = ((OCR2A + 1) / 2) - 1;             // 50% duty cycle
  }  // end of setup

void loop()
  {
  // do other stuff here
  }
</code></pre>
