Chapter 16
Math Conversion Instructions (DEG, RAD, TOD, FRD, TRN, TRUNC)
Truncate (TRN)
dest := TRUNC(source);
Input Parameter
Data Type
EnableIn
BOOL
Source
REAL
Output Parameter
Data Type
EnableOut
BOOL
Dest
DINT
570
The TRN instruction removes (truncates) the fractional part of the Source and
stores the result in the Destination.
Operands:
Relay Ladder
Operand
Source
Destination
Structured Text
Use TRUNC as a function. This function truncates source and stores the result in
dest.
See
Structured Text Programming
within structured text.
Function Block
Operand
TRN tag
FBD_TRUNCATE Structure
Description
Enable input. If cleared, the instruction does not execute and outputs are not updated.
Default is set.
Input to the conversion instruction.
Valid = any float
Description
The instruction produced a valid result.
Result of the conversion instruction. Arithmetic status flags are set for this output.
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Type
Format
REAL
Immediate
Tag
SINT
Tag
INT
DINT
REAL
for information on the syntax of expressions
Type
FBD_TRUNCATE
Description
Value to truncate
Tag to store the result
Format
Description
Structure
TRN structure