8
Functions
The ST module supports the following functions:
•
Type conversion
•
Arithmetic functions
•
Numerical functions
•
Bit sequence functions (shift functions)
•
Logical functions
•
Selection (statistics)
•
Comparison
•
Date and time
•
Other functions
8.1
Type conversion
Admissible data types
Argument: UINT, UDINT
Result: BOOL, UINT, UDINT, REAL
INT_TO_REAL
Converts an INTEGER into a REAL number.
Example:
a := INT_TO_REAL(10); (* a := 10.0 *)
INT_TO_DINT
Converts an INTEGER into a DOUBLE INTEGER.
Example:
a := INT_TO_DINT(10); (* a := 10 *)
INT_TO_BOOL
Converts an INTEGER into a BOOL value.
The result is FALSE if the argument is 0. In all other cases, the result is TRUE.
Examples:
a := INT_TO_BOOL(0); (* a = FALSE *)
b := INT_TO_BOOL(1); (* b = TRUE *)
c := INT_TO_BOOL(8); (* c = TRUE *)
DINT_TO_REAL
Converts a DOUBLE INTEGER into a REAL number.
Examples:
a := DINT_TO_REAL(100000); (* a = 100000.0 *)
8 Functions
35