What PWM frequency should I use for motor control?
For DC motor control, frequencies between 1kHz-20kHz work well. Higher frequencies (15-20kHz) reduce audible noise but increase switching losses. For servo motors, use 50Hz with 1-2ms pulse widths. See also our Duty Cycle Calculator.
How does prescaler selection affect PWM performance?
Higher prescaler values reduce the effective clock frequency, allowing lower PWM frequencies but reducing resolution. Lower prescalers provide better resolution but limit the minimum achievable frequency.
Why is my calculated PWM frequency different from the desired frequency?
PWM frequencies are constrained by integer register values. The calculator shows the closest achievable frequency and the error percentage. Choose different prescaler values to minimize error.
Should I use 8-bit or 16-bit timers for PWM generation?
16-bit timers provide much better frequency resolution and can achieve lower frequencies. Use 8-bit timers only when you need very high PWM frequencies or have limited hardware resources.
What is duty cycle and how does it affect my application?
Duty cycle is the percentage of time the PWM signal is HIGH. For motor control, it determines speed. 50% duty cycle means equal time HIGH and LOW, while 25% means the signal is HIGH for 1/4 of each cycle.
How accurate are microcontroller PWM frequencies?
PWM frequency accuracy depends on the crystal oscillator tolerance (typically ±20ppm) and register resolution. The calculator shows theoretical values - actual frequencies may vary slightly due to hardware tolerances.