Work out microcontroller clock timing instantly with clear inputs, formula shown and shareable results.
Execution time is instructions times cycles per instruction times the clock period. At 16 MHz each cycle is 62.5 ns, so a 250-instruction single-cycle routine takes 15.6 microseconds — the calculation that decides whether an interrupt handler fits inside its deadline.
Timing
cycle period = 1/f; execution time = instructions x CPI x period; peripheral clock = f / prescaler
Branches, memory access, multiplies and divides take several cycles. Flash wait states at high clock speeds add more, so effective CPI is usually above one.
It divides the system clock down so timers and peripherals can reach long intervals or match a required baud or sample rate.