User guide

188
6000 Series Programmer's Guide
GOWHEN
VS
WAIT
A WAIT will cause the 6000 controller program to halt program flow (except for execution of
immediate commands) until the condition specified is satisfied. Common uses for this
function include delaying subsequent I/O activation until the master has achieved a required
position or an object has been sensed.
By contrast, a GOWHEN will suspend the motion profile for a specific axis until the specified
condition is met. It does not affect program flow. If you wish motion to be triggered with a
trigger input, use the TRGFNc1xxxxxxx command. The TRGFNc1xxxxxxx command
executes in the same manner as the GOWHEN command, except that motion is executed when
the specified trigger input (c) is activated (see Trigger Functions below for details). In
addition, GOWHEN expressions are limited to the operands listed above; WAIT can use
additional operands such as FS (Following status) and VMAS (velocity of master).
Factors Affecting
GOWHEN
Execution
If, on the same axis, a second GOWHEN command is executed before a start-motion command
(GO, GOL, FSHFC, or FSHFD), then the first GOWHEN is over-written by the second GOWHEN
command. (GOWHEN commands are not nested.) An error is not generated when a GOWHEN
command is over-written by another GOWHEN.
While waiting for a GOWHEN condition to be met and a start-motion command has been
issued, if a second GOWHEN command is encountered, then the first sequence is disabled and
another start-motion command is needed to re-arm the second GOWHEN sequence.
A new GOWHEN command must be issued for each start-motion command (GO, GOL, FSHFC,
or FSHFD). That is, once a GOWHEN condition is met and the motion command is executed,
subsequent motion commands will not be affected by the same GOWHEN command.
If the GOWHEN and start-motion commands are issued, the motion profile is delayed until the
GOWHEN condition is met. If a second start-motion command is encountered, the second start-
motion command will override the GOWHEN command and start motion. If this override
situation is not desired, it can be avoided by using a WAIT condition between the first start-
motion command and the second start-motion command.
It is probable that the GOWHEN command, the GO command, and the GOWHEN condition
becoming true may be separated in time, and by other commands. Situations may arise, or
commands may be given which make the GOWHEN invalid or inappropriate. In these cases, the
GOWHEN condition is cleared, and any motion pending the GOWHEN condition becoming true
is canceled. These situations include execution of the JOG, JOY, HOM, PRUN, and DRIVEØ
commands, as well motion being stopped due to hard or soft limits, a drive fault, an
immediate stop (!S), or an immediate kill (!K or ^K).
GOWHEN in Compiled
Motion
(Compiled
Motion is discussed on
page 163)
When used in a compiled program, a GOWHEN will pause the profile in progress (motion
continues at constant velocity) until the GOWHEN condition evaluates true. When executing a
compiled Following profile, the GOWHEN is ignored on the reverse Following path (i.e., when
the master is moving in the opposite direction of that which is specified in the FOLMAS
command). A compiled GOWHEN may require up to 4 segments of compiled memory storage.
Sample
6000 Code
In the example below, axis 2 must start motion when the actual position of axis 1 has reached
4. While axis 1 is moving, the program must be monitoring inputs and serving other system
requirements, so a WAIT statement cannot be used; instead, a GOWHEN and GO sequence will
delay the profile of axis 2.
SCALE1 ; Enable scaling
SCLV25000,25000 ; Set velocity scaling factors
SCLD10000,10000 ; Set distance scaling factors
MC00 ; Set both axes to preset move mode
D20,20 ; Set distance end-point
COMEXC1 ; Enable continuous command execution mode
V1,1 ; Set velocity
A100,100 ; Set acceleration
GOWHEN(,1PE>4) ; Delay
axis 2 profile. When the expression is true (position
; of encoder #1 is > 4), allow axis 2 to start motion.
GO11 ; Command both axes to move. Axis 2 will not start until
; conditions in the GOWHEN statement are true.
; Command processing does not wait, so other system
; functions may be performed.