RobotStudio event

IO problem

hello
 

i am trying to write a quick bit of RAPID.

i have do1, do2 and do3.

 

depending on the state of all three i have 8 options.

do1, do2, do3 off

do1 on do2 do3 off

so on so on

 

does anyone know how to write if statements testing the value of an IO signal?

 

please any code would be greatly appreciated.

Comments

  • osku
    osku ✭✭
    Hi
     

    You can use for example IF-statement. For inputs you can use it like this:

     

    IF di1=1 THEN

      !This will be executed if the signal value is 1

    ENDIF

     

    For output testing you need to use DOutput-function, like this:

     

    IF DOutput(do1)=1 THEN

      !This will be executed if the signal value is 1

    ENDIF

     

    When you wrote about different states of the three output, you might be also interested to find out about group signals. You can define your three digital output signals as one group output and that way you can simplify your RAPID code. Then you can use instruction SetGO to set value for the group output. This way you don't have to manually set or reset all the digital signals. For example like this:

     

    SetGO go1, 5;

     

     

    -Osku

     

     


  • thank you for the help.
    worked perfectly