Hi,
on preparing my first arduino-project (previous avr experience - live seems to be much easier with arduinos now ), I'm currently stucked at the timers. Using the search functions of the forum, google, etc. I wasn't able find answers to the following questions:
- Is the timer definition limited to the wiring.c, or are the registers programmed at any additional location?
- Is it possible to redirect the millis(), micros() and delay() function to run on timer2 by changing the wiring.c and free timer0 for own usage? Or better writing a library version e.g. named millis2() using timer2. Both are 8bit, registers are comparable.
- Do I mess up anything else if I do this and use timer0 for my own project?
Background:
I want to use a couple of sensors logging to a sd-card with approx. 80Hz. This is due to the latency not possible in a direct approach. Therefore I want to place the sensor operations in an interupt appending the new data to a buffer and the main routine is writing and clearing the buffer to the sd as fast as possible.
To prevent mess up with the also used servo lib (timer1) it is required to place the sensor operations in a lower priority interupt, which leaves only timer0 to be used for this job. But millis() is also used so ... millis() needs to be on timer2, servo on timer1 and the sensors on timer0.
I hope you can give me some hints on the questions above.
Matthias