I remembered that I have some of this stuff on github. Here's the example C file that sets up the timers on an Ardunio board.

http://github.com/sw17ch/atom-arduino-experiments/blob/master/Blink/blink.c

Notice that the main function does nothing. All the work is done by blink_atom() which is called out of the ISR (Interrupt Service Routine).

On Fri, Jan 1, 2010 at 10:48 AM, John Van Enk <vanenkj@gmail.com> wrote:
Hi Jason,

Regarding timing, the version of blink_atom.c below does not contain this, but my later versions used the hardware timers to control the blink rate.

One can setup the interrupt vector for a hardware timer to call your outermost atom function at whatever resolution you want. As long as the timer allows enough time between expirations for any of the task groups to finish, it will run in hard real time.

Hope this helps.

John Van Enk


On Thu, Dec 31, 2009 at 10:43 PM, Jason Dusek <jason.dusek@gmail.com> wrote:
 I'm working with Atom to program an ATtiny25. I am curious
 about how consistent the timings actually are.

 Consider John Van Enk' example of blinking a LED on an
 Arduino:

   http://code.sw17ch.com/blog/atom/blink_atom.c

 We see that sometimes `setLED' is executed and sometimes not.
 When `__clock' is incremented, it will be incremented
 sometimes sooner, sometimes later.

 Also, I am a little puzzled by the `__coverage` variable. What
 does it do?

 As for my project/motivation -- I'm just trying to blink a
 little LED on much less robust/rich kit -- the Trippy RGB
 Waves kit from Lady Ada. I am (gratuitously) exploring ways to
 program it with Haskell.

--
Jason Dusek
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe