Mitsubishi QD51 Programming Manual page 36

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

Advertisement

2 THE BASICS OF AD51H-BASIC
2 - 19
In order to change the order of operations, parentheses are used. When a portion of
an expression is surrounded by parentheses, the operation within the parentheses are
performed first. When an operator is followed by another operator, parentheses must
be used.
Operations on double-precision real numbers may be performed in arithmetic
operations, but numbers lifted to higher powers are all converted to single-precision.
Some algebraic numeric expressions and their corresponding BASIC expressions are
shown below.
Algebraic expression
X+2Y
Y
X-
Z
XY
Z
X+Y
Z
2
y
(X
)
Z
Y
X
X(-Y)
• Integer division and remainder operations
Integer division operations are expressed using ¥. Fractional portion of divisor,
dividend, and the quotient are dropped before the operation and rounded to integers.
Example
PRINT 10@ 4
2
OK
...
PRINT 25.6@ 6.99
4
OK
Remainder operations are expressed using the operator MOD and gives the
remainder in integer division integer format.
Example
...
PRINT 15.4 MOD 4
3
OK
PRINT 25.68 MOD 6.9
1
OK
BASIC expression
• • • • • • •
X+Y 2
• • • • • • •
X-Y/Z
• • • • • • •
X Y/Z
• • • • • • •
(X+Y)/Z
• • • • • • •
(X^2)^Y/
• • • • • • •
X^(Y^Z)
• • • • • • •
X
(-Y)
...
...
...
......
The dividend is rounded down to 25,
the divisor to 6, and the quotient to 4.
...
...
...
...
...
The remainder left after
dividing 15 by 4 is 3.
...
...
...
...
...
The remainder left after
dividing 25 by 6 is 1.
MELSEC-Q
Note that the multiplication,
division, and power symbols
are different from their
mathematical symbols.
/
n
^ n
2 - 19

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents