Mitsubishi Electric melsec q00ujcpu User Manual page 588

Programmable controller
Hide thumbs Also See for melsec q00ujcpu:
Table of Contents

Advertisement

(b) Replacing a part of floating-point operation instructions with double-precision floating-point
operation instructions
Only operations that require high accuracy are replaced with double-precision floating-point opera-
tion instructions.
Using the ECON and EDCON instructions, convert floating-point data mutually between single pre-
cision and double-precision. The flow of a replacement program is as follows:
• Data required for operations are converted from single precision to double precision using the ECON
instruction.
• Operations are performed in double precision using the double-precision floating-point operation instruc-
tions.
• Operation results are converted from double precision to single precision using the EDCON instruction.
A program example that floating-point data are converted mutually between single precision and
double precision before and after operations is shown below.
Example
Replacing the floating-point operation [A
instructions)
1)
Device assignment
Before replacement
Application
Device
Data A
D0 to D1
Data B
D2 to D3
Data C
D4 to D5
Result
D6 to D7
2)
Program before replacement
TableApp.37 Device assignment
Data type
Application
Data A
Data B
Floating-point data
(single precision)
Data C
Result
Data A
Data B
Data C
Result
Figure App.22 Sample program
B+C] (Using the ECON and EDCON
After replacement
Device
Data type
D0 to D1
D2 to D3
Floating-point data
(single precision)
D4 to D5
D6 to D7
D10 to D13
D14 to D17
Floating-point data
(double precision)
D18 to D21
D22 to D25
App - 44
APPENDICES
1
2
3
APPEN-
DIX
6
7
8

Advertisement

Table of Contents
loading

Table of Contents