Understanding PWM Resolution

Status
Not open for further replies.

oudevolvo

Member
My new 3.6 is in, so I am back on track again.
I do have a question about PWM and resolution to check whether I understand the documentation correctly.
In my project I will use multiple PWM outputs.
I have grouped similar output types on timers.
For at least one timer (FTM3) I'd like to change the frequency. I will connect fans / blowers and control them via PWM (via a gate driver and mosfet).
I will need to go to 14648.437 Hz to make sure there is no audible noise.
If I understand the Pulsed Output: PWM & Tone page correctly, while changing the frequency ideally I should also change the resolution. "To configure both frequency and resolution for matching performance, use the values from this table:"
So for the 14,6 kHz frequency that should be a resolution of 12 and as a result use PWM values 0 - 4095 for 0% to 100%.
But in that case all my analogWrite statements need to use the 0 - 4095 range.
The default frequency of 488.28 Hz is not in the table so I assume that one will not have "matching performance" while using a resolution of 12.

Now my question is, if I do not change the analogWriteFrequency of the other timers, what to I do?

How important is matching performance anyway?
I'm just controlling some pumps, fans etc. so nothing that (as far as I expect) required high accuracy.

Thanks in advance for shining some light on the matter.
 
Now my question is, if I do not change the analogWriteFrequency of the other timers, what to I do?

I suppose the answer is to simply use the PWM outputs you did change with analogWriteFrequency().


How important is matching performance anyway?
I'm just controlling some pumps, fans etc. so nothing that (as far as I expect) required high accuracy.

For this application, probably not important.

But some people do care about those details for other highly sensitive applications, which is why it's documented on the web page.
 
Thanks Paul!
I meant what do I do while not having a matching performance for the non modified ie still standard analogWriteFrequency pins.
But your second answer also answers that: just use them and do not worry about matching performance ;)
In that case I'll leave the analogWriteResolution unchanged and use the standard/normal 0-255 range for all analogWrite's.
 
Status
Not open for further replies.
Back
Top