7.1 User Program Types and Execution Timing
7.1.5 Registers
7-34
Precautions for Operations Using Different Data Types
If you perform an operation using different data types, be aware that the results will be different
depending on the data type of the storage register, as described below.
•
Storing Real Number Data in an Integer Register
MW0000100 = MF0000200; the real number is stored after it is converted to an integer.
(00001) (1.234)
Note: There may be rounding error due to storing a real number in an integer register.
Whether numbers are rounded or truncated when converting a real number to an integer can be set
in the properties of the drawing.
Setting for Real Number Casting
MW0000100 = MF0 MF0000202;
(0124) (123.48) (0.02) The result of the operation may be different depending on the
value of the variable.
(0123) (123.49) (0.01)
•
Storing Real Number Data in a Double-Length Integer Register
ML0000100 = MF0000200; the real number is stored after it is converted to an integer.
(65432) (65432.1)
•
Storing Double-Length Integer Data in an Integer Register
MW0000100 = ML0000200; the lower 16 bits of the double-length integer are stored without
change.
(-00001) (65535)
•
Storing Integer Data in a Double-Length Integer Register
ML0000100 = MW0000200; the integer is stored after it is converted to double-length integer data.
(0001234) (1234)
Setting for Real Number Casting
The casting method (truncating or rounding) can be set in
Detail information
of the Program
Property Dialog Box.
The method to use for real number casting is set for each drawing.
Use the following procedure to display the Program Property Dialog Box.
1.
In the Ladder Pane, select the ladder program for which to view the properties.
2.
Right-click the selected program and select
Property
from the pop-up menu.
The Program Property Dialog Box will be displayed.