Multiplication - Mitsubishi MELSEC System Q Manual

Hide thumbs Also See for MELSEC System Q:
Table of Contents

Advertisement

More Advanced Programming
6.4.3

Multiplication

The "MUL" instruction multiplies two 16-bit or 32-bit values and writes the result to a third
device.
Ladder Diagram
³ Multiplicand
· Multiplier
» Product (result of the multiplication, multiplicand x multiplier = product)
The example above multiplies the contents of D1 and D2 and writes the result to D3.
NOTE
The data types of the input and output variable of the MUL instruction must be identical.
When the result of the multiplication exceeds the value range for 16-bit or 32-bit variables the
most significant bits get lost and the product is not correct. When 16-bit values are to be mul-
tiplied they can be copied into 32-bit variables as described for the ADD instruction (see
chapter 6.4.1). The MUL instruction is then performed with these 32-bit variables and the re-
sult will be correct.
For a MUL instruction up to 28 input variables can be defined. The setting is similar to the ADD
instruction (see chapter 6.4.1).
Examples
Multiply the contents of D1 and D2 and store the product in D3:
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:
MELSEC System Q Beginners Manual
IEC Instruction List
LD
MUL
ST
D 1
D2
144
x
17
D 10
x
-5
8
Math Instructions
D1
D2
D3
D 3
2448
D 20
-40
6 – 29

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents