Task switcher for 8052

2008-04-16
2013-03-12
  • Jose Barbosa
    Jose Barbosa
    2008-04-16

    Does someone have  some information where can I find a kind of task switcher ( not a full RTOS ) that allows me to work with a bout 5 tasks (round robbin ). The reason is that I have a limited external ram (about 2K) and one of the tasks have to make floating point calculations.
    Best Regards
    JB

     
    • Hi,

      > 5 tasks (round robbin )

      sounds as if this skeleton could fit:

      --8<---------------------------------
      bit something_to_do_for_task_1 = 1;
      bit something_to_do_for_task_2 = 1;
      bit something_to_do_for_task_3 = 1;
      bit something_to_do_for_task_4 = 1;

      void init(void);
      void task1(void);
      void task2(void);
      void task3(void);
      void task4(void);

      void main(void)
      {
          init();

          while(1)
          {
              if(something_to_do_for_task_1)
                  task1();
              if(something_to_do_for_task_2)
                  task2();
              if(something_to_do_for_task_3)
                  task3();
              if(something_to_do_for_task_4)
                  task4();
          }
      }
      -->8---------------------------------