Skip to main content

6.1.3.4.3 SUB

Function

Subtract (-), subtract the value of input IN2 from the value of input IN1, and then output OUT (OUT:=IN1-IN2)

LD Graphics

alt text

Parameter description

Interface variableDeclarationData typeDescription
IN1Var_InputANY_MAGNITUDEMinuand
IN2Var_InputANY_MAGNITUDESubtrahend
OUTVar_OutputANY_MAGNITUDEOUT:=IN1-IN2

Example

Through the SUB instruction, the value of variable a is subtracted from the value of variable b and the result is given to variable c, as shown in the figure below: Three INT type variables are defined, and the SUB instruction is executed by compiling, downloading, and achieving the effect of c:=a-b

alt text