5.3 Standard Arithmetic Functions
144
FXCPU Structured Programming Manual
(Application Functions)
5.3.5
MOD(_E)
Outline
This function performs division using two values (A / B = C
…
remainder), and outputs the remainder.
1. Format
*1.
Output variable
*2.
Refer to the Cautions
2. Set data
In explanation of functions, I/O variables inside ( ) are described.
Explanation of function and operation
This function performs division (
/
) using word [signed]/double word [signed] data stored in devices
specified in
and
, and outputs the remainder to a device specified in
using the data type of
data stored in devices specified in
and
.
Example: When the data type is word [signed]
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) Note that the "MOD" description method is different from other function description methods in the ST
language.
FX
3U(C)
FX
3G
FX
2N(C)
FX
1N(C)
FX
1S
FX
U
/FX
2C
FX
0N
FX
0(S)
Function name
Expression in each language
Structured ladder
ST
MOD
_IN1 MOD _IN2; *2
Example:
Label 3:=
Label 1 MOD Label 2;
MOD_E
MOD_E(EN,_IN1,_IN2,Output
label; *2
Example:
MOD_E(X000,Label 1,
Label 2,Label 3);
Variable
Description
Data type
Input
variable
EN
Execution condition
Bit
_IN1 (
)
Data to be divided, or word device which stores such data
ANY_INT
_IN2 (
)
Data for division (divisor), or word device which stores such data
ANY_INT
Output
variable
ENO
Execution status
Bit
*1
(
)
Word device which will store the operation result
ANY_INT
MOD
*1
Label 3
Label 1
_IN1
Label 2
_IN2
MOD_E
EN
ENO
*1
Label 3
X000
Label 1
_IN1
Label 2
_IN2
s1
s2
d
s1
s2
s1
s2
d
s1
s2
5
/
2
2
(Quotient)
1
(Remainder)
(Word
[signed] data)
(Word
[signed] data)
s2
(Word
[signed] data)
s1
d
Not output