Reputation: 43
I am using Atmega8 with 16 MHz clock and use Timer2 as PWM with this code
DDRB |= (1 << DDB3);
OCR2 = 0;
TCCR2 |= (1 << COM21);
TCCR2 |= (1 << WGM21) | (1 << WGM20);
TCCR2 |= (1 << CS21);
OCR2 = 0;
but after this code 0 PWM my led was start with low brightness. So please give me solution.
Upvotes: 0
Views: 645
Reputation: 26
When you set OCR2 as 0 it doesn't mean that it will be no pwm signal. Actually it will make little peaks in beginning of every PWM cycle. To turn pwm off you should disable PWM on timer.
Upvotes: 1