RobotStudio event

Share Variables Between Tasks

Hi,

I would like to share some variables and it's values between different tasks.... I've already done before but, I'm actually doing the commissioning of an IRB2600 RW6.03.02 and it's not sharing the values.

I'm defining same variables in the 3 tasks.

    VAR string date;
    VAR string time;

And updating them in one of the Tasks.

    PROC CheckDate()
        !Save date and time in a variable
        date:=CDate();
        time:=CTime();

    ENDPROC


And it's only taking the values in the Tasks that where I read the CheckDate procedure.

Am I missing something?

Thanks,

Daniel


Un saludokind regards,


Daniel Aguilar

Automation Engineering


Comments

  • Micky
    Micky ✭✭✭
    Hi,

    if you want to share variables you have the follwing both possibilties:

    1. You create a separate module with the both variables and load it shared via the system paramter "Controller --> Automatic loading of modules". If the module is loaded the variables will be available in all tasks.

    2. You define in each task where you want to use the data as persistent. In one task you define a start value and in the other task you define the persistent without start value. In this case you have noch problem which data wil be used if you loading the modules into the tasks.

    Example:

    TASK 1:
        PERS string date:="";
        PERS string time:="";

    TASK 2:
        PERS string date;
        PERS string time;

    TASK 1:
        PERS string date;
        PERS string time;

    /BR
    Micky
  • Micky said:
    Hi,

    if you want to share variables you have the follwing both possibilties:

    1. You create a separate module with the both variables and load it shared via the system paramter "Controller --> Automatic loading of modules". If the module is loaded the variables will be available in all tasks.

    2. You define in each task where you want to use the data as persistent. In one task you define a start value and in the other task you define the persistent without start value. In this case you have noch problem which data wil be used if you loading the modules into the tasks.

    Example:

    TASK 1:
        PERS string date:="";
        PERS string time:="";

    TASK 2:
        PERS string date;
        PERS string time;

    TASK 1:
        PERS string date;
        PERS string time;

    /BR
    Micky
    Thanks buddy, my problem was that I defines the variables as VAR. It must be PERS. Now is working. Thanks!


    Un saludokind regards,


    Daniel Aguilar

    Automation Engineering