Math Conversion Instructions

The math conversion instructions convert values.
Available Instructions
Ladder Diagram and Function Bock
Structured Text
If you want to
Use this instruction
Convert radians into degrees.
DEG
Convert degrees into radians.
RAD
Convert an integer value to a BCD value.
TO_BCD
Convert a BCD value to an integer value.
BCD_TO
Remove the fractional part of a value.
TRUNC
You can mix data types, but loss of accuracy and rounding error might occur and the instruction takes more time to execute. Check the S:V bit to see whether the result was truncated.
The
bold
data types indicate optimal data types. An instruction executes faster and requires less memory if all the operands of the instruction use the same optimal data type, typically DINT or REAL.
A math conversion instruction executes once each time the instruction is scanned as long as the rung-condition-in is true. If you want the instruction evaluated only once, use an ONS instruction to trigger the conversion instruction.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.