What timer/counter did arduino core libraries used ?
for example i think timer 0 used for millies() or timer3 used for analogWrite.
Are there any document to explain what register/interrupt/timer... arduino IDE used?
My arduino is atmeg 2560.
only timer0 for millis() indeed.
Then if you use PWM on certain pins, this is where the other timers come into play. that's driven by the atmega 2560 hardware design
- Timer 0 : pins 4 & 13
- Timer 1 : pins 11 & 12
- Timer 2 : pins 9 & 10
- Timer 3 : pins 2, 3 & 5 (16 bits)
- Timer 4 : pins 6, 7 & 8 (16 bits)
- Timer 5 : pins 46, 45 & 44 (16 bits)
other libraries will use some timers (servo, ...)
Thank for your help.
please note the reference if existed.
is it possible to deactivate the using of timer0 by millis() and release it?
it's from the ATMEGA documentation, you need to look at the pin configuration (page 2) and how Output Compare registers are mapped to the processor pins.
here for example I highlighted OC0, 0C1, 0C2 (only A and B for those so 2 pins) and OC5 (A,B and C so 3 pins)
Then you look at how Arduino decided to map the physical pins to the Arduino pins
and that gives you the mapping above
the datasheet explains how PWM works.
you can mess with timer0 but it will impact arduino "time management" and of course the
ISR(TIMER0_OVF_vect) is defined in the Arduino wiring.c file that is part of the compile environment.
Thanks jack for properly help