I am beginner to ATmega328P programming for PWM generation. I am trying to generate a PWM wave at PD5 pin the datasheet says PD5(OC0B/T1/PCINT21). When I generate the PWM with help of timer0 overflow interrupt it works fine, however when I try to use timer1(tccr1a, tccr1b, icr1, ocr1b) and compb_vect isr it doesn't work. Can someone please guide how I can generate PWM at PD5 pin with the help of timer1? Can you please guide is it possible to use timer1 to generate PWM at PD5?
Asked
Active
Viewed 272 times
0
-
1But OC**0**B is a Timer**0**/Counter**0** output compare match B output. Thus if you want to use a Timer**1** you need to use OC**1**A (PB1) or OC**1**B (PB2) – G36 Jul 07 '20 at 14:38
-
Thanks a lot for your answer, so can I conclude that for PWM generation at PD5 only timer0 can be used and timer1 for PB1 and PB2 pin only? – Pradeepan Jul 07 '20 at 14:40
-
That's right at least if we are talking about a hardware PWM. – G36 Jul 07 '20 at 14:43