I am trying to accomplish a simple PWM generation using delays on an AVR ATMega16
What i am trying to do is simply fade a led from 100% to 0% duty cycle, and later i will expand it to control two colors of a bicolor led to have a nice effect.
I have done this in mikroC with PICs before, but somehow it's not as easy in avr-gcc, or maybe i am missing something.
My problem here is that i want the led to fade completely in 3 seconds, but i feel its fading faster. I also think that it's spending more time on high duty cycles than on low ones. I mean that i see the led bright for a bit, then it fades, but when it becomes dim it moves to different duty cycles very fast or so i think..
Any ideas you might have on what i am missing ?
Code is available here : http://ideone.com/lUP5f
Thanks