Program flow – Yaskawa LEGEND-MC User Manual

Page 138

Advertising
background image

128

LEGEND-MC User’s Manual

IF

[Program

Flow]

DESCRIPTION:

The IF command is used in conjunction with an ENDIF command to form an IF conditional statement. The
arguments are one or more conditional statements. If the conditional statement(s) evaluates true, the
command interpreter will continue executing commands which follow the IF command. If the conditional
statement evaluates false, the controller will ignore commands until the associated ENDIF command OR an
ELSE command occurs in the program. The conditional statements MUST be enclosed on parentheses for
the expression to be evaluated correctly. See the example below.

ARGUMENTS: IF condition

where

Conditions are tested with the following logical operators:

USAGE:

RELATED COMMANDS:

EXAMPLES:

<

less than

>=

greater than or equal to

>

greater than

<>

not equal

=

equal to

|

logical OR (pipe symbol)

<=

less than or equal to

&

logical AND

While Moving

Yes

Default Value

---

In a Program

Yes

Default Format

---

Command Line

No

Distributed Control

No, Local

"ELSE"

Optional command used only after IF command

"ENDIF"

End of IF conditional Statement

IF (_TEX<1000)

IF conditional statement based on X motor position

MG "Motor within 1000 counts of zero"

Message to be executed if “IF” conditional
statement

ENDIF

End of IF conditional statement

IF ((TEMP=126) | (TEMP=123))

JS # RELEASE

JS # ASSIGN

JS # CONNECT

ENDIF

Advertising