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 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:
TCA0.SINGLE.INTCTRL &= ~1;
or (using the bit definitions in the included system header file iom4809.h):
TCA0.SINGLE.INTCTL &= ~TCA_SINGLE_OVF_bm;
For timer/counters B0 through B3 you would execute (B0 shown):
TCB0.INTCTRL &= ~1;
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.