Conditional Statements - Mitsubishi MELSEC-q Programming Manual

Melsec q series; melsec l series
Hide thumbs Also See for MELSEC-q:
Table of Contents

Advertisement

4 ST PROGRAM EXPRESSIONS

4.3.2 Conditional statements

4 - 7
(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.
[Description example]
(a) When actual device is used in Boolean expression
IF X0 THEN
D0 : = 0;
END_IF;
(b) When operator is used in Boolean expression
IF (D0*D1) <= 200 THEN
D0 : = 0;
END_IF;
(c) When label is used in Boolean expression
IF w_Real > 2.0 THEN
D0 : = 0;
END_IF;
Conditional
FALSE
expression
TRUE
Statement
(* If X0 is ON, 0 is assigned to D0.
(* If the X0 area is X0= TRUE, the meaning is *)
(* the same.
(* If D0*D1 is less than or equal to 200
(* 0 is assigned to D0.
(* If w_Real is greater than 2.0
(* 0 is assigned to D0.
*)
*)
*)
*)
*)
*)
4 - 7

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec-l

Table of Contents