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
TRUNC
TRUNC parameters
Parameter
Parameter Type
Data Type
Description
EN
Input
BOOL
When set to true, the instruction is enabled.
  • TRUE: Execute the current computation.
  • FALSE: There is no computation.
Applies to ladder diagram programs.
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 function block diagram example
TRUNC ladder diagram example
TRUNC ladder diagram example
TRUNC structured text example
TRUNC structured text example
(* ST Equivalence: *) result := TRUNC (+2.67) + TRUNC (-2.0891); (* means: result := 2.0 + (-2.0) := 0.0; *)
Results
Results
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal