Very useful thread, thanks all.
What timers are used by the arduino in it's default state?
Were the problems caused to the servo library by the timer library shared due to both libraries changing the point at which a timer was reset?
Can the code that runs the triggering of the interupt can be considered to be running in parallel to the other code in the script?
So the interupt function itself doesn't run in parallel. If this is the case this gives you a specific time slot in which the interupt function would have to complete before the next interupt triggers. If an interupt function call extents beyond the end of the next interupt what happens?
As the called interupt function is running in series with the existing script then the size of the interupt function itself needs to be carefully consedered in order to avoid degrading the performance of the remaining script on the arduino. Is there a resource for estimating the number of clock cycles descrete segments of code take? I've read that multiplication can take place in one clock cycle the number required for a case statement, function call, and changing a global variables value would be a good starting point.
If someone could check if I've got the right end of the stick with the following right it would be helpful!
So the 'click' for each timer is coming in at the following frequencies:
(master clock freq) / (clock divider)
1 ~ Divider=2 ~ 42MHz
2 ~ Divider=8 ~ Master clock / 8 ~ 10MHz
3 ~ Divider=32 ~ Master clock / 32 ~ 2.6MHz
4 ~ Divider=128 ~ Master clock / 128 ~ 0.66MHz
As the timer is a 32 bit timer the maximum time between interupts is:
((clock divider) * 4294967295) / (master clock freq)
1 ~ 102 sec
2 ~ 409 sec
3 ~ 1640 sec
4 ~ 6540 sec
As RA is the number of 'clicks' until an interrupt is triggered, and RC is the number of steps until the timer is reset the frequency of interupts can be much higher. RA could be 1, and RC 2, meaning the click sequence would be:
Timer sequence: 0 - 1 - (reset to 0) - 1 - (reset to 0)
Interupt sequence: 0 - Interupt - 0 - Interupt
So the minimum time between of interupts is:
((clock divider) * 2) / (master clock freq)
1 ~ 47 ns ~ (21 MHz) ~ 4 Clock cycles
2 ~ 190 ns ~ (5.25 MHz) ~ 16 Clock cycles
3 ~ 762 ns ~ (1.31 MHz) ~ 64 Clock cycles
4 ~ 3050 ns ~ (0.328 MHz) ~ 256 Clock cycles
(I'm having another read through this thread to see what questions I can answer for myself - 9 pages is a fair bit to digest in one pass!)
EDIT: 32 bits is 4294967295, not 65535!