RobotStudio event

Sharing global variable between multiple tasks

Hello to all, I would need some help regarding rapid programming. If we have two or more tasks how can we share some bool variable between them, where to declare them, since they are visible only in task in which they are created. Thanks in advance.

Comments

  • Hi Pacijent,

    I think if you declare it like:

    PERS BOOL yourName := FALSE;

    In your main task and like:

    PERS BOOL yourName;

    In all the other task, it should be the same value across all tasks.

    Hope it will work :)

    Regards, Lars
    Lars Glud
    Danrob A/S
  • Thanks a lot Lars, that works :).
  • It does not seems to work with a clock.
  • Persistent declaration is not allowed in routine"error
  • You need to declare PERS out of the routine, as a global, in all the tasks you want to share with. That works fine. 


    Un saludokind regards,


    Daniel Aguilar

    Automation Engineering