Skip to main content

Operator: MOD

The IEC operator is used for modulo division.

The result of the function is the non-negative, integer remainder of division.

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

Important

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

Example 109. Examples

Result in Var1: 1

ST

var1 := 9 MOD 2;

FBD

_cds_img_mod.png