We want to know basics of Arduino timer interrupt. What is TCCR2A , What is TCNT2 etc. Where is it documented ?!
In the processor datasheet, available from Microchip's website
can you share the link i am unable to find it
You can't find this?
Does the following diagram (Fig-1) (prepared based on Data Sheets of ATmega328P MCU) bring answers to your queries or you still need some textual description?

Figure-1:
1. Basics of Arduino Timer Interrupt.
Assume that TCNT1 of Fig-1 is programmed to count in the upward direction. It will begin count form 0 (0x0000 = 0000 0000 0000 0000 0000) and then will arrive at the maximum count (65535 (0xFFFF = 1111 1111 1111 1111) and then will complete full count 65536 (0x10000 = 1 0000 0000 0000 0000).
At full count, the content of TC1 turns from all 1s to all 0s (switching from maximum count to full count). This is event which is called roll-over or over-flow event and the TOV1-bit assumes HIGH state.
If the switches marked as TOIE1 and I are kept closed in the setup() function, the TOV1 bit/flag will interrupt the MCU; as a result, the MCU will suspend its current task and then will jump at the side job (called Interrupt Service Routine = ISR) at flash location 0x001A. (Apart from TOV1 source, there are many more sources of interrupts for the TC1.)
2. TCNT2 stands for 8-bit "Timer/Counter Module - 2" or TC2 of the 328P MCU.
3. In order to program the TCNT2 Module, the following registers are needed:
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.






