Delta Tau GEO BRICK LV 참조 매뉴얼

다운로드
페이지 760
Turbo PMAC/PMAC2 Software Reference
 
Turbo PMAC Program Command Specification 
 483 
(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. 
WHILE ({condition}) {action} 
(Valid in motion and PLC programs) With no statement following on the same line, it will execute 
statements on subsequent lines down to the next ENDWHILE statement. 
WHILE ({condition}) 
 
{statement} 
 
[{statement} 
 
...] 
ENDWHILE 
If a WHILE loop in a motion program has no move, DWELL, or DELAY inside, Turbo PMAC will attempt 
to execute the loop twice (while true) each real-time interrupt cycle (stopped from more loops only by the 
double-jump-back rule), much like a PLC0.  This can starve the background tasks for time, possibly even 
tripping the watchdog timer.  Turbo PMAC will not attempt to blend moves through such an “empty” 
WHILE loop if it finds the loop condition true twice or more.  A WHILE…WAIT loop will operate this way 
on a single jump back. 
In PLC programs, extended compound WHILE conditions can be formed on multiple program lines 
through use of AND and OR commands on the program lines immediately following the WHILE command 
itself (this structure is not available in motion programs).  Conditions in each program line can be either 
simple or compound.  AND and OR operations within a program line take precedence over AND and OR 
operations between lines. 
Examples: 
WHILE (P20=0) 
   ... 
ENDWHILE 
WHILE (Q10<5 AND Q11>1) 
   ... 
ENDWHILE 
WHILE (M11=0) WAIT
 
; sit until input goes true 
INC 
WHILE (M11=0 OR M12=0) X100    ; increment until  2 inputs true 
To do the equivalent of a For/Next loop: 
P1=0 
; Initialize loop counter 
WHILE (P1<10) 
; Loop until counter exceeds limit 
         X1000 
; Perform action to be repeated 
         P1=P1+1 
; Increment loop counter 
ENDWHILE 
; Loop back 
To do a timed wait in a PLC program, use the servo cycle counter as timer 
P90=16777216 
; Counter rollover value (2^24) 
P91=M0 
; Store starting value of M0 (X:$0) counter 
P92=0 
; Time elapsed so far 
WHILE (P92<P93) 
; Loop until past specified time 
        P92=(M0-P91)%P90 
; Calculate time elapsed 
 
; Modulo (%) operation to handle rollover 
ENDWHILE 
; Loop back 
To do extended compound conditions in a PLC program 
WHILE (M11=1 AND M12=1) 
OR (M13=1 AND M14=1) 
AND (P1>0)