Writing to h/ware Timer registers

Hello Arduino members, this is my 1st ever mssg. I would like to use a hardware timer on Nany-Every to generate an interrupt every x000 ms. From Microchip doc TB3217, I know I must write to various registers to initialize the Timer. How is this done? that is my question.
For example: what is the precise Arduino instruction to set bit.0 (OVF) of Interrupt Control Register to zero?
In the Microchip doc, they are using a specific AVR library to perform this.
Is that the only way? If so, what is the name of most commonly-used Arduino library used to perform this task?
Thanks for any help !

You can try and use my megaAVR_TimerInterrupt library.

For example TimerDuration example

You cannot do it as stated, you will always be in an interrupt. Looking up Nany-Every I find a lot of stuff on babies and feeding them bottles. I think you mean Nano-Every?

You don't need to #include anything other than what is already done behind the scenes for you.

There are several timer/counters. For timer/counter A, you would execute:
or (using the bit definitions in the included system header file iom4809.h):

For timer/counters B0 through B3 you would execute (B0 shown):
because for some reason they didn't add TCB_OVF_bm.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.