Seyler Jean-Yves wrote: > > Remember I must use a 12C509 without an interrupt :-( > Somebody told me I could use a watchdog wakeup ? (but the timing would be : > 1st not accurate, 2nd too long) > -> any other idea ? > Ok. I went look on the 12C509 datasheet. Here's an idea to keep timings: You have TMR0, and a pre-scaler. I forgot the kind of timings you needed, so this may not work for you. It would avoid the assle of making sure that each task is isochronous.... Imagine this is your main block: main call update_timers call task_1 call task_2 call task_3 goto main TMR0 has a resolution of 1 instruction cycle. When update_timers is called, it reads TMR0 value, and adds it to the timers. If a timer reachs the value you wanted or more, set the flag from that timer. Subtraction might be easier, since you can check flags for a result of zero or less. In this case, timers start with the value you want. This kind of timing is accurate over time, but does not guarantee that you act precisely when the timer ended. There is some jitter. The larger your timers are, the less important the error becomes. You do need to guarantee that update_timers is called in less than 255 instructions, before TMR0 rolls over. This can be done with multiple calls to update_timers, or with small tasks. Your choice. Pre-scaler can be used if timer resolution is bigger. This is just an idea, and details must be sorted out. But it seems to be ok, I think. Any improvements are welcome! 8) Bye, Nuno. -- ---- ~~~~~~~ ------- Nuno Filipe Freitas Pedrosa -- ~~~~ ~~ ----- SIEMENS S.A. Portugal TEL: +351 1 4242454 - ~~~~ ~~ ---- mailto:Nuno.Pedrosa@icn.siemens.de - ~~~~ ~~ ---- "MSWindows - Best run on a SlideShow" =======================================================================