Absolute Value (ABS)
    When enabled, the ABS instruction and operator take the absolute value of Source. The instruction stores the result in Dest while the operator simply returns the result. An overflow is indicated if the result is the maximum negative integer value, e.g. -128 for SINT, -32,768 for INT and -2,147,483,648 for DINT.
Available Languages
Ladder Diagram
_v1.png/_jcr_content/renditions/original)
Structured Text
This instruction is not available in structured text. However, in the Structured Text
        Editor you can use ABS as an operator in an expression to compute the same result. Refer to
          Structured Text syntax for more information on the syntax of
        expressions and assignments within structured text.
Operands
     IMPORTANT: 
    Unexpected operation may occur if:
          
- Output tag operands are overwritten
- Members of a structure operand are overwritten
- Except when specified, structure operands are shared by multiple instructions.
There are data conversion rules for mixing numeric data types within an instruction. See Data conversions.
Ladder Diagram
| Operand | Data Type | Format | Description | 
|---|---|---|---|
| Source | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL | immediate tag | Value of which to take the absolute value. | 
| Dest | SINT INT DINT LINT USINT UINT UDINT ULINT REAL LREAL | tag | Tag to store result of the instruction. | 
Major/Minor Faults
None specific to this instruction. See Index through arrays for array-indexing faults.
Execution
Ladder Diagram
| Condition/State | Action Taken | 
|---|---|
| Prescan | N/A | 
| Rung-condition-in is false | Set Rung-condition-out to Rung-condition-in. | 
| Rung-condition-in is true | Set Rung-condition-out to Rung-condition-in. Dest = absolute value of Source. | 
| Postscan | N/A | 
Examples 
Ladder Diagram 

Structured Text
DINT_dest := ABS(DINT_src);
Provide Feedback