Mitsubishi Electric R16MTCPU Programming Manual page 123

Hide thumbs Also See for R16MTCPU:
Table of Contents

Advertisement

Internal operation data types
For internal operations, when (S1) and (S2) differ in data type, the data of the smaller type is converted into that of the greater
type before operation is performed. If the operation result is over the range of processed number in each type, an overflow will
occur. However, an operation error will not occur. By converting the set data with the type converting instruction, an overflow
may be able to be prevented.
(S1) Operator (S2)
The operators are "+, -, *, /, %"
The data type combinations, and internal operation data types for binary operations are shown below.
(S1) data type
(S2) data type
16-bit integer type
16-bit integer type
32-bit integer type
64-bit floating-point type
32-bit integer type
16-bit integer type
32-bit integer type
64-bit floating-point type
64-bit floating-point
16-bit integer type
type
32-bit integer type
64-bit floating-point type
*1 Except the operator "%"
■Program example
• Program which substitutes the result of multiplying #0 by #10 to W0L
W0L = #0*#10
W1
W0
W0L
-18698
Since both of set data are the 16-bit integer type, the multiplier result is processed by the 16-bit integer type. An overflow
occurs, and the lower 16-bit of the multiplier result is the operation result.
• Program which substitutes the result of multiplying #0 and #10 to W0L after converting into the 32-bit integer type
W0L = LONG(#0)*LONG(#10)
W1
W0
W0L
8369910
Since the multiplier result is processed with the 32-bit integer type by the type converting instruction, even if the device value
is the same as the program example above (Program which substitutes the result of multiplying #0 by #10 to W0L), an
overflow will not occur.
*1
*1
*1
#0
(H3039)
(HB6F6) ← (H7FB6F6)
#10
(H02A6)
LONG(#0)
(H007FB6F6)
LONG(#10)
Internal operation data type
16-bit integer type
32-bit integer type
64-bit floating-point type
32-bit integer type
64-bit floating-point type
64-bit floating-point type
12345
*
678
12345
(H00003039)
*
678
(H000002A6)
4 OPERATION CONTROL PROGRAMS
*1
*1
*1
4.1 Operation Control Programs
4
121

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

R64mtcpuMelsec iq-r seriesR32mtcpu

Table of Contents