Paused
Achievable interrupt interval
40 ms
Exact · no rounding error
Elapsed simulation time
0 s
Source edge 0 · initialized
Counter · COUNT
0 / 9
0000₂
Timer interrupts generated
0
Next event in 40 ms
Prescaler progress
0 / 4
4 source edges until tick
Inside the timer

Counter register

COUNT stores n bits

Select a block to see how it contributes to counting and rollover.

Next timer tick: COUNT 0 becomes 1.Click a block to inspect it.
Clock, count, and interrupt
CounterTerminal matchInterrupt event
0 to 80 ms

Counter steps may be compressed when zoomed out. Event arrows mark instants; the cursor marks the inspected source edge.

Initialized · COUNT = 0Example output = 0
Interrupt rate: 25 HzToggle on every interrupt: 12.5 Hz output
How to read the timer

Why does PR need “+1”?

A PR of 9 holds ten count states: 0, 1, …, 9. The comparator is high while COUNT = 9. The following timer tick loads 0 and generates the event, completing ten ticks.

What does prescaling change?

A larger prescaler spreads timer ticks farther apart. It extends the longest interval you can represent with the same number of counter bits, but makes the time adjustment coarser. It changes the tick rate; it does not add storage bits.

Interrupt rate or output frequency?

An output that toggles once per interrupt needs two interrupts for one complete square-wave cycle. Its output frequency is half the interrupt-event rate. The green trace shows this ideal toggling behavior.

Automatic fitting. Every available prescaler is checked. The simulator chooses the PR/prescaler pair with the smallest absolute time error; equal solutions prefer the smaller prescaler. A half-tick rounds upward. Requests outside the timer’s range use the nearest endpoint and show a warning. Direct PR and prescaler edits preserve the other register.

Timing convention. COUNT holds each value from 0 through PR, so an interval contains PR + 1 timer ticks. PR = 0 generates an event on every timer tick. A terminal match is the level COUNT = PR; the event occurs on the following timer tick. Event markers indicate instants, not the physical width of an interrupt signal.

Model scope. This is an ideal periodic up-counter. The divided clock is represented by timer-tick markers. Playback speed changes only the animation. CPU interrupt latency, interrupt enable/flag registers, external-clock modes, PWM, clock jitter, ripple propagation, and writes during counting are not modeled. Changes to timer settings reset the simulation to source edge 0.

Prescaler choices. Use every power of two from 1 through 256, or enter a custom set. Custom entries must be positive integer powers of two from 1 through 65,536; values are sorted and duplicates are removed. After a time edit, hardware changes refit the requested interval. After a register edit, hardware changes retain the registers where possible.

Custom prescaler set

Enter the divide-by values your timer supports.

Use powers of two from 1 to 65,536. Brackets are optional. Values are sorted and duplicates are removed.