2010/4/7 m...@watty <[email protected]>:
>
> The full Catpad program will maybe have more than 6 concurrent
> "threads".
Only 6?  ;) ;)

Below is the main loop (C, sorry...) of the largest robot I am working
on, which has 12 tasks and will have a few more in time...

Joep



for (;;) {
   if (PrevIsrCounter != IsrCounter) {
      PrevIsrCounter = IsrCounter;

      // -----------------------------------------------------------------
      // 1ms takt
      // -----------------------------------------------------------------
      CommandoTakt(0) ;       // Takt voor numeric keyboard

      if (!IsrCountDown1) {
         IsrCountDown1 = 10;
              // --------------------------------------------------------------
              // 10ms takt
              // --------------------------------------------------------------

         TaktFase++; // 0 = asynchroon, 1 t/m 5 is fase in 10 ms stappen
         if (TaktFase > 5) {
            TaktFase = 1;
            TaktArray[6] = TaktArray[5];
            TaktArray[5] = 0;
         }
         DoeTaak(TaktFase) ;
         OdoTakt(TaktFase) ;
         MD23Takt(TaktFase) ;
         WandSensorTakt(TaktFase);
         UpsTakt(TaktFase) ;

         UltrasonicTakt(TaktFase) ;

           FsmTakt();
         BgFE.Takt();           

         Bootstrap();   // check if we need to bootstrap
      }

   } // end of ms loop

   CliFE.Takt();
   FileTakt();
   }
} // end of for(;;)
return 0;
}

//------------------------------------------------------------------------
// DumpTaktArray -
//------------------------------------------------------------------------
//------------------------------------------------------------------------
void DumpTaktArray(void)
{  int i;
   long sum;

   // bepaal som, om later percentage te kunnen bepalen.
   sum = 0;
   for (i = 0; i < 5; i++) {
      sum = sum + TaktArray[i];
   }

   printf("//-------------------------\n");
   for (i = 0; i < 5; i++) {
      printf("Takt fase %d, Relatief: %d%%, (%u)\r\n", i+1, (int)((100
* (long)TaktArray[i]) / sum), TaktArray[i]);
   }
   printf("Last full itteration: %u\r\n", TaktArray[6]);

}

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to