Multiplication - Mitsubishi Electric FX2N Beginners Manual

Hide thumbs Also See for FX2N:
Table of Contents

Advertisement

Math Instructions
5.4.3

Multiplication

The FX controllers' MUL instruction multiplies two 16-bit or 32-bit values and writes the result
to a third device.
Ladder Diagram
0
³ Multiplicand
· Multiplier
» Product (Multiplicand x Multiplier = Product)
The example above multiplies the contents of D0 and D1 and writes the result to D2.
NOTE
When you multiply two 16-bit values the result can quite easily exceed the range that can be
displayed with 16 bits. Because of this the product of multiplications is always written to two
consecutive 16-bit devices (i.e. a 32-bit double word).
When you multiply two 32-bit values the product is written to four consecutive 16-bit devices
(64 bits, two double words).
Always take the size of these device ranges into account when you are programming and
take care not to create range overlaps by using the devices in the ranges to which the pro-
ducts are written!
Examples
Multiply the contents of D0 and D1 and store the product in D3 and D2:
MUL D0 D1 D2
The signs of the values are taken into account by the MUL instruction. In this example the value
in D10 is multiplied by the constant value -5:
MUL D10 K-5 D20
You can also multiply 32-bit values by prefixing a "D" to the MUL instruction (DMUL):
DMUL D0 D2 D4
The MUL instruction can also be executed in pulse-triggered mode by adding a "P" suffix to the
MUL instructions (MULP, DMULP). The following multiplication is only executed when input
X24 switches from "0" to "1":
Ladder Diagram
X24
0
5 – 24
MUL D0 D1 D2
D 1
D 0
65238
x
MULP D25 D300 D26
More Advanced Programming
Instruction List
0 MUL
D 0
D 1
x
481
1805
D 10
8
x
-5
D 3
D 2
27643
Instruction List
0 LD
1 MULP
D0
D1
D2
D 3
D 2
868205
D 21
D 20
-40
D 7
D 6
D 5
D 4
1803374034
X24
D25
D300
D26
MITSUBISHI ELECTRIC

Advertisement

Table of Contents
loading

Table of Contents