beautypg.com

Mul (multiplication) – KEYENCE Visual KV Series User Manual

Page 179

background image

2.4 Instruction Details

1

2

3-155

Chapter 2 Instructions

MUL (Multiplication)

Coding

Description

The MUL instruction multiplies the contents of the internal register by the oper-
and value and inputs the result back to the internal register.

In the above example, the contents of DM0000 are multiplied by "#00100" and
the result is stored in DM0001.

When the contents of DM0000 is "#00200", for example, "#20000" is stored in
DM0001.
DM0000 (#00200) x #00100→DM0001 (#20000)

Note 1: An overflow occurs when the operation result exceeds 16 bits (#65535). In
such a case, only the data of the low-order 16 bits are stored in the internal register,
and the overflow data of the high-order 16 bits is stored in TM00. (The data of the
high-order 16 bits is always stored in TM00.)

Note 2: When an overflow occurs, special utility relay 2009 turns ON.

Tips

Solution when operation result overflows 16 bits

DM0000 x DM0001 = DM0003 (High-order 16 bits) – DM0002 (Low-order 16 bits)
The operation result must be 32 bits or less.

Arithmetic flag

2009

Turns ON when the result of a MUL operation exceeds 16 bits. Turns OFF at
other times.

2010

Turns ON when all 32 bits are "0" after a MUL operation. Turns OFF at other
times.

2011

No change

2012

The DM or relay indirectly addressed with #TM is out of range.

➮ "Indirect addressing" (p. 3-127)

DM0000

LDA

#00100

MUL

DM0001

STA

2002

Line No.

Instruction

Operand

0000

LD

2002

0001

LDA

DM0000

0002

CON

0003

MUL

#00100

0004

CON

0005

STA

DM0001

F

(TM00)

F F F

0 0 0 2

F F F F

0 0 0 1

(Internal register)

Internal register

Operand

Hexadecimal number

2002

DM0000

LDA

DM0001

MUL

DM0002

STA

TM00

LDA

DM0003

STA

MUL / @MUL

KVNKA Chap 02_4cP.p65

08.3.11, 0:02 PM

155