1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

task give up it's time tick in uc/os

Discussion in 'Embedded' started by vinge.ven, Dec 29, 2008.

  1. vinge.ven

    vinge.ven Guest

    I want to konw if there's a method in uc/os to make a task give up
    i'ts tick to a lower priority task?

    I have a hight prioriy task that must be run 1 time pre ms. but after
    it finish, I want it give remain tick times
    to the lower priority task.

    can uc/os do that and how? (sorry for my poor english!)
    vinge.ven, Dec 29, 2008
    1. Advertisements

  2. vinge.ven

    FreeRTOS.org Guest

    Presumably after the task has executed it makes an API call to say "run me
    again 1ms after I last started" (in FreeRTOS this would be
    vTaskDelayUntil(), I don't know what the uCOS equivalent is). Once this
    function is called the calling task would be placed in a Blocked state and
    not consume any more processing time until its delay period expired - so
    what you want to happen will happen automatically.

    I'm not even sure that uCOS will implement a time slicing scheme in any case
    as each task must have a unique priority - so timeslicing would not make any
    sense. Again this is different to FreeRTOS where you can assign unique
    priorities to each task, or allow tasks to share priorities - also you can
    choose to use time slicing or not.


    + http://www.FreeRTOS.org
    Designed for microcontrollers. More than 7000 downloads per month.

    + http://www.SafeRTOS.com
    Certified by TUV as meeting the requirements for safety related systems.
    FreeRTOS.org, Dec 29, 2008
    1. Advertisements

  3. Many methods are available. Simplest may be to do a delay for 1 ms. This
    assumes your tick rate OS_TICKS_PER_SECOND has enough resolution, at least
    1000 ticks per second. If this is the case then an OSTimeDly(1) would be a
    1 ms delay. During the delay the task is in a NOT ready state, so any lower
    priority task will run.

    A second approach may be to have a timer generate an interrupt on a 1 ms
    interval. The ISR could then signal a semaphore (or about any other
    mechanism) OSSemPost(semaphore1) that the high priority task is pending on.
    Such as OSSemPend(semaphore1). Make sure to create the semaphore before
    trying to use it.

    Not Really Me, Dec 29, 2008
  4. or use an OS_timer
    bigbrownbeastiebigbrownface, Jan 9, 2009
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.