10.5.1.4
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.
%R0201
CONST
+00001
ADD_
INT
I1 Q
I2
%M0001
%R0201
%M0002
%I0004
%I0005
%M0001
%R0201
CONST
+00001
SUB_
INT
I1 Q
I2
%R0201
%M0002
10.5.2
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 I1. 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 I1 by input I2. These parameters
must be the same data type. Output Q is calculated using the formula:
Q = I1-((I1 DIV I2) * I2)
The division produces an integer. Q is the same data type as inputs I1 and I2.
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.
Input 1
Input 2
Output
OK
Enable
MOD_
INT
I1 Q
I2
164
GFK-1503E
VersaMax PLC User Manual
For public disclosure
Summary of Contents for VersaMax PLC
Page 16: ...Notes 16 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 38: ...Notes 38 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 50: ...Notes 50 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 92: ...Notes 92 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 112: ...Notes 112 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 224: ...Notes 224 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 292: ...Notes 292 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 316: ...Notes 316 GFK 1503E VersaMax PLC User Manual For public disclosure ...
Page 317: ......