Chapter 7 Second Development Platform VP3000
320
API Instruction code Operand Function
114
MUL16 /
MUL32
P S
1
, S
2
, D
Multiplying binary numbers for 16-bit /
Multiplying binary numbers for 32-bit
Type
Operand
Bit devices Word devices
16-bit instruction (7 steps)
MUL
Continuous
execution
type
MULP
Pulse
execution
type
32-bit instruction (13 steps)
DMUL
Continuous
execution
type
DMULP
Pulse
execution
type
Associated flag: none
X Y M K H KnX KnY KnM T C D
S
1
S
2
D
Caution for using operand: see the remark below
Description
S
1
: Multiplicand
S
2
: Multiplicator
D: Product
MUL16 and MUL16P are 16-bit instructions. MUL32 and MUL32P are 32-bit instructions.
The signed binary value in S
1
is multiplied by the signed binary value in S
2
, and the product is
stored in D. Notice that it is applicable to normal algebraic regulations.
If the sign bit is 0, it represents a positive value. If the sign bit is 1, it represents a negative value.
16-bit BIN multiplication
16-bit value 16-bit value 16-bit value
When D serves as a bit device, it can designate K1–K4 and construct a 16-bit result, occupying
one 16-bit data.
32-bit BIN multiplication
32-bit value 32-bit value 32-bit value
When D serves as a bit device, it can designate K1–K8 and construct a 32-bit result,
occupying one 32-bit data.
Example
The 16-bit value K100 in D0 is multiplied by the 16-bit value K200 in D10, and the product is
stored in D20. Whether the value is positive or negative is indicated by OFF / ON of MSB. OFF
indicates the positive value (0), and ON indicates the negative value (1).
X0
MUL16
D0 D10 D20
16-bit value 16-bit value 16-bit value
D0 D10 D20