User Manual
Chapter 23
GFK-1645M
Dec 2019
Instruction Set Reference
466
Example
This example uses the Addition and Subtraction functions to keep track of the number of
parts in a temporary storage area. Each time a part enters the storage area, power flows
through relay %I0004 to a positive transition coil with reference %M0001. Relay %M0001
then enables the Addition function, adding the (constant) value 1 to the current total value
in %R0201.
Each time a part leaves the storage area, power flows through relay %I0005 to a positive
transition coil with reference %M0002. Relay %M0002 then enables the Subtraction
function, subtracting the (constant) value 1 from the current total value in %R0201.
Figure 300
23.5.4
Math and Numerical Functions
Modulo Division
The Modulo Division function divides one value by another of the same data type, to obtain
the remainder. The sign of the result is always the same as the sign of input parameter IN1.
The Modulo function operates on these types of data:
INT
Signed integer
DINT
Double precision signed integer
When the function receives power flow, it divides input IN1 by input IN2. These parameters
must be the same data type. Output Q is calculated using the formula:
Q = IN1-((IN1 DIV I2) * I2)
The division produces an integer number. Q is the same data type as inputs IN1 and IN2. OK
is always ON when the function receives power flow, unless there is an attempt to divide by
zero. In that case, it is set OFF.
Figure 301