Shop OBEX P1 Docs P2 Docs Learn Events
Beans TASKS RUN — Parallax Forums

Beans TASKS RUN

5ms?5ms? Posts: 21
edited 2009-06-23 18:10 in General Discussion
Hi All

Beans TASKS R gr8.
Need a little help, with INTERRUPT RATE.
SXB\'TASK demo code.SXB(27) Line 27, Warning 2, Pass 1: INTERRUPT RATE WILL BE " 1252.003"

-5ms?

Comments

  • BeanBean Posts: 8,129
    edited 2009-06-23 00:18
    Yeah, that is just a warning. The code will still compile and run properly.
    It's just letting you know that the interrupt rate will not be EXACTLY what you specifed.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There is a fine line between arrogance and confidence. Make sure you don't cross it...

    ·
  • 5ms?5ms? Posts: 21
    edited 2009-06-23 00:26
    Hi Bean,
    Thanks for your quick reply.
    Please would you have a look at the code,
    and maybe run it in SXSim.


    Thanks for your time

    -5ms?
  • BeanBean Posts: 8,129
    edited 2009-06-23 11:57
    What am I supposed to be looking for ???
    The TASKS are going to take FOREVER to run in the simulator because you are using 50MHz in the code and the simulator runs at a constant speed (very slow).

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There is a fine line between arrogance and confidence. Make sure you don't cross it...

    ·
  • 5ms?5ms? Posts: 21
    edited 2009-06-23 15:26
    Hi Bean,
    Thank you for having a look at the code.
    The main thing is the Interrupt rate?,
    what is a good Interrupt rate?,
    how many instructions will I get in each Task at Interrupt rate of (#####)
    is there a some, like TaskInstructions = (Clock / InterruptRate) - (TicksbetweenTasks * 5) ?


    As I posted it with "SUB INTERRUPT InterruptRATE_0" it is " (very slow)"
    But change to "SUB INTERRUPT InterruptRATE_9" and it's not so slow

    2: call subs out of the Tasks,is this ok????
    If you run the code in the SXSim as I posted, But change to SUB INTERRUPT InterruptRATE_9 then stop it then walk it
    In the Status "Next instruction" you will see PAGE _BeanBREAK[noparse][[/noparse]000] coming up all the time,
    but this sub is only called in one task, do I need to add a RETURN to the sub,
    or is the task still running,

    Thanks.
    5ms.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-06-23 18:10
    Tasks are not pre-emptive and so there is no fixed number of instructions per task.
    If·you specify an·interrupt rate INTERRUPTRATE, and·you·use
    TASKS RUN,nTICKS

    then there will·be a tasktick every nTICKS/INTERRUPTRATE seconds.

    Using TASKS SET,...
    you define the rate at which a specific task is called.
    This task suspends the mainloopcode until the·task returns.
    The task should therefore never·block.
    During task·execution the interrupt remains·running.

    Ideally each·task should return within 1·tasktick.
    If you have N tasks, the tasks should run every·N taskticks.
    That way tasks·do not overlap and each·task will start on time.

    You can call FUNCs and SUBs from a task.

    regards peter
Sign In or Register to comment.