Skip to main content

Operator: DIV

The IEC operator is used to divide variables.

Permitted data types: BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, UDINT, LINT, ULINT, REAL, LREAL, TIME

Important

Division by zero may have different results depending on the target system.

Example 108. Examples

ST

var1 := 8/2;

FBD

1. Series of DIV blocks, 2. Single DIV block, 3. DIV POU with EN/ENO parameters

_cds_img_div.png


Tip

Note that it is possible to monitor division by zero at runtime by using the implicit monitoring functions CheckDivInt, CheckDivLint, CheckDivReal, and CheckDivLReal.