Reference Manual

PMAC 2 Software Reference
324 PMAC Program Command Specification
If the condition is false, it will not execute those statements.
It will only execute any statements on a false condition if the line immediately following
begins with ELSE. If the next line does not begin with ELSE, there is an implied ENDIF
at the end of the line. When there is an ELSE statement on the motion-program line
immediately following an IF statement with actions on the same line, that ELSE
statement is automatically matched to this IF statement, not to any preceding IF
statements under which this IF statement may be nested.
With no statement following on that line, if the condition is true, PMAC will execute all
subsequent statements on following lines down to the next ENDIF or ELSE statement
(this syntax is valid in motion and PLC programs). If the condition is false, it will skip to
the ENDIF or ELSE statement and continue execution there.
In a rotary motion program, only the single-line version of the IF statement is permitted.
No ELSE or ENDIF statements are allowed.
In a PLC program, compound conditions can be extended onto multiple program lines
with subsequent AND and OR statements.
There is no limit on nesting of IF conditions and WHILE loops (other than total buffer
size) in fixed motion and PLC programs. No nesting is allowed in rotary motion
programs.
Example
IF (P1>10) M1=1 ; OK in PROG & ROT, not in PLC
IF (M11=0 AND M12!=0) M2=1 M3=1 ; OK in PROG & ROT, not in PLC
; OK in PROG only, not ROT or PLC
IF (M1=0) P1=P1-1
ELSE P1=P1+1 ; OK in PROG only, not ROT or PLC
IF (M11=0)
P1=1000*SIN(P5)
X(P1)
ENDIF
; OK in PLCs, not PROG or ROT
IF (P1<0 OR P2!<0)
AND (P50=1)
P10=0
ELSE
P10=1
ENDIF
See Also
Conditions (Program Computational Features)
Program commands ELSE, ENDIF, WHILE, AND, OR
INC
Function
Incremental Move Mode
Type
Motion program
Syntax
INC [({axis}[,{axis}...])]
where:
{axis} is a letter specifying a motion axis (X, Y, Z, A, B, C, U, V, W), or the letter
R specifying the arc center radial vector.
Note
No spaces are permitted in this command.