SUB (subtract)
The SUB instruction subtracts one Integer, Real, or Time value from another Integer, Real, or Time value.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the Micro810, L20E, L50E, and L70E controllers.
SUB

Parameter | Parameter Type | Data Type | Description | |
---|---|---|---|---|
EN | Input | BOOL | When set to true, the instruction is enabled.
| |
i1 | Input | SINT USINT BYTE INT UINT WORD DINT UDINT | DWORD LINT ULINT LWORD REAL LREAL TIME | Minuend in any Integer, Real, or Time data type. All inputs must be of the same data type. |
i2 | Input | SINT USINT BYTE INT UINT WORD DINT UDINT | DWORD LINT ULINT LWORD REAL LREAL TIME | Subtrahend in any Integer, Real, or Time data type. All inputs must be of the same data type. |
o1 | Output | SINT USINT BYTE INT UINT WORD DINT UDINT | DWORD LINT ULINT LWORD REAL LREAL TIME | Difference of the minuend and the subtrahend in any Integer, Real, or Time data type. Output must be the same data type as inputs. |
ENO | Output | BOOL | Enables output. Applies to ladder diagram programs. |
SUB examples
SUB function block diagram example

SUB ladder diagram program example

(* ST equivalence: *) ao10 := ai101 - ai102; ao5 := (ai51 - 1) - ai53;
Provide Feedback