IF (UO[6]=ON AND UO[8]=OFF), (DO[2]=OFF AND RO[1]=OFF AND RO[2]=OFF AND RO[3]=OFF AND RO[4]=OFF AND RO[5]=OFF AND RO[6]=OFF AND RO[7]=OFF AND RO[8]=OFF)
What is the correct way of writing this without writing an IF statement for each one.
Thanks,
D
IF (UO[6]=ON AND UO[8]=OFF), (DO[2]=OFF AND RO[1]=OFF AND RO[2]=OFF AND RO[3]=OFF AND RO[4]=OFF AND RO[5]=OFF AND RO[6]=OFF AND RO[7]=OFF AND RO[8]=OFF)
What is the correct way of writing this without writing an IF statement for each one.
Thanks,
D
Provided you're on a newer controller, you could use the IF THEN statement to accomplish this.
IF (UO[6] AND !UO[8]) THEN ;
DO[2]=OFF ;
RO[1]=OFF ;
RO[2]=OFF ;
RO[3]=OFF ;
RO[4]=OFF ;
RO[5]=OFF ;
RO[6]=OFF ;
RO[7]=OFF ;
RO[8]=OFF ;
ENDIF ;
Edit: Added ! in IF clause.
another option that should work for older controllers is to call a program that will set all the variables to the desired state.
IF UO[6]=ON AND UO[8]=OFF, CALL RESET_VARS
Assign the DO and RO in the RESET_VARS TP program
One more option for interrogating a large amount of inputs or outputs at a time is to set up a group input/output using the desired io then you can against the group IO's integer value.
EX: IF GO[1]=128