Siemens SINUMERIK 840Di sl Function Manual page 24

Synchronized actions, ncu system software
Hide thumbs Also See for SINUMERIK 840Di sl:
Table of Contents

Advertisement

Detailed description
2.2 Real -time evaluations and calculations
RTOI
INT RTOI( REAL ) - Converting from real to integer
The function RTOI() converts the transferred Real value in a rounded INT value and returns
this integer value. If the value transferred lies outside the range that can be unambiguously
represented as an integer value, alarm 20145 "Motion-synchronous action: Arithmetic error"
is output and no conversion is performed. The transferred variable is not changed.
Note
The function RTOI() does not produce an unambiguous result when inverted, i.e. it is not
possible to determine the original Real value from the value returned, as the decimal places
are lost during conversion!
Example RTOI:
$AC_PARAM[1] = 561.4378
ID=1 WHEN TRUE DO $AC_MARKER[1] =
RTOI( $AC_PARAM[1] )
...
$AC_PARAM[1] = -63.867
ID=1 WHEN TRUE DO $AC_MARKER[1] =
RTOI( $AC_PARAM[1] )
$AC_MARKER[1]=10
$AC_PARAM[1] = -6386798797.29
ID=1 WHEN TRUE DO $AC_MARKER[1] =
RTOI( $AC_PARAM[1] )
Implicit type conversion (SW 6.4)
In SW 6.4 and later, variables of various data types can be assigned to one another in
synchronized actions without having to call the RTOI or ITOR function, e.g. REAL to INT and
vice versa.
If values outside of the interval [INT_MIN, INT_MAX] would result from the conversion from
REAL to INTEGER, alarm 20145 "Motion-synchronous action: Arithmetic error" is output and
no conversion is performed.
24
;
Result: 561
;
Result: -64
;
Result: Alarm 20145
$AC_MARKER[1] = 10 (unchanged due to alarm)
;
Function Manual, 11/2006, 6FC5397-5BP10-2BA0
Synchronized actions

Advertisement

Table of Contents
loading

Table of Contents