IEC operator⮫ “Overview”: Returns the absolute value of a number. ABS(-2) equals 2.
The following type combinations for input and output variables are possible:
|
IN |
OUT |
|---|---|
|
INT |
INT, REAL, WORD, DWORD, DINT |
|
REAL |
REAL |
|
BYTE |
INT, REAL, BYTE, WORD, DWORD, DINT |
|
WORD |
INT, REAL, WORD, DWORD, DINT |
|
DWORD |
REAL, DWORD, DINT |
|
SINT |
REAL |
|
USINT |
REAL |
|
UINT |
INT, REAL, WORD, DWORD, DINT, UDINT, UINT |
|
DINT |
REAL, DWORD, DINT |
|
UDINT |
REAL, DWORD, DINT, UDINT |
Example in ST:
i:=ABS(-2);
