TRUNC (truncate)
The TRUNC instruction truncates Real values, leaving just the Integer.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the Micro810, L20E, L50E, and L70E controllers.
TRUNC

Parameter | Parameter Type | Data Type | Description |
---|---|---|---|
EN | Input | BOOL | When set to true, the instruction is enabled.
|
IN | Input | REAL | Any Real value. |
TRUNC | Output | REAL | If IN > 0, biggest integer less or equal to the input. If IN < 0, least integer greater or equal to the input. |
ENO | Output | BOOL | Enables output. Applies to ladder diagram programs. |
TRUNC examples
TRUNC function block diagram example

TRUNC ladder diagram example

TRUNC structured text example

(* ST Equivalence: *) result := TRUNC (+2.67) + TRUNC (-2.0891); (* means: result := 2.0 + (-2.0) := 0.0; *)
Results

Provide Feedback