Timers and PWM
Hardware timers count clock cycles to measure time, create delays, and generate PWM signals.
Easy
A timer counts clock ticks (after a prescaler). Modes: overflow interrupts, compare match (generate events at exact times) and input capture (timestamp an edge to measure frequency or pulse width).
Pulse-width modulation switches a pin rapidly; the duty cycle sets the average:
PWM controls LED brightness, motor speed and servo position (servos expect a 1–2 ms pulse every 20 ms).
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.