I wonder what is the lowest PWM frequency possible for an AVR?
Highest is 500kHz fast PWM, but is there also a slow PWM function (trick)?
:roll:
I wonder what is the lowest PWM frequency possible for an AVR?
Highest is 500kHz fast PWM, but is there also a slow PWM function (trick)?
:roll:
Why there should be a lower limit ?
If the biggest prescaler and resolution was not slow enough, then you have enough time to build the PWM in software.
Also you can slow down the clock frequency, because the AVR work down to 0Hz.
But in practice such very slow PWM was fully useless.
E.g. it make no sense, if a PWM controlled lamp flicker one times per minute.
In general to do some tasks with a certain speed, there is always only an upper limit, but never a lower limit.
Peter
I want a sweep from 20Hz to 20kHz, is this possible with the PWM of the AVR?
:roll:
Thanks.
8)
not entirely sure, but i think you can daisy chain timers to get the wanted effect. letting the output of first timer be the input of the second. this way you can adjust frequency on the first timer, and duty cycle on the second. you should use the 16 bit timer for the frequency.
A 1.6mhz AVR with a 1024 clock divider using a 50% duty cycle, will have a frequency of about 6 hertz.
I wonder what is the lowest PWM frequency possible for an AVR?
Highest is 500kHz fast PWM, but is there also a slow PWM function (trick)?:roll:
Just set your output pin high, and wait..
Been over 2 years now, so the answer is at least 4 year period..
Alan
Been over 2 years now, so the answer is at least 4 year period..
20-20k sounds like audio testing. You need to generate a fairly clean sine wave? You can geberate a very lo distortion sine wave with a 12 or 14 bit dac... but counting up 14 bits and back down at 20khz is tough. Maybe 8 bits? Using the 'phase accumulator' technique where you increment a pointer into a sin table every N samples.
I used a phase accumulator once in a DTMF generator. There's practically no lower limit on the frequency you can generate. Rather than drive a DAC, I used a 15-bit phase accumulator (truncated to 8 MSB before the SIN table lookup), and drove an 8-bit PWM. Around 3 KHz, the sine output began to noticeably alias with the PWM.
I did the phase accumulator calculations on each PWM interrupt (IIRC about 30 microseconds).
This was at 8 MHz on a Mega8.