tic tic tic or how to get low Hz (but precisely)

Ok After reading 2e23 posts I'm more lost than ever...

What I want : Power something (5V) at low frequency cycle (lest say at 0.555Hz and 0.75 Hz) . And I want it to be as precise as possible. (maybe +- 1 microsec).

What I found : 1) playing with the PWM cycle. But could i get this low in Hz and get the no standard frequency?

2) using microdelay and digitalwrite ?

3) And more complicated count the tic with a interrupt? Which way could work ...

I think the problem is that to get precision you have to run without a pre-scale on the clock but without the pre-scale the maximum timer interval is too short for your frequency. There are probably tricks to get a precision interval accurate to 1/16th microsecond (the system clock frequency). You could set the clock to "normal" mode and count overflow interrupts until you get to within one overflow of the desired time, then switch the mode to toggle the output at the desired count. When the desired count is reached, use the interrupt to go back to "normal" mode and start counting overflows again.

slybean: Ok After reading 2e23 posts I'm more lost than ever...

What I want : Power something (5V) at low frequency cycle (lest say at 0.555Hz and 0.75 Hz) . And I want it to be as precise as possible. (maybe +- 1 microsec).

Investigate hardware timers if you want to do it with an Arduino. - http://playground.arduino.cc/code/timer1 -

count the overflows in an unsigned long (uint32_t) and switch the tic when needed value is reached.

use direct port manipulation - http://arduino.cc/en/Reference/PortManipulation -

Good , Did find this post. http://www.engblaze.com/we-interrupt-this-program-to-bring-you-a-tutorial-on-arduino-interrupts/

And I will investigate

If you don't mind not using Arduino you could use a gate osccilator and a crystal then use that as an interrupt for Arduino or divide the clock eg a 4017 or any other ic counter.

You can get a very accurate 1s pulse from most GPS modules.

All the options you listed seem feasible. The second one (doing it all in software using delays and digital I/O) would involve least learning but would give poorest timing accuracy, so you could give it a try and see whether it's accurate enough for you.

Posted by: michinyon You can get a very accurate 1s pulse from most GPS modules.

For about $1 total: http://www.insidegadgets.com/2011/10/08/how-to-use-a-32khz-watch-crystal-on-an-attiny85/

Ray