Chapter 5. Function Block Diagram (FBD)
GFK-2950C February 2018 261
5.9.4 Modulus
Divides input IN1 by input IN2 and outputs the remainder of the division to Q.
All three operands must be of the same data type. The sign of the result is always
the same as the sign of input parameter IN1. Output Q is calculated using the
formula:
Q = IN1-((IN1 DIV IN2) * IN2)
where DIV produces an integer number.
The result is output to Q unless one of the following invalid conditions occurs:
â–ª 0 divided by 0 (Results in an application fault.)
â–ª IN1 and/or IN2 is NaN (Not a Number)
Operands for Modulus Function
Calculated by the FBD editor.
Dividend: the value to be divided into in
order to obtain the remainder; shown to the
left of MOD in the equation IN1 MOD IN2=Q.
Divisor: the value to divide into IN1; shown
to the right of MOD in the equation
IN1 MOD IN2=Q.
The remainder of IN1/IN2.
All except S, SA, SB, SC
and constant