I am working on the skeleton of a generic task handler that will manage say 16 tasks concurrently. The LEDs are just simulating tasks that occur at set intervals. One of the tasks will be a seconds counter (with an interval of 1000mS) that is the basis of a RTC (good to the accuracy/stability of the HS crystal clock) and accurate timing is therefore an important concern. So using any kind of Pause or Delay function would not work.
Using a hardware timer is really the only way to do it. However, the timer also has to account for whatever time is used up by instruction cycles - which can vary depending on conditional branches and time spent in each task. DT's method of using a CCP in compare mode solves this problem nicely. Thanks.
Bookmarks