5.3 Standard Arithmetic Functions
142
FXCPU Structured Programming Manual
(Application Functions)
5.3.4
DIV_E
Outline
This function performs division using two values (A / B = C
…
remainder), and outputs the quotient.
1. Format
*1.
Output variable
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]/float (single precision)
data stored in devices specified in
and
, and outputs the operation result 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
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.
Error
1) An operation error occurs when the divisor stored in a device specified in
is "0", and the function is
not executed.
2) An operation error occurs when the operation result exceeds "32,767" (16-bit operation) or
"2,147,483,647" (32-bit operation).
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
DIV_E
DIV_E(EN,_IN1,_IN2,Output
label);
Example:
DIV_E(X000,D0,D10,D20);
Variable
Description
Data type
Input
variable
EN
Execution condition
Bit
_IN1 (
)
Data to be divided, or word device which stores such data
ANY_NUM
_IN2 (
)
Data for division (divisor), or word device which stores such data
ANY_NUM
Output
variable
ENO
Execution status
Bit
*1
(
)
Word device which will store the operation result
ANY_NUM
DIV_E
EN
ENO
*1
D20
X000
D0
_IN1
_IN2
D10
s1
s2
d
s1
s2
s1
s2
d
s1
s2
5
/
2
2
(Quotient)
(Word
[signed] data)
(Word
[signed] data)
s2
(Word
[signed] data)
s1
d
s2