Fanuc Series 15i/150i-MA (Programming) Operators Manual

B-63324EN/03 PROGRAMMING 17.CUSTOM MACRO
- 623 -
17.5.2 Conditional Branch (IF Statement)
A <conditional expression> is specified after IF.
IF[<conditional expression>]GOTOn
If the <conditional expression> is satisfied (true), the processing
branches to sequence number n. If the conditional expression is not
satisfied, a subsequent block is executed.
If the value of variable #1 is greater than 10, a branch to
sequence number N2 occurs.
IF[<conditional expression>]THEN
If the <conditional expression> is satisfied (true), a macro statement
specified after THEN is executed. Only one macro statement can be
executed.
If the values of #1 and #2 are the same, 0 is assigned to #3.
IF[#1 EQ #2] THEN#3=0 ;
If #1 equals #2 and if #3 equals #4, 0 is assigned to #5.
IF[[#1 EQ #2] AND [#3 EQ #4]] THEN#5=0 ;
If #1 equals #2 or if #3 equals #4, 0 is assigned to #5.
IF[[#1 EQ #2] OR [#3 EQ #4]] THEN#5=0 ;
Explanation
- <Conditional expression>
A <conditional expression> can be a <simple conditional expression>
or a <compound conditional expression>. A <simple conditional
expression> has a relational operator as listed in Table 1.1.2 (a)
between two variables or between a variable and a constant. An
<expression> can be specified instead of a variable. A <compound
conditional expression> ANDs (logical product), ORs (logical sum) or
XORs (exclusive logical sum) the results of multiple <simple
conditional expressions>.
If the
condition is
not satisfied
IF [#1 GT 10] GOTO 2 ;
N2 G00 G91 X10.0 ;
:
Procession
If the condition is satisfied

Leave a Reply

Your email address will not be published. Required fields are marked *