Divide (DIV)

The DIV instruction divides Source A by 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 the operator in an expression.

Operands
-    Ladder Diagram
Operand
Type
Format
Description
Source A
SINT
INT
DINT
REAL
Immediate
tag
value of the dividend
Source B
SINT
INT
DINT
REAL
immediate
tag
value of the divisor
Destination
SINT
INT
DINT
REAL
tag
tag to store the result

-    Function Block
Operand
Type
Format
Description
DIV tag
FBD_MATH
structure
DIV structure

-    Structured Text
Use the divide sign "/" as an operator within an expression. This expression divides sourceA by 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 of the dividend.
Valid = any float
SourceB
REAL
Value of the divisor.
Valid = any float

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

Example
Divide float_value_1 by float_value_2 and place the result in divide_result.

-    Ladder Diagram
-    Function Block
-    Structured Text

divide_result := float_value_1 / float_value_2;

File name: PLC-20_IS_CMI-DIV.pdf
File size: 418.86 KB

0 comments :