B
Bob Monsen
Hi,
I had many requests about pic timers, so that I wrote a little C example to
show how to make multiple non-blocking asynchronous delays with only one pic
timer :
http://www.micro-examples.com/public/microex-navig/doc/099-timers-delays.html
Comments & questions are welcome
Bruno
One thing I don't like about this is that the callback happens at
interrupt level. This will force the callback user to lock his data
structures, and possibly cause interrupt latency problems if the 'user'
isn't careful about how long he keeps control in that callback.
PIC programs are nearly always busy loops, which check for timers or
port changes, and do something in response. Having an interrupt that ticks
away the timers, and sets a bit for the busy loop to check makes more
sense, and is easier to use in a broad range of projects. You can
supply an API to check the bit, or just document the bitmap, which can
then be used as a quick way to test whether any timer has expired.
--
Regards,
Bob Monsen
Insanity: doing the same thing over and over again and expecting
different results.
Albert Einstein, (attributed)