Level 1 — Basic calculation

PWM Timer: Frequency, Duty Cycle & Resolution

Timer TOP and compare values, actual frequency, resolution, duty step and average output of a microcontroller PWM, with the waveform.

How it works — PWM Timer: Frequency, Duty Cycle & Resolution

Vavg ton T

Inputs

D
Duty cycle (%)
T
Target PWM frequency (kHz)

Formula

  • f = f_clk/(N·(TOP + 1))
  • bits = log₂(TOP + 1)
  • V_avg = D·V
  • V_rms = √D·V

Results

Vavg
Average output voltage
ton
Actual duty cycle
Reset

Results

Enter your values and press Calculate. The defaults are a worked example.

Formula

f = f_clk/(N·(TOP + 1)) · bits = log₂(TOP + 1) · V_avg = D·V · V_rms = √D·V

Show the math

Worked solution

Press Calculate to see every step with your values substituted.

Calculation level & design standard

Level 1 — Basic calculation

A direct engineering equation.

Preliminary engineering calculation — no jurisdiction-specific code compliance claimed. Verify the applicable requirements with a qualified professional.

Assumptions

  • Up-counting (fast PWM) timer; ideal square-wave output.

References

  • Microchip AVR / ST STM32 reference manuals — timer chapters

Results are for preliminary design and education. Verify against the governing code and have critical work checked by a licensed professional engineer.

Sign in

or with email

Forgot password?