Delta Tau GEO BRICK LV Reference Manual

Page of 760
Turbo PMAC/PMAC2 Software Reference
 
Turbo PMAC Program Command Specification 
 430 
Note: 
With nested IF branches, be careful to match the ELSE statements to the proper 
IF statement.  In a motion program, it is possible to have a single-line IF 
statement (IF({condition}) {action}).  An ELSE statement on the next 
program line is matched to this IF statement automatically, even if wanting to 
match a previous IF statement.  Put a non-ELSE statement in between to make the 
next ELSE statement match a previous IF statement. 
ELSE lines can take two forms (only the first of which is valid in a PLC program): 
With no statement following on that line, all subsequent statements down to the next ENDIF statement 
will be executed provided that the preceding IF condition is false. 
ELSE 
     {statement} 
     [{statement} 
     ...] 
ENDIF 
With a statement or statements following on that line, the single statement will be executed provided that 
the preceding IF condition is false.  No ENDIF statement should be used in this case 
ELSE {statement} [{statement}...] 
Note: 
(This single-line ELSE branch form is valid only in motion programs.  If this is 
tried in a PLC program, Turbo PMAC will put the statements on the next program 
line and expect an ENDIF to close the branch.  The logic will not be as expected.)   
Examples: 
This first example has multi-line true and false branches.  It could be used in either a motion program or a 
PLC program. 
IF (M11=1) 
 
P1=17 
 
P2=13 
ELSE 
 
P1=13 
 
P2=17 
ENDIF 
This second example has a multi-line true branch, and a single-line false branch.  This structure could 
only be used in a motion program. 
IF (M11=0) 
 
X(P1) 
 
DWELL 1000 
ELSE DWELL 500 
This example has a single-line true branch, and a multi-line false branch.  This structure could be used 
only in a motion program. 
IF (SIN(P1)>0.5) Y(1000*SIN(P1)) 
ELSE 
 
P1=P1+5 
 
Y(1100*SIN(P1)) 
ENDIF 
This example has single-line true and false branches.  This structure could be used only in a motion 
program. 
IF (P1 !< 5) X10