DIV block
Short summary
Name |
|
→POU type |
|
Category |
|
Conform to →IEC-standard |
currently restricted
|
Graphical interface |
|
Available since |
|
Functionality
The mathematical function division is called: The block returns the quotient for IN1 / IN2
.
Enter the value for the dividend at input IN1
and the value for the divisor at input IN2
.
The result of the division of →integers is an integer of the same type with truncation toward zero (there is no rounding). Examples:
-
The division
7/3
returns the value{{2}}. The decimal part0,333...
is truncated -
The division
(-7)/3
returns the value-2
. The decimal part0,333...
is truncated
When dividing the minimum value for a data type (also known as the "lower limit" of the data type) by -1
and for a return value of the same data type, the result of the division is 0
and the output ENO
of the block is set to the value FALSE
. Example: The division with the values -2_147_483_648/-1
for the data type DINT
has the result 0
(if the return value is of the same data type DINT
) and the ENO
is set to FALSE
. Reason: -2_147_483_648
is the minimum value (also known as the lower limit) for DINT
.
No check of invalid connections For this block, invalid connections are not checked by Neuron Power Engineer (except for the checks listed under "Internal error diagnostic for block"). Therefore, enter code in your application to detect invalid connections (e.g. See "IEC-blocks for the application" for information what the consequences of an invalid connection might be. |
Inputs, return value
|
Identifier |
Description |
|
---|---|---|---|
Inputs: |
|
|
1st value (dividend) |
|
|
2nd value (divisor) |
|
Return value: |
– |
|
|
Input EN
and output ENO
are available when →calling the block. See "Execution control: EN, ENO" for information on input EN
and output ENO
.
See:
-
"Blocks for safe logic" whether this block is supported for developing safety-relevant applications.
-
"Highlighting safe logic in the FBD-editor" for the effects when using the block as a block for safe logic.
Internal error diagnostic for block
The block checks the values and/or data types for the inputs and the return values. The output ENO
of the block is set to value FALSE
(or an equivalent) in the following cases and the block returns the value 0
.
-
for a division by
0
– regardless of the data type -
for a division of the minimum value for a data type by the value
-1
when the return value is of the same data type
Example for usage within ST-editor
|
When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.
Examples for invalid connections
An invalid connection due to →overflows or →underflows might occur during a calculation using DIV
.
Example for invalid connections |
---|
|