Reference Manual

Turbo PMAC/PMAC2 Software Reference
Turbo PMAC Program Command Specification 459
OR({condition})
Function: Conditional OR
Type: PLC program
Syntax: OR ({condition})
This statement forms part of an extended compound condition to be evaluated in a PLC program. It must
immediately follow an IF, WHILE, AND, or OR statement. This OR is a boolean operator logically
combining the condition on its line with the condition on the program line above.
It takes lower precedence than operators within a compound condition on a single line (those within
parentheses), and also lower precedence than an AND operator that starts a line. (ORs operate on groups
of ANDed conditions.)
In motion programs, there can be compound conditions within one program line, but not across multiple
program lines, so this statement is not permitted in motion programs.
Note:
This logical OR, which acts on conditions, should not be confused with the bit-by-
bit | (vertical bar) or-operator, which operates on values.
Examples:
IF (M11=1) ; This branch increments P1 every cycle that
AND (M12=0) ; inputs M11 and M12 are different, and decrements
OR (M11=0) ; them every cycle that they are the same.
AND (M12=1)
P1=P1+1
ELSE
P1=P1-1
ENDIF
IF (M11=1 AND M12=0) ; This does the same as above
OR (M11=0 AND M12=1)
P1=P1+1
ELSE
P1=P1-1
ENDIF
See Also:
Conditions (Program Computational Features)
Writing a PLC Program
Program commands IF, WHILE, AND
P{data}={expression}
Function: Set P-Variable Value
Type: Motion program (PROG and ROT)
Syntax: P{data}={expression}
where:
{data} is a constant, or an expression in parentheses, for an integer value from 0 to 8191
representing the P-variable number;
{expression} represents the value to be assigned to this P-variable.
This command sets the value of the specified P-variable to that of the expression on the right side of the
equals sign. The assignment is done as the line is processed, which usually in a motion program is one or
two moves ahead of the move actually executing at the time (because of the need to calculate ahead in the
program).