Mahesha Padyana
Mahesha Padyana

Reputation: 431

How to change duty Cycle in CTC mode in AVR micro controller

I would like to know how we can vary the duty cycle in CTC mode in AVR micro controller. In CTC mode, frequency can be varied using OCR0A register (Timer0) assuming some prescaler value. Do we need to make use of OCR0B register (value Must be less than OCR0A) to vary the duty cycle? On OCR0B interrupt, we can change the state of the OCA0 pin I guess.

Upvotes: 1

Views: 1598

Answers (1)

Spirine
Spirine

Reputation: 1877

The CTC mode only allows you to change the frequency of interrupts/pin state changes. If you want to drive the duty cycly of a signal instead of its frequency, then you have to use a PWM waveform generation mode.

Upvotes: 1

Related Questions