7.10.5 SYS._TRUNC_
Function
Truncate function, this instruction selects only the integer part of the input value and outputs this integer as the result
LD graphics
Parameter description
| Interface variable | Declaration | Data type | Description |
|---|---|---|---|
| IN | Var_Input | REAL(LREAL) | Data to be converted |
| Function name | Return value | INT (DINT, LINT) | Output the converted result |
warning
- When using this instruction, it is recommended to specify the source data type and target data type
- In LD, select the source data type by clicking the "???" in the upper left corner of the graph; click the "???" in the upper right corner of the graph to select the target data type
- When adding by dragging in ST, the data type selection window as shown below will appear:

Example
- LD example is shown in the following animation:

- ST example is shown in the following code:
OUT_INT := REAL_TRUNC_INT(IN_REAL);