Divide DIV
Dest = A ÷ B.
DIV
AGlobal.Items224BGlobal.PerBox24DestGlobal.BoxesOut6
| Tag | After two scans |
|---|---|
| BoxesOut | 6 |
| Items2 | 24 |
| PerBox2 | 4 |
How it works
While the rung is true, writes Source A ÷ Source B to the destination each scan. A fault, such as a divide by zero, leaves the destination unchanged.
How it's used
Use DIV to change units or share out a total.
DIV
AGlobal.RunMs7500B1000DestGlobal.RunSeconds7
| Tag | Value |
|---|---|
| RunMs | 7500 |
| RunSeconds | 7 |
DINT division drops the remainder: 7500 ÷ 1000 is 7.
Operands
| Operand | Data type | Read or write |
|---|---|---|
| A | DINT, REAL or a number | Reads |
| B | DINT, REAL or a number | Reads |
| Dest | DINT, REAL | Writes |
Common mistakes
- Dividing by 0Dividing by 0 is a fault. Check B first. DINT division drops the remainder.
Learn it in a lesson
- Moving and calculating dataIntermediate · 25 min