Example - Mitsubishi Electric MELSEC iQ-F Series Training Manual

Fx5u
Hide thumbs Also See for MELSEC iQ-F Series:
Table of Contents

Advertisement

2.
When the input condition turns on, the value in the device specified in (s1) is divided by the value in the device specified
in (s2), and the result is stored in the device specified in (d). Values after the decimal point of the division result are
ignored.
The quotient is stored in D120 that
is specified in the program.
When a bit device is specified in (d), the quotient is stored but the remainder is not stored.
The following shows examples of processing of negative values.
-5 ÷ (-3) = 1, remainder = -2

Example

5 ÷ (-3) = -1, remainder = 2
The following shows examples of dividing a value by 0 or dividing 0 by a value.
0 ÷ 0
Example
1 ÷ 0
0 ÷ 1
■Operation practice
 Write the program to the CPU module and set the operating status of the CPU module to RUN.
 Turn on X100 and store the value of the initial input device D20 in D100.
 Turn on X102. The multiplication of 600 × D100 is executed.
 Turn on X103. The division of D100 ÷ 600 is executed.
Operand
Bit
X, Y, M, L,
J\
SM, F, B,
SB, FX,
FY
(s1)
(s2)
(d)
*1 The number of steps in a multiplication instruction varies depending on the devices to be used.
(s1)
(s2)
D100
K600
4000
600
÷
Error "OPERATION ERROR"
Quotient and remainder = 0
Word
T, ST, C, D,
U\G,
W, SD,SW,
J\,
FD, R, ZR,
U3E\(H)G
RD
(d)
D120
D121
6
400
=
Quotient
Remainder
and
The remainder is stored in the
subsequent device area D121.
Double
Indirect
word
specification
Z
LT,
LZ
LST,
LC
5 BASIC INSTRUCTIONS -PART 2-
5.4 Arithmetic Operation Instructions
Constant
Others
Number of
basic
steps
K,
E
$
H
Multiplication
instruction: 3
*1
or 4
Division
instruction: 4
5
5 - 31

Advertisement

Table of Contents
loading

Table of Contents