KEYENCE Visual KV Series User Manual

Page 181

Advertising
background image

2.4 Instruction Details

1

2

3-157

Chapter 2 Instructions

Arithmetic flag

2009

No change

2010

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

2011

No change

2012

Turns ON when the divisor of a DIV operation is "0" or the DM or relay
indirectly addressed with #TM is out of range.

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

Description

The 32-bit value (binary) consisting of the higher 16 bits from TM00 and lower 16
bits from the internal register is divided by the value specified by the operand.
The higher 16 bits of the result is input back to TM00 and lower 16 bits to the
same internal register. The remainder is stored in TM01.

Note 1: When data of 16 bits or less is divided by the operand value, the contents of
TM00 must be cleared (set to "#00000") before the DIV operation.

Note 2: If the contents of TM00 are not cleared, the data stored in TM00 is also
used for the operation.

Tips

Solution when data of 16 bits or less is divided

TM00

TM00

TM01

DM0000

DM0001

DM0002

DM0003

DM0004

#00100

Quotient

Example

Low-order 16 bits

Remainder (16 bits)

Internal register

Operand

High-order 16 bits

Internal register

Remainder (16 bits)

Low-order 16 bits

High-order 16 bits

Low-order 16 bits

High-order 16 bits

Low-order 16 bits

High-order 16 bits

Quotient

02002

#00000

LDA

TM00

STA

DM0000

LDA

DM0001

DIV

DM0002

STA

TM01

LDA

DM0003

STA

TM00 • DM0000 = TM00 • DM0002 ••• DM0003

High-order
16 bits

Quotient

Remainder

Low-order
16 bits

High-order
16 bits

Low-order
16 bits

DIV / @DIV

KVNKA Chap 02_4cP.p65

08.3.11, 0:02 PM

157

Advertising