Relays, Memory Areas and Constants
1-76
In processing involving an integer device specification and real numbers being
converted to integers, the processing is the same as that of the F327 (INT) instruction.
If the real−number data is a positive number, the number is rounded off, and any digits
to the right of the decimal point are discarded.
If the real−number data is a negative number, the value 0.4999 ... is subtracted from
the target real−number data, and the value is rounded off to the decimal point.
Example 1: If the operation result is f1.234, the value will be stored as integer
data “K1”.
Example 2: If the operation result is f−1.234, the value will be stored as
integer data “K−2”.
Integer device specification can be used for the following instructions.
F309 (FMV) to F324 (FSQR) / F336 (FABS) to F338 (DEG) / F345 (FCMP) to F349
(FZONE)
2) Using the integer → real number and real number → integer conversion
instructions to convert values
With this method, a conversion instruction is used to convert integer data to real
numbers.
When the integer data is 16−bit data, F325 (FLT) is used.
When the integer data is 32−bit data, F326 (DFLT) is used.
Real−number data that has undergone real−number operation processing is converted
from real−number data to integer data using the F327 (INT) to F332 (DROFF)
conversion instructions.
Example 1: When conversion is carried out using the maximum value that
does not exceed the allowable range
F327 INT, DT0, DT10
converted to
16−bit integer
F328 DINT, DT0, DT10
converted to
32−bit integer
When the value is a positive number, the result is rounded off
to the decimal point.
When the value is a negative number, the value 0.4999 ... is
subtracted from the data, and the result is rounded off.
If the real−number data is 1.5, it is converted as integer data
K1.
If the real−number data is −1.5, it is converted as integer data
K−2.