Справочник Пользователя для Mitsubishi Electronics FX2NC

Скачать
Страница из 382
FX Series Programmable Controlers
Applied Instructions 5
5-27
5.3.3
MUL (FNC 22)
Operation 1: (Applicable to all units)
The contents of the two source devices (S1, S2)
are multiplied together and the result is stored at
the destination device (D). Note the normal rules of
algebra apply.
Points to note:
a) When operating the MUL instruction in 16bit mode, two 16 bit data sources are multiplied
together. They produce a 32 bit result. The device identified as the destination address is
the lower of the two devices used to store the 32 bit result. Using the above example with
some test data:
5 (D0) 
×
 7 (D2) = 35 - The value 35 is stored in (D4, D5) as a single 32 bit word.
b) When operating the MUL instruction in 32 bit mode, two 32 bit data sources are multiplied
together. They produce a 64 bit result. The device identified as the destination address is
the lower of the four devices used to store the 64 bit result.
c) If the location of the destination device is smaller than the obtained result, then only the
portion of the result which directly maps to the destination area will be written, i.e if a result
of 72 (decimal) is to be stored at K1Y4 then only Y7 would be active. In binary terms this is
equivalent to a decimal value of 8, a long way short of the real result of 72!
Operation 2: (Applicable units: FX
(2C)
)
This function is equivalent to FNC 122 EMUL.
When ‘floating point mode flag’ M8023 is active,
i.e. ON, DMUL and DMULP instructions can be
used to perform floating point multiplications.
When M8023 is reset, i.e. OFF floating point
manipulation will not occur. Constants (K/H) and
floating point numbers (stored in double data
registers D) can be used in any configuration. The constants (K/H) will automatically be
converted to the ‘floating point format’ for the operation. Answers for an operation are stored
(completely) in one pair of double (32 bits) data registers and not 2 pairs (64 bits) as used in
‘Operation 1:’. The normal rules of algebra apply to floating point multiplication.
Mnemonic
Function 
Operands
Program steps
S1
S2
D
MUL
FNC 22
(Multiplica
-tion)
Multiplies the two
source devices
together the result
is stored in the
destination device
K, H, KnX, KnY, KnM, KnS,
T, C, D, V, Z
KnY,KnM,KnS,
T, C, D, Z(V) 
Note: Z(V) may 
NOT be used 
for 32 bit oper-
ation
MUL, MULP:
7steps
DMUL,
DMULP:
13 steps
See page 4-46 for more
details regarding floating
point format.
When using M8023 to subtract floating point 
data, only double word (32 bit) data registers 
(D) or constants (K/H) may be used.
FX
0(S)
FX
0N
FX FX
(2C)
FX
2N(C)
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
PULSE-P
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
16 BIT OPERATION
FX
FX
0N
FX
0(s)
FX
(2C)
FX
2N(C)
32 BIT OPERATION
X0
MUL
D 0
D 2
[ S1 ]
[ D ]
D 4
[ S2 ]
Viewing 64 bit numbers
It is currently impossible to monitor the contents of a 64 bit result. However, the result can
be monitored in two smaller,32 bit, blocks, i.e. a 64 bit result is made up of the following
parts: (upper 32 bits) 
× 
32
 
+ (lower 32 bits).
X10
M8023
M8000
M8023
DMULP D 0
K 40
[ S1 ]
[ D ]
D 4
[ S2 ]