PMAC Product Guide Examples: IF (P1>0) X1000 ENDIF IF (P5=7) X1000 ELSE X2000 ENDIF ENDWHILE Function : Mark end of conditional loop Type : Motion program (PROG only), PLC program Syntax : ENDWHILE ENDW This statement marks the end of a conditional loop of statements begun by a WHILE statement. WHILE loops can be nested, so an ENDWHILE statement matches the most recent WHILE statement not matched already by a previous ENDWHILE statement. In a motion program a WHILE statement with an action on the same line does not require a matching ENDWHILE .
In the execution of a PLC program, when an ENDWHILE statement is encountered, that scan of the PLC is ended, and PMAC goes onto other tasks (communications, other PLCs). The next scan of this PLC will start at the matching WHILE statement. In the execution of a motion program, if PMAC finds two jumps backward (toward the top) in the program while looking for the next move command, PMAC will pause execution of the program and not try to blend the moves together. It will go on to other tasks and resume execution of the motion program on a later scan. Two statements can cause such a jump back: ENDWHILE and GOTO ( RETURN does not count).
The pertinent result is that PMAC will not blend moves when it hits two ENDWHILE statements (or the same ENDWHILE twice) between execution of move commands. Examples: WHILE (Q10 Q10=Q10+1 ENDWHILE F{data} Function : Set move feedrate (velocity) Type : Motion program (PROG and ROT) Syntax : F{data} where {data} is a positive floating-point constant or expression representing the vector velocity in user length units per user time units. This statement sets the commanded velocity for upcoming LINEAR and CIRCLE mode blended moves. It will be ignored in other types of moves ( SPLINE , PVT , and RAPID ).
It overrides any previous TM or F statement, and is overridden by any following TM or F statement. 214 Buffer Commands