Duty is maintained at 50%.
The frequency can go a lot higher as flowchart does not use lookup tables or is limited to clock frequencies.
Only limited to 3000Hz as that was requested in this post.
It will use any clock frequency, so can use with 8MHz internal oscillator or 19660800 external crystal e.t.c.
With 32MHz clock frequency, PWM frequency 100'sKHz can be achieved.
So long as the
Code: Select all
Accuracy is about +/-10Hz.
The flowchart is educational as if you follow the maths you will learn for a PWM duty of 50%:
how to calculate PWM Period value, required duty value and prescaler value for a given frequency.
Hope this is of some use: