omron — WHILE({condition})

PMAC Product Guide Examples: W5 W(P10+33.5) Z10 W10 W(ABS(Q22*Q22)) WAIT Function : Suspend program execution Type : Motion program (PROG and ROT) Syntax : WAIT This command may be used on the same line as a WHILE condition to hold up execution of the program until the condition goes false. When the condition goes false, program execution resumes on the next line. Use of the WAIT statement allows indefinite pauses without the need for repeated use of a servo command (e.g. DWELL or DELAY ) to eat up the time. However, it is impossible to predict how long the pause will be. WAIT permits a faster resumption of the program upon the WHILE condition going false.

Also, the program timer is halted when waiting, which allows the In-position bit to go true (which can be used to trigger an action, or the next move). Since PMAC executes a WHILE ({condition}) WAIT statement every real time interrupt until the condition goes false, essentially it is the same as a PLC0. This could use excessive processor time and in severe cases, trip the watchdog timer on PMAC’s that simultaneously run several motion programs that use WAIT statements and or large PLC0 programs. For example, if the condition only needs to be checked every 20 msec and not every real time interrupt, use a DWELL command to regulate the execution time of the WHILE loop.

WHILE ({condition}) DWELL20 ENDW Examples: WHILE (M11=0) WAIT ; Pause here until Machine Input 1 set WHILE (M187=0) WAIT ; Pause here until all axes in-position M1=1 ; Turn on Output 1 to activate punch WHILE({condition}) Function : Conditional looping Type : Motion program (PROG only); PLC program Syntax : WHILE ({condition}) WHILE ({condition}) {action} where {condition} consists of one or more sets of {expression} {comparator} {expression} , joined by logical operators AND or OR . {action} is a program command. This statement allows repeated execution of a statement or series of statements as long as the condition is true. It is PMAC’s only looping construct. It can take two forms:

(Valid in motion program only) With a statement following on the same line, it will repeatedly execute that statement as long as the condition is true. No ENDWHILE is used to terminate the loop. Buffer Commands 241