6 IEC FUNCTIONS
6.5.5 Modulus operation
Division is performed between the specified data, and its remainder is operated.
Function definition
6 - 35
MOD
MOD_E
BOOL MOD_E( BOOL EN, ANY_INT S1, ANY_INT S2, ANY_INT D1 );
Argument
Argument Name
IN/OUT
EN
IN
S1
IN
S2
IN
D1
OUT
Return value
Return Value
BOOL
Execution condition (bit data)
Example of use
Argument Type
INT
B100 :=
MOD_E( M1, D10, D20, D30
);
DINT
b_result := MOD_E( b_select,
di_data1, di_data2, di_data3 );
MOD can be used as an operator only.
Execution condition (Function is executed only when the result is TRUE)
Dividend data
Divisor data
Modulus operation result
ST Program
Conversion Result
LD
/
MOV
LD
OUT
LD
D/
DMOV
LD
OUT
For the usable data type, refer to "3.2.2 About ANY type".
Description
Description
Used Instruction
M1
LD, /, MOV, OUT
D10
D20
D10238
D10239
D30
M1
B100
LD, D/, DMOV,
b_select
di_data1
OUT
di_data2
D10236
D10238
di_data3
b_select
b_result
6 - 35