[Icc-avr] pwm using ATmega48
Haojiong Zhang
hzhang at quickset.com
Fri May 4 12:52:04 PDT 2007
Hi,
I tried the following code to genearte pwm on PD5(OC0B) and PD6(OC0A), but
it doesn't work. The pins never change status when compare matching happens.
Anything wrong?
DDRD |= (1<<PD5)|(1<<PD6);
OCR0A = 0xAF;
TCCR0A = ( 1 << COM0A1) | (0 << COM0A0) | (1 << COM0B1) | (0 << COM0B0) |
(0 << WGM01) | (1 << WGM00);
TCCR0B = (1 << WGM02) | (0 << CS12) | (0 << CS11) | (1 << CS10);
OCR0A = 0xFF;
TIMSK0 = (0<<TOIE0);
best regards,
Haojiong Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070504/d445b143/attachment.html
More information about the Icc-avr
mailing list