Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
9 Applied Instructions (Arithmetic and Logical Operation)
9.4 DIVP / Division
179
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
1
Outline
2
Instruction List
3
Configuration of
Instruction
4
How to Read
Explanation of
Instructions
5
Basic Instruction
6
Step Ladder
Instructions
7
Applied Instructions
(Program Flow)
8
Applied Instructions
(Move and
Compare)
9
Applied Instructions
(Arithmetic and
Logical Operation)
10
Applied Instructions
(Rotation and
Shift Operation)
Function and operation explanation
1. 16-bit operation(DIVP)
The contents specified by indicates the dividend, the contents specified by indicates the divisor, the
quotient and remainder are transferred to the device specified by .
The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data is divided
algebraically, for example, 36 ÷ (-5) = -7 (quotient) and 1 (remainder).
Two devices in total starting from are occupied to store the operation result (quotient and remainder).
Make sure that these two devices are not used for other control.
When a constant (K) is specified in or , it is automatically converted into the binary format.
2. 32-bit operation(DDIV, DDIVP)
The contents specified by indicates the dividend, the contents specified by indicates the divisor, the
quotient and remainder are transferred to the device specified by .
Four devices in total starting from are occupied to store the operation result (quotient and remainder).
Make sure that these four devices are not used for other control.
The most significant bit of each data indicates the sign (positive: 0 or negative: 1), and data is divided
algebraically, for example, 5,500 ÷ (-540) = -10 (quotient) and 100 (remainder).
When a constant (K) is specified in or , it is automatically converted into the binary format.
Extension function(FXU and FX2C PLCs)
The FXU PLC of V2.30 or earlier does not support the extension function.
When executing an instruction with M8023 ON, a binary float operation takes place, for example, (D1, D0) ÷
(D3, D2) = (D5, D4).
In this case, K, H and D are valid as the object device for and and D is valid for .
The source data needs to be converted into binary float value in advance by FLT instruction.
Note, however, that constants K and H are automatically converted into binary float values.
Related device
*1. Supported only by FX3S, FX3G, FX3GC, FX3U and FX3UC PLCs.
Available in the FX
3U and FX3UC PLCs of Ver. 2.30 or later.
Device Name Description
M8304
*1
Zero
ON : When the operation result is 0
OFF : When the operation result is not 0
M8306
*1
Carry
ON : When the operation result is more than 32,767 (in 16-bit operation) or 2,147,483,647 (in
32-bit operation), the carry flag operates.
OFF : When the operation result is not more than 32,767 (in 16-bit operation) or
2,147,483,647(in 32-bit operation)
Command input
Division data 1
Division data 2
Device storing
the division
result
DIVP
EN
s1
s2
ENO
d
Dividend
BIN BIN BIN BIN
( ) ÷ ( ) ( )··· ( +1)
16 bits
s1 s2 d d
16 bits16 bits 16 bits
Divisor Quotient
Remainde
r
DDIV
EN
s1
s2
ENO
d
Device storing
the division
result
32 bits
s1 s2 s2
[ +1, ] ÷ [ +1, ] [ +1, ] ··· [ +3, +2]
s1 d d d d
BIN BIN BIN BIN
32 bits 32 bits 32 bits
Command input
Dividend Divisor Quotient
Remainder
Division data 1
Division data 2