Optimal way of making timed code

  • Hardware Timer generated pulses without interrupt

Note that using an interrupts to generate the pulses is very expensive in terms of processor load. Since the enter and leave to/out the interrupt takes a significant amount of time, interrupts are never used to generate high frequency pulses.

Yes, PWM timers are often used for this, and in many cases this is the optimal method.

1 Like