Convert - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

6.1.7

Convert

Convert instruction
After you select the (convert from) data type, a list of possible conversions is shown in the
(convert to) dropdown list. Conversions from and to BCD16 are restricted to the Int data
type. Conversions from and to BCD32 are restricted to the DInt data type.
Click below the box name and select data types from the drop-down menus.
Parameter
IN
OUT
ENO status
1
0
0
Round and Truncate instructions
Parameter
IN
OUT
S7-1200 Programmable controller
System Manual, 11/2009, A5E02486680-02
You use the CONVERT instruction to convert a data element from one
data type to another data type. Click below the box name and then select
IN and OUT data types from the dropdown list.
Data type
SInt, Int, DInt, USInt, UInt, UDInt, Byte, Word, DWord,
Real, LReal, Bcd16, Bcd32
SInt, Int, DInt, USInt, UInt, UDInt, Byte, Word, DWord,
Real, LReal, Bcd16, Bcd32
Description
No error
IN is +/- INF or +/- NaN
Result exceeds valid range for OUT data
type
ROUND converts a real number to an integer. The real number fraction is
rounded to the nearest integer value (IEEE - round to nearest). If the Real
number is exactly one-half the span between two integers (i.e. 10.5), then
the Real number is rounded to the even integer. For example, ROUND
(10.5) = 10 or ROUND (11.5) = 12.
TRUNC converts a real number to an integer. The fractional part of the real
number is truncated to zero (IEEE - round to zero).
Data type
Real, LReal
SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal
Programming instructions
6.1 Basic instructions
Description
IN value
IN value converted to a new
data type
Result OUT
Valid result
+/- INF or +/- NaN
OUT is set to the least-significant
bytes of IN
Description
Floating point input
Rounded or truncated output
123

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-1200

Table of Contents