Reference Manual

Turbo PMAC/PMAC2 Software Reference
Turbo PMAC Program Command Specification 482
Z10 W10
W(ABS(Q22*Q22))
M50 W1
See Also:
Program commands {axis}{data}, A, B, C, U, V, X, Y, Z, CALL, PRELUDE, READ
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. Turbo PMAC will not blend moves through a true WHILE…WAIT loop.
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 Turbo PMAC executes a WHILE ({condition}) WAIT statement every Real Time Interrupt
until the condition goes false, it is essentially the same as a PLC0. This could use excessive processor
time and in severe cases trip the watchdog timer on Turbo PMAC’s that simultaneously run several
motion programs that use WAIT statements and or large PLC0 programs. For example, if the condition
needs to be checked only every 20 msec and not every Real Time Interrupt, consider using a DWELL
command to regulate the execution time of the WHILE loop.
Examples:
WHILE ({condition})
DWELL20
ENDW
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
See Also:
I-variable Ixx28
Program commands DWELL, DELAY, STOP
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 Turbo PMAC’s only looping construct. It can take two forms: