Add (ADD)

The ADD instruction adds Source A to Source B and places the result in the Destination.

Available Languages


-    Ladder Diagram
-    Function Block
-    Structured Text
 This instruction is not available in structured text. *

* There is no equivalent structured text instruction. Use other structured text programming to achieve the same result.

Operands
-    Ladder Diagram

Operand
Type
Format
Description
Source A
SINT
INT
DINT
REAL
Immediate
tag
value to add to Source B
Source B
SINT
INT
DINT
REAL
immediate
tag
value to add to Source A
Destination
SINT
INT
DINT
REAL
tag
tag to store the result
A SINT or INT tag converts to a DINT value by sign-extension.

-    Function Block

Operand
Type
Format
Description
ADD tag
FBD_MATH
structure
ADD structure

-    Structured Text
Use the plus sign "+" as an operator within an expression. This expression adds sourceA to sourceB and stores the result in dest.

dest := sourceA + sourceB;

FBD_MATH Structure


Input Parameter
Data Type
Description
EnableIn
BOOL
Enable input. If cleared, the instruction does not execute and outputs are not updated.
Default is set.
SourceA
REAL
Value to test against SourceB
Valid = any float
SourceB
REAL
Value to test against SourceA
Valid = any float


Output Parameter
Data Type
Description
EnableOut
BOOL
Enable output.
Dest
BOOL
Result of the math instruction. Arithmetic status flags are set for this output.

Example
Add float_value_1 to float_value_2 and place the result in add_result.

-    Ladder Diagram

-    Function Block


File name: PLC-17_IS_CMI-ADD.pdf
File size: 419.87 KB

0 comments :