DIV Divide
Also called: division, quotient, ÷
OUT := IN1 / IN2; division by zero: ENO = 0.
What it does
The DIV block divides the first value by the second and writes the quotient into OUT.
When to use it
For an average, scaling, a flow rate (quantity / time).
Operands
| European mnemonic | American mnemonic | Name | Data type | Direction | Required | Meaning |
|---|---|---|---|---|---|---|
| EN | EN | Enable | BOOL | Input | Yes | Rung condition: the computation runs only when power flow is 1. |
| IN1 | IN1 | Source A | INT, DINT, REAL | Input | Yes | First operand. |
| IN2 | IN2 | Source B | INT, DINT, REAL | Input | Yes | Second operand. |
| OUT | OUT | Destination | INT, DINT, REAL | Output | No | Result (variable). Not changed while the rung is 0. |
| ENO | ENO | Enable out | BOOL | Output | No | 0 on division by zero (OUT is not changed). |
| Mnemonic | Name | Data type | Direction | Required | Meaning |
|---|---|---|---|---|---|
| EN | Enable | BOOL | Input | Yes | Rung condition: the computation runs only when power flow is 1. |
| IN1 | Source A | INT, DINT, REAL | Input | Yes | First operand. |
| IN2 | Source B | INT, DINT, REAL | Input | Yes | Second operand. |
| OUT | Destination | INT, DINT, REAL | Output | No | Result (variable). Not changed while the rung is 0. |
| ENO | Enable out | BOOL | Output | No | 0 on division by zero (OUT is not changed). |
| Mnemonic | Name | Data type | Direction | Required | Meaning |
|---|---|---|---|---|---|
| EN | Enable | BOOL | Input | Yes | Rung condition: the computation runs only when power flow is 1. |
| IN1 | Source A | INT, DINT, REAL | Input | Yes | First operand. |
| IN2 | Source B | INT, DINT, REAL | Input | Yes | Second operand. |
| OUT | Destination | INT, DINT, REAL | Output | No | Result (variable). Not changed while the rung is 0. |
| ENO | Enable out | BOOL | Output | No | 0 on division by zero (OUT is not changed). |
Example
When S1 is 1, V3 := V1 / V2.
Try it in the simulatorThe example opens in the free simulator; your own program stays as it was.
Behaviour in detail
- Integers (INT, DINT): the result is truncated toward zero (7 / 2 = 3, −7 / 2 = −3).
- REAL: normal division.
- Division by zero: ENO turns 0 and OUT keeps its previous value; the PLC keeps running.