- 46 -
Chapter 2. MC Programming
43) IF
Input type
IF <conditional expression> <label name>
Terminology <Conditional expression>: This is a conditional expression of IF statement,
which is composed of a variable and a comparison operator.
<Label name>: If the conditional expression is true, designate the name of a
label to branch.
Related
command
LABL
Application
variable
L variable, E variable
Explanation If the conditional expression of IF statement is true, then branch to the
declared label, and if it is false, then proceed to the next statement.
Conditional expression used: =, .EQ, .LE, .LT, .GE, .GT
=, .EQ: If the two values are equal, it is true. (Ex: IF L0 = 10 … If L0
equals‘10’, then it is true)
.LE: If the value is less or equal, it is true. (Ex: IF L0 .LE 10 … If L0 is
less than or equal to‘10’, then it is true)
.LT: If the value is less, then it is true. (Ex: IF L0 .LT 10 … If L0 is less
than‘10’, then it is true.)
.GE: If the value is greater or equal, then it is true. (Ex: IF L0 .GE 10
… If L0 is greater than or equal to‘10’, then it is true.)
.GT: If the value is greater, then it is true. (Ex: IF L0 .GT 10 … If L0 is
greater than‘10’, then it is true.)
Example
VEL 0
L10 = 0
LABL LB0
L10 = L10 + 1
MOV P1
MOV P2
IF L10 .LE 10 LB0
…
If the value of L10 is less than or equal to ‘10’in the command “IF L10 .LE
10 LB0”, then move to the statement “LABL LB0”. If it is greater than 10,
then proceed to the next command.
Repeat the commands “MOV P1”and“MOV P2”10 times by the transfer of control.
If L10 is less than or equal to
‘10’, then it is true.
Содержание MCU 2 Axis
Страница 1: ...User s Manual 2 AXES...