
14-16
Ladder Logic (LAD) for S7-300 and S7-400
C79000-G7076-C504-02
14.14 Truncate Double Integer Part
The Truncate Double Integer Part conversion instruction reads the contents
specified in the input parameter IN as a real number and converts this
number to a double integer, by rounding it to the nearest lower or equal
whole number. The result is the integer component of the specified real
number (that is, the whole number part of the real number). The output
parameter OUT provides the result. If an overflow occurs, ENO is 0.
Certain restrictions apply to the placement of the Truncate Double Integer
Part conversion box (see Section 6.1).
Table 14-14 Truncate Double Integer Part Box and Parameters
LAD Box Parameter Data Type Memory Area Description
TR
N
EN BOOL I, Q, M, D, L Enable input
EN ENO
ENO BOOL I, Q, M, D, L Enable output
IN OUT
IN REAL I, Q, M, D, L Value to round
OUT DINT I, Q, M, D, L Whole number part of IN value
Status Word Bits
BR CC 1 CC 0 OV OS OR STA RLO FC
Write x – – x x x 1 x x
I 0.0
If the signal state of input I 0.0 is 1, the
conversion is executed. The contents of
memory double word MD8 is read as a real
number and converted to a double integer.
The integer component is the result and is
stored in memory double word MD12. If an
overflow occurred, the signal state of output
Q 4.0 is 1. If the signal state at input EN is 0
(that is, if the conversion is not executed),
the signal state of output Q 4.0 is also 1.
Q 4.0
TRUNC
IN
EN ENO
MD8 MD12
Function is executed (EN = 1):
NOT
OUT
Figure 14-14 Truncate Double Integer Part
Description
Move and Conversion Instructions
Comentários a estes Manuais