RobotStudio event

Multitasking apps with RAB

Dear All, Is it possible to build multitasking apps without using the multitasking option to be activated ? I'm planning to build it with RAB ..what I'm trying to build is an apps to monitor signals and doing several stuffs in the controller .. is it possible ? i tried it on virtual controller .. it works .. but I haven't tried it on the controller .. 

Comments

  • Perhaps I'm asking the wrong question . .anyway any thoughts will be welcome .. thanks
  • Are you interested in running multiple task in the controller or multiple tasks in the FlexPendant?

    Carlos Martinez
    ABB
  • Actually, I'm interested in running multiple task in the flexpendant .. I need to monitor the signal ... here is my gueses ..

    I created the C# . .

    ex :  mythread = new Thread(new ThreadStart(test));

           mythread.start();

           public void test(){

                  while (true){

                          // read IO .. and update changes to the flexpendant

                  }

           }

    Are there any other ways to do this  ... because I personally think this type of code (mycode) will give cpu consuming rate very high..

  • let me restated my posted comment .. I just tried it with virtual signal .. it's not working ...  I got an error message from the virtual flexpendant
  • sorry again. . my mistake it's out of bound issue .. the code works .. anyway .. can any of you guys please give some insight ..
  • Hola,

    You can connect to the Changed event of the class Signal.



    Controller controller = new Controller();

    DigitalSignal doTest = (DigitalSignal)_controller.IOSystem.GetSignal("DO_TEST");
    _doTest .Changed += new SignalChangedEventHandler(doTest_Changed);

    The method doTest_Changed will be called in a different thread that the UI trhead.

    Quick notes:

    1. Remember to set the Access Level of the Signal to ALL

    2. The thread in which your method is called, cannot make any changes in your UI

    3. Try not to "hold" the thread for so much time, since this thread might be use for some other events.

     

    Carlos Martinez
    ABB
  • Hi, .. thanks for the insight.. really helps .. btw in your Quick notes no 2 .. you've mentioned that "The thread in which your method is called, cannot make any changes in your UI" .. did you ment that the method will not update the GUI .. so I better be building a thread wrapper for handling UI issue? anyway .. I've just finished writing my own code using my first method .. would it be best if I switch mine method to yours ? .. thanks carlosmtz2000 ..
  • Hola de nuevo (hi again),

    If you are running in a thread that is not the UI thread, and you try to modify any UI appearance, you will get an exception.

    The drawback of your method is that you are polling data all the time; I will recommend use the event mechanism (cheaper and more elegant)

    Saludos/Carlos

     

    Carlos Martinez
    ABB
  • thanks. ..  you're right ..  I recheck my code with simultanous tests .. I have an deadlock issues .. what a waste .. I'll change them out right the way .. thanks again ..