Relational Operators - Mitsubishi QD51 Programming Manual

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

2 THE BASICS OF AD51H-BASIC

2.10.2 Relational operators

2 - 20
• Division when overflow occurs or when the divisor is 0.
If a divisor becomes 0 in a division while executing an expression, a "Division by
zero" error will occur. Also, if 0 is lifted to a negative power, a "Division by zero" error
will occur.
When an overflow occurs, an "Overflow" error will be generated.
• Mixing with other types of operators
An expression can contain logical operators, other than arithmetic operators. When
an expression contains a relational operator, the arithmetic operation is performed by
returning the value –1 if the result of the logical operation is True, and value 0 if the
result of the logical operation is False.
Example
(A=B)
(A>C)
(A AND MASK)/2
Relational operators are used to compare two values. The results of comparisons are
expressed as either "True" (-1) or "False" (0). Results such as these are used to
determine the program flow.
Operator
=
<>, ><
<
>
<=, =<
>=, =>
When a relational operator and an arithmetic operator both exist in the same equation,
the arithmetic operator will always take priority. The result is then used for the relational
operation.
Example
X+Y<(T-1)/Z
• • • • •
SIN(X)<0
• • • • •
Meaning
Equal to
Not equal to
Less than
Greater than
Less than or equal to
Greater than or equal to
The "equal to" symbol (=) is also used to assign a value
to a variable.
The result is True if the value X + Y is less than T-1
The result is True if the value SIN(X) is less than 0.
MELSEC-Q
Example
X=Y
X<>Y, X><Y
X<Y
X>Y
X<=Y, X=<Y
X>=Y, X=>Y
Z
2 - 20

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents