Type Conversions - Siemens SINUMERIK 840D sl Function Manual

Synchronized actions
Hide thumbs Also See for SINUMERIK 840D sl:
Table of Contents

Advertisement

3.3.3

Type conversions

An implicit type conversion is performed between the following data types for value
assignments and parameter transfers with different data types:
● REAL
● INT
● BOOL
Note
Conversion REAL to INT
For the conversion from REAL to INT, a decimal place value ≧ 0.5 rounded up to the next
higher integer. For a decimal place value < 0.5, rounding is to the next lower integer.
Behavior in accordance with the ROUND function.
If the REAL value is outside the INT value range, an alarm is displayed and a conversion
is not performed.
Conversion from REAL or INT to BOOL
● Value <> 0 → TRUE
● Value == 0 → FALSE
Examples
Conversion: INT $AC_MARKER → REAL $AC_PARAM
Program code
$AC_MARKER[1]=561
ID=1 WHEN TRUE DO $AC_PARAM[1] = $AC_MARKER[1]
Conversion: REAL $AC_PARAM → INT $AC_MARKER
Program code
$AC_PARAM[1]=561.0
ID=1 WHEN TRUE DO $AC_MARKER[1] = $AC_PARAM[1]
Conversion: INT $AC_MARKER → BOOL $A_OUT
Program code
$AC_MARKER[1]=561
ID=1 WHEN $A_IN[1] == TRUE DO $A_OUT[0]=$AC_MARKER[1]
Conversion: REAL $R401 → BOOL $A_OUT
Program code
R401 = 100.542
WHEN $A_IN[0] == TRUE DO $A_OUT[2]=$R401
Conversion: BOOL $A_OUT → INT $AC_MARKER
Program code
ID=1 WHEN $A_IN[2] == TRUE DO $AC_MARKER[4] = $A_OUT[1]
Synchronized actions
Function Manual, 08/2018, 6FC5397-5BP40-6BA2
3.3 System variables for synchronized actions
Detailed description
25

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sinumerik 828dSinumerik 840de sl

Table of Contents