Standard function blocks
316
Inputs Input (I): REAL24
Outputs Output (O): REAL
REALn_TO_DINT
(10029)
Illustration
Execution time 6.45 µs
Operation Output (O) is the 32-bit integer equivalent of the REAL/REAL24 input (I). Output O1 is
the integer value and output O2 is the fractional value.
The output value is limited to the maximum value of the data type range.
Example (from REAL to DINT):
When I = 2.04998779297, O1 = 2 and O2 = 3276.
Inputs The input data type is selected by the user.
Input (I): REAL, REAL24
Outputs Output (O1, O2): DINT
REALn_TO_DINT_SIMP
(10028)
Illustration
Execution time 5.54 µs
Operation Output (O) is the 32-bit integer equivalent of the REAL/REAL24 input (I) multiplied by
the scale input (SCALE).
Error codes are indicated by the error output (ERRC) as follows:
Example (from REAL to DINT):
When I = 2.04998779297and SCALE = 100, O = 204.
REALn_TO_DINT
(REAL) 91
TLA1 1 msec (1)
I
O1
O1(91)
O2
O2(91)
REALn_TO_DINT_SIMP
(REAL) 92
TLA1 1 msec (1)
I
SCALE
O
O(92)
ERR C
ERRC(92)
Error code Description
0 No error
1001 The calculated integer value exceeds the minimum value. The output
is set to the minimum value.
1002 The calculated integer value exceeds the maximum value. The
output is set to the maximum value.
1003 Scale input is 0. The output is set to 0.
1004 Incorrect scale input, i.e. scale input is < 0 or is not a factor of 10.