276 Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Chapter 6 Compute/Math Instructions (CPT, ADD, SUB, MUL, DIV, MOD, SQR, SQRT, NEG, ABS)
FBD_MATH Structure
Description: If the Destination is not a REAL, the instruction handles the fractional portion
of the result as follows:
The destination is set as follows.
If Source B (the divisor) is zero:
• A minor fault occurs:
– Type 4: program fault
– Code 4: arithmetic overflow
• The destination is set as follows:
Input Parameter Data Type Description
EnableIn BOOL Enable input. If cleared, the instruction does not execute and outputs are not updated.
Default is set.
Source A REAL Value of the dividend.
Valid = any float
Source B REAL Value of the divisor.
Valid = any float
Output Parameter Data Type Description
EnableOut BOOL The instruction produced a valid result.
Dest REAL Result of the math instruction. Arithmetic status flags are set for this output.
If source A Then the fractional
portion of the result
Example
And Source B are not
REALs
Truncates Source A DINT 5
Source B DINT 3
Destination DINT 1
Or Source B is a REAL Rounds Source A REAL 5.0
Source B DINT 3
Destination DINT 2
If source B is zero and And the destination is a And the result is Then the destination is set to
All operands are integers (SINT, INT, or
DINT)
Source A
At least one operand is a REAL SINT, INT, or DINT Positive -1
Negative 0
REAL Positive 1.$ (positive infinity)
Negative -1.$ (negative infinity)