REQUISITO DE ACUERDO CON LAS
4.4 MARCO METODOLÓGICO
Table 6–2. Actions (Cont’d)
HOLD PULSE DOUT[n] FOR t
UNHOLD UNPAUSE
routine_name ABORT
SIGNAL EVENT[n] CONTINUE
PAUSE
SIGNAL SEMAPHORE[n]
6.1 CONDITION HANDLER OPERATIONS
Global condition handler operations differ from those of local condition handlers. Table 6–3
summarizes condition handler operations.
Table 6–3. Condition Handler Operations
OPERATION GLOBAL CONDITION HANDLER LOCAL CONDITION HANDLER
Define CONDITION[n]:<WITH $SCAN_TIME = n>. WHEN conds DO actions
ENDCONDITION
MOVE ... ,
WHEN conds DO actions UNTIL conds
UNTIL conds THEN actions ENDMOVE
Enable ENABLE CONDITION[n] (statement or action)
Motion start, RESUME or UNHOLD Disable DISABLE CONDITION[n] (statement or
action) or conditions satisfied
Motion STOP or HOLD Purge PURGE CONDITION[n] (statement),
program terminated
Motion completed or canceled, program terminated, or conditions satisfied
6.1.1 Global Condition Handlers
Global condition handlers are defined by executing a CONDITION statement in the executable section of a program. The definition specifies conditions/actions pairs. The following rules apply to global condition handlers.
6. CONDITION HANDLERS MARRCRLRF04071E REV B
• Each global condition handler is referenced throughout the program by a specified number, from 1 to 1000. If a condition handler with the specified number was previously defined, it must be purged before it is replaced by the new one.
• The conditions/action s pairs of a global condition handler are specified in the WHEN clauses of a CONDITION statement. All WHEN clauses for a condition handler are enabled, disabled, and purged together.
• The condition list represents a list of conditions to be monitored when the condition handler is scanned.
• By default, each global condition handler is scanned at a rate based on the value of $SCR.$cond_time. If the ‘‘WITH $SCAN_TIME = n’’ clause is used in a CONDITION statement, the condition will be scanned roughly every ‘‘n’’ milliseconds. The actual interval between the scans is determined as shown inTable 6–4.
Table 6–4. Interval Between Global Condition Handler Scans
"n" Interval Between Scans
n <= $COND_TIME $COND_TIME
$COND_TIME < n <= (2 * $COND_TIME) (2 * $COND_TIME) (2 * $COND_TIME) < n <= (4 * $COND_TIME) (4 * $COND_TIME) (4 * $COND_TIME) < n <= (8 * $COND_TIME) (8 * $COND_TIME) (8 * $COND_TIME) < n <= (16 * $COND_TIME) (16 * $COND_TIME) (16 * $COND_TIME) < n <= (32 * $COND_TIME) (32 * $COND_TIME) (32 * $COND_TIME) < n <= (64 * $COND_TIME) (64 * $COND_TIME) (64 * $COND_TIME) < n <= (128 * $COND_TIME) (128 * $COND_TIME) (128 * $COND_TIME) < n <= (256 * $COND_TIME) (256 * $COND_TIME)
(256 * $COND_TIME) < n (512 * $COND_TIME)
• Multiple conditions must all be separated by the AND operator or the OR operator. Mixing of AND and OR is not allowed.
• If AND is used, all of the conditions of a single WHEN clause must be satisfied simultaneously for the condition handler to be triggered.
• If OR is used, the actions are triggered when any of the conditions are TRUE.
• The action list represents a list of actions to be taken when the corresponding conditions of the WHEN clause are simultaneously satisfied.
• Multiple actions must be separated by a comma or a new line.
Global Condition Handler Definitionsshows three examples of defining global condition handlers. See Also: $SCR.$cond_time System Variable, FANUC Robotics Software Reference Manual $SCAN_TIME Condition Handler Qualifier, FANUC Robotics Software Reference Manual
MARRCRLRF04071E REV B 6. CONDITION HANDLERS
Global Condition Handler Definitions
CONDITION[1]: --defines condition handler number 1
WHEN DIN[1] DO DOUT[1] = TRUE --triggered if any one WHEN DIN[2] DO DOUT[2] = TRUE --of the WHEN clauses WHEN DIN[3] DO DOUT[3] = TRUE --is satisfied
ENDCONDITION
CONDITION[2]: --defines condition handler number 2 WHEN PAUSE DO --one condition triggers
AOUT[speed_out] = 0 --multiple actions DOUT[pause_light] = TRUE
ENABLE CONDITION [2] --enables this condition ENDCONDITION --handler again CONDITION[3]:
WHEN DIN[1] AND DIN[2] AND DIN[3] DO --multiple DOUT[1] = TRUE --conditions separated by AND; DOUT[2] = TRUE --all three conditions must be DOUT[3] = TRUE --satisfied at the same time ENDCONDITION
• You can enable, disable, and purge global condition handlers as needed throughout the program. Whenever a condition handler is triggered, it is automatically disabled, unless an ENABLE action is included in the action list. (See condition handler 2 inGlobal Condition Handler Definitions.) — The ENABLE statement or action enables the specified condition handler. The condition
handler will be scanned during the next scan operation and will continue to be scanned until it is disabled.
— The DISABLE statement or action removes the specified condition handler from the group of scanned condition handlers. The condition handler remains defined and can be enabled again with the ENABLE statement or action.
— The PURGE statement deletes the definition of the specified condition handler. • ENABLE, DISABLE, and PURGE have no effect if the specified condition handler is not
defined. If the specified condition handler is already enabled, ENABLE has no effect; if it is already disabled, DISABLE has no effect.
Using Global Condition Handlersshows examples of enabling, disabling, and purging global condition handlers.
Using Global Condition Handlers
CONDITION[1]: --defines condition handler number 1 WHEN line_stop = TRUE DO DOUT[1] = FALSE
ENDCONDITION
6. CONDITION HANDLERS MARRCRLRF04071E REV B
WHEN line_go = TRUE DO
DOUT[1] = TRUE, ENABLE CONDITION [1] ENDCONDITION
ENABLE CONDITION[2] --condition handler 2 is enabled . . .
IF ready THEN line_go = TRUE; ENDIF
--If ready is TRUE condition handler 2 is triggered (and --disabled) and condition handler 1 is enabled.
--Otherwise, condition handler 2 is not triggered (and is --still enabled), condition handler 1 is not yet enabled, --and the next two statements will have no effect.
DISABLE CONDITION[1] ENABLE CONDITION[2] . . .
ENABLE CONDITION[1] --condition handler 1 is enabled . . .
line_stop = TRUE --triggers (and disables) condition handler 1 . . .
PURGE CONDITION[2] --definition of condition handler 2 deleted ENABLE CONDITION[2] --no longer has any effect
line_go = TRUE --no longer a monitored condition
6.1.2 Local Condition Handlers
A local condition handler is defined at the end of a MOVE statement and includes one or more conditions/actions pairs in conjunction with the WHEN or UNTIL clauses. The following rules apply to local condition handlers:
• They are defined only during execution of a particular motion statement and are automatically enabled when the motion starts, and purged when the motion completes or is cancelled. • A comma (,) separates the condition handler definition from the rest of the MOVE statement. • The reserved word ENDMOVE, which must be on a new line, ends a MOVE statement that
contains condition handler definitions.
• The conditions/actions pairs of a local condition handler can be specified in WHEN clauses or UNTIL clauses.
• WHEN clauses and UNTIL clauses can be used in any order and combination; each must begin on a separate line.
— The WHEN clause specifies conditions to be monitored and actions to be taken when the conditions are satisfied.
— The UNTIL clause specifies that the motion is to be canceled if the conditions are satisfied.
MARRCRLRF04071E REV B 6. CONDITION HANDLERS