TIMER: difference between CTC and fast PWM when TOP=OCR1A?

I’ve been reading the ATMEGA328P datasheet for a few days and cannot seem to understand this topic.

What I want to do is use TIMER1 to have a fixed frequency and use interrupts to control the PWM output of an entire port

My approach so far has been to use CTC and set the frequency by setting the TOP value via OCR1A. I set OCR1B to a value less than OCR1A. Then I use interrupt vectors for COMPARE MATCH A (to set the frequency) and COMPARE MATCH B (to set the duty cycle). When Compare MATCH A interrupt occurs, I set PORTD=0b11111111; when Compare MATCH B interrupt occurs I set PORTD=0b00000000 (for example); The manipulation of the OCR1B controls the duty cycle. I have attached a file with a picture that illustrates this.

I don’t see how this approach is different from using Fast PWM where the TOP value is set via OCR1A. What am I missing? Is there some benefit to using fast PWM mode I am missing? Also, is there some benefit to using ICR1 as the TOP value in CTC mode?

Thanks for your patience and guidance

Image.tiff (29.6 KB)

The benefit of PWM or fast-PWM is that it will toggle on and off a hardware port without needing interrupts. You can control the frequency and the duty cycle.

Doing it with interrupts must necessarily introduce a bit of jitter as the interrupt cannot necessarily always fire at exactly the same moment in the cycle (perhaps because of other interrupts, or because it is part-way through an instruction).