Skip to main content

FB_DIV

Description Function Block

The FB_DIV function block is used to divide the AnalogIn1 input by the AnalogIn2 input and pass the result to the AnalogOut output.

If the input AnalogIn2 = 0, then the AnalogOut output is set to 0. In this case, an error is not issued.

If an overflow or underflow occurs during the division, then the ERROR state is entered. Then the AnalogOut output is set to 0 and the bError output is set to 1.

The bFloor, bCeil, and bRound inputs can be used to specify which rounding method to be applied.

EL6900

The FB_DIV function block is not supported by the EL6900.

EL6900_DIV.png
Table 40. VAR_INPUT

Name

Data Type

Initial Value

Description, Parameter Values

AnalogIn1

LINT

0

1st analog input signal for division

Permitted data types: UINT, INT, UDINT, DINT

AnalogIn2

LINT

0

2nd analog input signal for division

Permitted data types: UINT, INT, UDINT, DINT

bFloor

SAFEBOOL

FALSE

Rounding method: Decimal places are truncated.

Only a constant value is permitted (no variable)

Only one of the bFloor, bCeil, and bRound inputs may beTRUE.

bCeil

SAFEBOOL

FALSE

Rounding method: The next largest integer is returned as the result.

Only a constant value is permitted (no variable)

Only one of the bFloor, bCeil, and bRound inputs may beTRUE.

bRound

SAFEBOOL

FALSE

Rounding method: Rounded away from zero (for example, 2.5 is rounded up to 3).

Only a constant value is permitted (no variable)

Only one of the bFloor, bCeil, and bRound inputs may be TRUE.



Table 41. VAR_OUTPUT

Name

Data Type

Initial Value

Description, Parameter Values

AnalogOut

SAFEUSINT

0

Analog output with the quotient

Permitted data types: UINT, INT, UDINT, DINT. The data type must be selected according to the input data types.

bError

SAFEBOOL

FALSE

TRUE: The AnalogOut output has an overflow or underflow.

FALSE: No error has occurred.