/!\FastPWM++Timer/Counter /!\

Thread Starter


Joined Oct 17, 2007
Hello again;

I have to control a DC motor 9V using "PWM" Using the AVR Butterfly which use Atmel (Atmega 169).

I need to write a C code to control it using Timer1 and Fast PWM.

My Question for now is the clock frequency for atmegag169 ??

I want to set a prescaling but I'm not sure about the clock frequency ??

also the Top value ???

what is the different between ICR1 and OCR1B???

actually I have so many question about PWM and how to code it . I searched through the NET but found what I already Know.

If you Know a book taking about it can you please help .

The input is from PORTB using a switch, from 0 - 4 ,each define a duty cycle and frequency .

My problem is the Clock frequency which I have to know to set the prescaling value and the Top Value. ??

Help please !


Joined Jan 28, 2005
A good place to get information is at Smiley Micro's website. It contains a good deal of info on the butterfly and its application.

There are several AVR experienced members here at AAC who can assist you with your questions. There is also a good forum at www.avrfreaks.net.

Last edited:


Joined Jan 28, 2005
I did a bit of checking and it appears that the butterfly is intended to operate on its 8Mhz internal RC oscillator. It also has a 32,768 Hz crystal connected so it can be used to provide a convenient clock source for a software based real-time clock application.