Programming the hardware timers - advanced level

In some modes (which may be the mode in place at the start) the update of OCR0A is buffered. Now how that affects things I'm not sure, except maybe this:

  • It starts in a buffered mode (eg. one of the PWM modes) because of init()
  • You change OCR0A but it goes into the buffer, ready for when the count ticks over (TOP or BOTTOM)
  • You change modes to CTC mode almost immediately
  • Since it is now in a non-buffered mode the (planned) copy from the buffer to the real register is lost
  • The old value of OCR0A is now retained