MOD

Overview

IEC operator for the modulo division of one variable by another one.

Allowed types:

oBYTE

oWORD

oDWORD

oLWORD

oSINT

oUSINT

oINT

oUINT

oDINT

oUDINT

oLINT

oULINT

The result of this function is the integer remainder of the division.

Different target systems may behave differently concerning a division by zero error. It can lead to a controller HALT, or may go undetected.

Warning_Color.gifWARNING

UNINTENDED EQUIPMENT OPERATION

Use the check functions described in this document, or write your own checks to avoid division by zero in the programming code.

Failure to follow these instructions can result in death, serious injury, or equipment damage.

NOTE: For more information about the implicit check functions, refer to the chapter POUs for Implicit Checks.

Example in IL

Result in Var1 is 1.

LD     9
MOD    2
ST     Var1

Example in ST

var1 := 9 MOD 2;

Examples in FBD

G-SE-0024268.1.gif-high.gif