Delta Tau GEO BRICK LV Manuale Utente
Turbo PMAC User Manual
342
Writing and Executing Motion Programs
The first 360 pieces will be blended (splined) together on the fly as Turbo PMAC cycles through the inner
loop. But when PMAC increments P2 to 360, it hits the first ENDWHILE and jumps back to the inner
WHILE condition, which is now false, so it jumps down, increments P1, hits the second ENDWHILE, and
jumps back to the outer WHILE condition, all without encountering a move command.
At this point, Turbo PMAC invokes the double-jump-back rule and lets the last programmed move come
to a stop. It does this to prevent the possibility that it might be caught in an indefinitely true set of loops
with no movement, which could mean that it would not have the next move equations ready in time. It
resumes calculations when this move has finished and will start up the next sequence of moves in the
inner loop.
loop. But when PMAC increments P2 to 360, it hits the first ENDWHILE and jumps back to the inner
WHILE condition, which is now false, so it jumps down, increments P1, hits the second ENDWHILE, and
jumps back to the outer WHILE condition, all without encountering a move command.
At this point, Turbo PMAC invokes the double-jump-back rule and lets the last programmed move come
to a stop. It does this to prevent the possibility that it might be caught in an indefinitely true set of loops
with no movement, which could mean that it would not have the next move equations ready in time. It
resumes calculations when this move has finished and will start up the next sequence of moves in the
inner loop.
To blend all of these moves together continuously, pull the last move of the inner loop outside of the
inner loop. This way, never will two ENDWHILE statements be encountered between move commands:
inner loop. This way, never will two ENDWHILE statements be encountered between move commands:
SPLINE1 TM20
P1=0
WHILE (P1<10)
P2=0
WHILE
WHILE
(P2<359)
; Note that loop stops earlier
X(P1*SIN(P2))
P2=P2+1
ENDWHILE
X(P1*SIN(P2))
X(P1*SIN(P2))
; Last move from inner loop
P1=P1+1
ENDWHILE
Looping to Wait:
There are several methods for holding program execution while waiting for a certain condition to occur.
Usually, this is done with a WHILE loop, but what is done inside the loop has an effect on responsiveness
and calculation load.
Usually, this is done with a WHILE loop, but what is done inside the loop has an effect on responsiveness
and calculation load.
The fastest execution is the WHILE({condition}) WAIT loop. As soon as the WAIT command is
encountered, motion program calculations are suspended until the next real-time interrupt, at which time
they will re-evaluate the condition. The motion program effectively becomes like a one-line PLC
program. If the next RTI has already occurred, it will immediately re-enter the interrupt service routine
and re-evaluate the condition. If this occurs repeatedly, background routines will be starved for time,
slowing PLCs and communications, or in the worst case, tripping the watchdog timer. Usually this
happens only if multiple coordinate systems are in simultaneous WHILE...WAIT loops.
Of similar speed is an empty WHILE...ENDWHILE loop, or at least one with no motion commands
inside. Each RTI, this will execute twice, stopped by the double-jump-back rule. Calculations resume at
the next RTI, or if this has occurred already, they resume immediately, with the same possible
consequences for starving background calculations.
encountered, motion program calculations are suspended until the next real-time interrupt, at which time
they will re-evaluate the condition. The motion program effectively becomes like a one-line PLC
program. If the next RTI has already occurred, it will immediately re-enter the interrupt service routine
and re-evaluate the condition. If this occurs repeatedly, background routines will be starved for time,
slowing PLCs and communications, or in the worst case, tripping the watchdog timer. Usually this
happens only if multiple coordinate systems are in simultaneous WHILE...WAIT loops.
Of similar speed is an empty WHILE...ENDWHILE loop, or at least one with no motion commands
inside. Each RTI, this will execute twice, stopped by the double-jump-back rule. Calculations resume at
the next RTI, or if this has occurred already, they resume immediately, with the same possible
consequences for starving background calculations.
Using a WHILE({condition}) DWELL single-line loop helps to control the looping rate better,
giving time for background routines. The condition is evaluated only once after each DWELL.
giving time for background routines. The condition is evaluated only once after each DWELL.
Implications of Calculating Ahead
The need of the motion program to calculate ahead during a continuous sequence of moves means that
non-motion actions –particularly the setting of outputs – taken by the program happen before you might
think they would – by one or two moves. For variables that are only used within the program, this is no
problem, because everything happens sequentially within the program.
non-motion actions –particularly the setting of outputs – taken by the program happen before you might
think they would – by one or two moves. For variables that are only used within the program, this is no
problem, because everything happens sequentially within the program.
It is possible to move these non-motion actions to a point one or two moves later in the program to get the
actions to occur when they are desired. However this makes the program extremely difficult to read as far
as the proper sequence of operations.
actions to occur when they are desired. However this makes the program extremely difficult to read as far
as the proper sequence of operations.