Don´t know if this is the right sub-forum for this topic or not but here is my problem.
I need to count pulses from an external source (a VR speed sensor, signal converted to square wave with fixed amplitude).
My arduino already contains time sensitive code (ignition control for a 8 cyl engine)
I cannot use a interrupt directly because of the frequency of the signal (12 Hz at 1 km/h) since I believe that the interrupts will interfere with the timing at high speed.
I decided to use the eight bit internal timer2 with no prescaler and use the output compare match function, together with an external clock for that timer to get reasonable update of speed at 0,2-0,3 s interval. The external clock would then be the square wave signal from the speed sensor
Today when i studied the datasheet it said to use the TOSC1 pin … ok which one is that?..oh that one…BUT IT IS ALREADY OCCUPIED BY THE 16 MHz CRYSTAL… ARRRGH.
So now I am a little frustrated.
As i see it i have two options
1: Try using a interrupt directly anyway… me no like
2: Learn some more elektronics to use an external counter/divider an connect a interrupt to that one (= 1 interrupt per 100 pulses)
A count to 100 from the external counter gives me a update frequency of 0,27s at 30 km/h… could live with that, but at 220 km/h (yes, illegal) its every 4 ms, which means that it could interfere with every second ignition pulse. At that rpm i need to time my ignition pulse about 26 us accuracy (= 1 degree of ignition advance). If it interferes with a timing pulse its to often
No 2 might, maybe, perhaps work to my liking IF the interrupts has different priorities. The Atmel datasheets suggests that they might have, but every thread in the forums say that thay have equal priority.
Nah… when i come to think about it, i´m using timer1 interrupts already for the precise timing and that interrupt is lower in the interrupt list than external interrupts… sigh
Any bright idea anyone ???