DIV
The IEC operator is used for division of variables.
Permitted data types: BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, REAL, LREAL, TIME
In TwinCAT, division by zero always leads to an exception and the corresponding task is stopped. |
Examples:
ST:
nVar := 8/2;
FBD:
1. Series of DIV function blocks, 2. Individual DIV function block, 3. DIV function block with EN/ENO parameters
Note the possibility to monitor for division by 0 during runtime using the implicit monitoring functions CheckDivInt, CheckDivLint, CheckDivLReal and CheckDivLReal. |
See also:
- Division checks (POUs CheckDivDInt, CheckDivLInt, CheckDivReal, CheckDivLReal)
- POU CheckDivLInt
- POU CheckDivLReal
- POU CheckDivReal