I needed to use TC1 for input capture, but also analogWrite() and an approximate 1 ms interrupt to poll the user interface (encoder, button).
The Arduino Nano's ATmega328p (datasheet, beware: a lot of bit symbol typos) has three timers:
- TC0
- TC1
- TC2
It is not easy to find information on the "Arduino core" structure and it's use of peripherals. The Arduino Reference does not seem to refer to any information. Nor does Arduino Hacking.
Some info can be found on
https://arduino-info.wikispaces.com/Timers-Arduino
but I am not sure it's up to date. For instance, I find disabling TC2 also disables the analogWrite()
PWM.
Trying to use TC0 results in an error, as TIMER0_OVF_vect
is already being used ("multiple definition of `__vector_16'").
How can I use the timers (and their interrupts) that are already used for the core?