PWM Resolution (Bits)

bits = log2(fclk / fpwm)

Quick answer

This calculator solves bits = log₂(f_clk / f_PWM) for Resolution (bits). With Timer Clock 10 MHz, PWM Frequency 100 kHz, the result is 6.644. It solves in 3 directions, so you can enter the values you have and get the one you need.

Calculator

Resolution (bits)
—

Formula

bits = log₂(f_clk / f_PWM)

Description

The resolution of a timer-based PWM output is determined by the ratio of the timer clock frequency to the desired PWM frequency. The timer counts from 0 to (fclk/fpwm − 1), giving fclk/fpwm distinct duty cycle steps. The resolution in bits is the base-2 logarithm of this count. Higher timer clock frequencies or lower PWM frequencies give more resolution. For example, a 72 MHz timer generating a 20 kHz PWM has 72M/20k = 3600 steps ≈ 11.8 bits of resolution.

Variables

  • bits — PWM duty cycle resolution in bits
  • f_clk — Timer clock frequency (Hz)
  • f_PWM — PWM output frequency (Hz)

Practical Notes

Common applications: LED dimming requires 10-12 bits for smooth visual perception. Motor control typically needs 8-12 bits. Audio-class PWM (class D amplifiers) requires 12-16 bits. If the calculated resolution is insufficient, options include: increasing the timer clock, decreasing the PWM frequency, or using dithering to achieve fractional bit resolution. Some microcontrollers offer high-resolution PWM timers (e.g., STM32 HRTIM at 4.6 GHz equivalent) for precisely controlled duty cycles.

Symbols and units

Symbol Meaning Default unit Accepted units
bits Resolution (bits) — —
fclk Timer Clock MHz Hz, kHz, MHz, GHz
fpwm PWM Frequency kHz Hz, kHz, MHz, GHz

Step by step

  1. 1. What you know: Timer Clock 10 MHz, PWM Frequency 100 kHz
  2. 2. The relation: bits = log₂(f_clk / f_PWM)
  3. 3. Substitute: fclk = 10 MHz, fpwm = 100 kHz
  4. 4. Result: Resolution (bits) = 6.644

Worked examples

Minimum range

Given: Timer Clock 100 kHz, PWM Frequency 100 Hz

Result: Resolution (bits) = 9.966

Low range

Given: Timer Clock 1 MHz, PWM Frequency 1 kHz

Result: Resolution (bits) = 9.966

Typical

Given: Timer Clock 10 MHz, PWM Frequency 100 kHz

Result: Resolution (bits) = 6.644

High range

Given: Timer Clock 100 MHz, PWM Frequency 0.5 MHz

Result: Resolution (bits) = 7.644

Maximum range

Given: Timer Clock 1 GHz, PWM Frequency 5 MHz

Result: Resolution (bits) = 7.644

Solving for each variable

Solve for Resolution (bits)

Timer Clock 100 kHz, PWM Frequency 100 Hz → 9.966

Solve for Timer Clock

Resolution (bits) 0.025, PWM Frequency 100 Hz → 101.7 Hz

Solve for PWM Frequency

Resolution (bits) 0.025, Timer Clock 100 kHz → 98.28 kHz

How Resolution (bits) changes with Timer Clock

Timer Clock (input) Resolution (bits) (result)
1 MHz 3.322
2.5 MHz 4.644
5 MHz 5.644
7.5 MHz 6.229
10 MHz 6.644
15 MHz 7.229
20 MHz 7.644
40 MHz 8.644
70 MHz 9.451
100 MHz 9.966

Embed this calculator

Paste this into any page. It keeps working when this page updates, and credits the source.

<iframe src="https://vbatpower.com/embed/pwm-resolution-bits/" width="100%" height="460" style="border:1px solid #1f2a37;border-radius:12px" loading="lazy" title="PWM Resolution (Bits)"></iframe>
<p><a href="https://vbatpower.com/formulas/pwm-resolution-bits/">PWM Resolution (Bits)</a> Calculator by vbatpower.com</p>

Frequently asked questions

How do you calculate PWM Resolution (Bits)?

Use bits = log₂(f_clk / f_PWM). With Timer Clock 10 MHz, PWM Frequency 100 kHz, Resolution (bits) works out to 6.644.

What is the formula for PWM Resolution (Bits)?

The formula is bits = log₂(f_clk / f_PWM). The resolution of a timer-based PWM output is determined by the ratio of the timer clock frequency to the desired PWM frequency.

How do you find Timer Clock when you know the other values?

Rearrange for Timer Clock: with Resolution (bits) 0.025, PWM Frequency 100 Hz, Timer Clock is 101.7 Hz.

How do you find PWM Frequency when you know the other values?

Rearrange for PWM Frequency: with Resolution (bits) 0.025, Timer Clock 100 kHz, PWM Frequency is 98.28 kHz.

Need more features?

Save calculations, import telemetry data, simulate battery discharge, and collaborate with your team.

Try the App