Creating delay using timers, Atmega & Attiny

Thread Starter

Alessandro Marchei

Joined Apr 21, 2020
Hi everyone,

How can I create a function that takes as input a specific amount of time, and then it executes a burst at a certain frequency to a pin, for the exact duration of the time given as an input, using registers?(Atmega 328 and attiny)

I would like to use ctc mode and interrupt for the frequency(internal in the period), and that is fine, but how can I tell the cpu to WAIT for a certain period of time ? A sort of delay() function in the Arduino library, obviously I cannot use it.

Thank you in advance