9 branching commands: if...else...iend – Yaskawa MP900 Series Motion Programming Manual User Manual
Page 110

Advanced Programming
3.1.9 Branching Commands: IF...ELSE...IEND
3 -20
3.1.9 Branching Commands: IF...ELSE...IEND
J
Overview
The Branching commands (IF...ELSE...IEND) execute the block between IF and ELSE when
a conditional expression is satisfied. If the conditional expression is not satisfied, the block be-
tween ELSE and IEND is executed.
J
Description
The Branching commands (IF...ELSE...IEND) are designated as follows:
IF (conditional_expression);
… (process_1)
ELSE;
… (process_2)
IEND;
With branching commands, process 1 is executed if the conditional expression is satisfied, and
process 2 is executed if the conditional expression is not satisfied.
D
ELSE can be omitted. If it is omitted and the conditional expression is not satisfied, execution
will continue from the block after IEND.
Conditional
expression
Not satisfied
Satisfied
Process 1
Process 2
Nesting of the branching commands (IF...ELSE...IEND) is restricted to a maximum of eight levels.
J
Programming Examples
IF MB−==1;
MOV [axis 1] 10000;
← When MB is ON, positioning is executed for axis 1.
ELSE;
MOV [axis 2] 10000;
← When MB is OFF, positioning is executed for axis 2.
IEND;
3
IMPORTANT
A
EXAMPLE
"