Scheduling tasks


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    without the whole idea it's hard to say but
    Select case ISRLoop
    CASE 20,40,60,80

    could be interesting.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default Modulus it is...

    Niels,
    Ahh..thank you! Just what I needed!

    So basicly:
    Code:
    Main:
      If ISRLoop // 10 = 0 then
        Gosub 10HzTask
      EndIf
    
      If ISRLoop // 50 = 0 then
        Gosub 2HzTask
      EndIf
    
      If ISRLoop // 2 = 0 then
        Gosub 50HzTask
      EndIf
    
      If (ISRLoop + 1) // 2 = 0 then
        Gosub Other50HzTask
      Endif
    Goto Main
    Or something like that...
    If I got that right it will work. I'll have to make sure that the tasks that may be run at any given time doesn't take longer than a total of 10mS because then ISRLoop will have been incremented before the 'scheduler' can check if the task should run. Need to do some carefull timing and planning here! And perhaps 'spread' the tasks out like with the 'Other50HzTask' above.

    Thanks!
    /Henrik Olsson.

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    One thing to be careful of - any technique that relies on exact counts gets into trouble if a task takes longer than the interrupt interval. If you are unsure of your execution speed, you should check for a count not just equal to, but instead check for equal to or above the specified number of ISRLoop counts.
    Charles Linquist

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