How to blink 8 LEDs at different rates- concurrently?


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    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.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    No I have not seen that link, thanks for pointing it out. I looked at Salvo and several other co-operative and pre-emptive RTOSes. Salvo is actually quite nice and has a small footprint. However, at $1,500 for a full-source license, it is somewhat pricey for my current needs - although it must be said that compared to some other commercial (particularly the pre-emptive ones such Avix, CMX, etc.) products, you could still call it a bargain. There are several free (and/or open source) pre-emptive systems for higher end devices but I find them extremely cumbersome to use and very resource hungry. The few that I looked at required about 20K ROM and 5-6K RAM for a useable configuration. I am also wanting something that can be easily ported to other devices/platforms (such as PIC24/dsPIC33 and 32-bit ARM Cortex M0/M3) and can be implemented using only a high level language (whether BASIC or C).

    I have implemented what is basically a time-sliced task handler that will do 16 tasks in about 250 bytes of ROM and 75 bytes of RAM - additional tasks require 2 bytes of RAM per task. Small enough to run on a PIC12/16 - reducing the number of tasks could reduce the ROM (and RAM) footprint even further. Works fine - as I mentioned in a previous post, I have an application where an RTC is implemented using one of the tasks as an accurate seconds counter.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts