4 - 7 4 - 7
4 ST PROGRAM EXPRESSIONS
4.3.2 Conditional statements
(1) IF THEN conditional statement
[Format]
IF <Boolean expression> THEN
<Statement
...
>
END_IF;
[Explanation]
The statement is executed when the Boolean expression (conditional
expression) is TRUE. If the Boolean expression is FALSE, the statement is
not executed.
Any Boolean expression can be used if it returns TRUE or FALSE as the
result of Boolean operation of the condition of a single bit type variable or a
complicated expression including many variables.
Statement
Conditional
expression
FALSE
TRUE
[Description example]
(a) When actual device is used in Boolean expression
IF X0 THEN
(* If X0 is ON, 0 is assigned to D0.
*)
D0 : = 0;
(* If the X0 area is X0= TRUE, the meaning is *)
(* the same.
*)
END_IF;
(b) When operator is used in Boolean expression
IF (D0*D1) <= 200 THEN
(* If D0*D1 is less than or equal to 200
*)
D0 : = 0;
(* 0 is assigned to D0.
*)
END_IF;
(c) When label is used in Boolean expression
IF w_Real > 2.0 THEN
(* If w_Real is greater than 2.0
*)
D0 : = 0;
(* 0 is assigned to D0.
*)
END_IF;
Summary of Contents for MELSEC L series
Page 1: ...Programming Manual Structured Text ...
Page 2: ......
Page 73: ...4 33 4 33 4 ST PROGRAM EXPRESSIONS MEMO ...
Page 297: ......