Hi guys, > Ooops,. clock is 16MHz. So 1024 prescale gives 15.625KHz > clock ticks for that counter. Still, no way you can get a > 10KHz PWM from that. Use WGM mode 14 which uses the ICR register to set the top. If we start with a prescalar of 1, we want each cycle of our PWM output to last 1600 clock cycles (@16 MHz), so you could set ICR to 1600, and vary OCR between 0 and 1600 to control the duty cycle. Picking a prescalar of 8, and setting the ICR to 200 will give the same effect. -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/
Message
Re: [AVR-Chat] Re: PWM question with ATMega128
2007-11-30 by Dave Hylands