SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By imsmooth
I was reading

Am I correct in reading that if I write my own PWM routine, I don't have to be limited by 255 resolution?

AnalogWrite(127) is about 50% duty cycle, and each increment has a resolution of 1/256. If I want a higher resolution, like 1024 can I just write a loop that counts up to 1024, setting the outputpin high and low depending where I am in the loop without suspending other operations (math, interrupts,...)? There is an example in the community code section for timer/pwm routines.

Finally, were are the ports defined such as these:
TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM20);
TCCR2B = _BV(CS22);
OCR2A = 180;
OCR2B = 50;
By frank26080115
only timer1 is 16 bit, timer0 and timer2 are still 8 bit

the prescaler values have nothing to do with resolution
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]