2 - 20 2 - 20
MELSEC-Q
2 THE BASICS OF AD51H-BASIC
• 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
2.10.2 Relational operators
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
Meaning
Example
=
Equal to
X=Y
<>, ><
Not equal to
X<>Y, X><Y
<
Less than
X<Y
>
Greater than
X>Y
<=, =<
Less than or equal to
X<=Y, X=<Y
>=, =>
Greater than or equal to
X>=Y, X=>Y
The "equal to" symbol (=) is also used to assign a value
to a variable.
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
• • • • •
The result is True if the value X + Y is less than
T-1
Z
SIN(X)<0
• • • • •
The result is True if the value SIN(X) is less than 0.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...