Divide (div), Updates to arithmetic status bits, Entering the instruction – Rockwell Automation 1761-HHP-B30 MicroLogix 1000 with Hand-Held Programmer (HHP) User Manual

Page 175: Changes to the math register

Advertising
background image

Chapter 10
Using Math Instructions

10–9

Use the DIV instruction to divide one value (source A) by another
(source B), and place the rounded quotient in the destination. If the
remainder is 0.5 or greater, the destination is rounded up.

Source A and B can either be a word address or a constant; however, both
sources cannot be a constant. The destination must be a word address.

Updates to Arithmetic Status Bits

With this Bit:

The Controller:

S0/0

Carry (C)

always resets.

S0/1

Overflow (V)

sets if division by zero or overflow is detected; otherwise
resets. On overflow, the minor error flag is also set. The
value 32,767 is placed in the destination. If S2/14 (math
overflow selection bit) is set, then the unsigned, truncated
overflow remains in the destination.

S0/2

Zero (Z)

sets if result is zero; otherwise resets; undefined if overflow
is set.

S0/3

Sign (S)

sets if result is negative; otherwise resets; undefined if
overflow is set.

Entering the Instruction

You enter the instruction from within the program monitor functional area.

P 0 0 0

D I V

S R C A

1 0 0

P 0 0 0

D I V

S R C B

T 0 0 . P R E

1 0 0

P 0 0 0

D I V

D E S T

C 0 1 . P R E

1 2 0

Changes to the Math Register

The unrounded quotient is placed in the most significant word; the remainder
is placed in the least significant word.

DIV

DIVIDE
Source A

100

Source B

T4:0.PRE

100

Dest

C5:1.PRE

120

Execution Times (

µ

sec) when:

True

False

147.87

6.78

Ladder representation:

Divide (DIV)

3

U

8

FUN

ENT

To enter the function code, press:

Advertising