Siemens 6AV6651-7KA01-3AA4 - S7-1200 + KTP400 Basic Starter Kit 6AV6651-7KA01-3AA4 Manual De Usuario
Los códigos de productos
6AV6651-7KA01-3AA4
Programming made easy
6.3 Powerful instructions make programming easy
Easy Book
102
Manual, 03/2014, A5E02486774-AF
Table 6- 4
Round and Truncate instructions
LAD / FBD
SCL
Description
out := ROUND (in);
Converts a real number (Real or LReal) to an integer. The instruction
rounds the real number to the nearest integer value (IEEE - round to
nearest). If the number is exactly one-half the span between two
integers (for example, 10.5), then the instruction rounds the number to
the even integer. For example:
•
•
ROUND (10.5) = 10
•
ROUND (11.5) = 12
For LAD/FBD, you click the "???" in the instruction box to select the
data type for the output, for example, "DInt". For SCL, the default output
data type is DINT. To round to another output data type, enter the
instruction name with the explicit name of the data type, for example,
ROUND_REAL or ROUND_LREAL.
out := TRUNC(in);
Converts a real number (Real or LReal) to an integer. The fractional
part of the real number is truncated to zero (IEEE - round to zero).
Table 6- 5
Ceiling (CEIL) and Floor instructions
LAD / FBD
SCL
Description
out := CEIL(in);
Converts a real number (Real or LReal) to the closest integer greater
than or equal to the selected real number (IEEE "round to +infinity").
out := FLOOR(in);
Converts a real number (Real or LReal) to the closest integer smaller
than or equal to the selected real number (IEEE "round to -infinity").