Cicode Programming Reference > Working with Operators > Using Logical Operators

Using Logical Operators

With logical operators, you can test several conditions as either TRUE or FALSE.

Operator

Description

AND

Logical AND

OR

Logical OR

NOT

Logical NOT

Examples:

Command

Result = (PV12 = 10 AND PV13 = 2);

Comment

If PV12 equals 10 and PV13 equals 2 then Result is TRUE(1)

Expression

Motor_1 AND Motor_2;

Comment

If both Motor_1 and Motor_2 are TRUE, that is Digital bits are 1 or ON, then the expression is TRUE

Expression

PV12 = 1 OR PV13 > 2 OR Counter <> 0;

Comment

If either PV12 equals 1 or PV13 is greater than 2 or Counter is not equal to 0, then the expression is TRUE

Command

Result = (Motor1_Ol OR Motor2_Ol);

Comment

If either Motor1_Ol or Motor2_Ol is TRUE, that is Digital bit is 1 or ON, then Result is TRUE (1)

Command

IF NOT PV12 = 10 THEN ...

Comment

If PV12 does not equal 10 then the result is TRUE. This is functionally identical to IF PV12 <> 10 THEN . . .

Expression

NOT Tag_1;

Comment

This expression is TRUE if Tag_1 = 0. This is commonly used for testing digital variables

See Also

Working with Operators

Using Cicode Files