beautypg.com

Negate (neg), Preface, Updates to arithmetic status bits – Rockwell Automation 1761 MicroLogix 1000 Programmable Controllers User Manual

Page 170

background image

Preface

MicroLogix 1000 Programmable Controllers User Manual

9–22

Negate (NEG)

Use the NEG instruction to change the sign of a value. If you negate a negative
value, the result is a positive; if you negate a positive value, the result is a negative.
The destination contains the two’s complement of the source.

The source and destination must be word addresses.

Updates to Arithmetic Status Bits

With this Bit:

The Controller:

S:0/0

Carry (C)

clears if 0 or overflow, otherwise sets.

S:0/1

Overflow (V)

sets if overflow, otherwise reset. Overflow occurs only if
–32,768 is the source. On overflow, the minor error flag is also
set. The value 32,767 is placed in the destination. If S:2/14 is
set, then the unsigned, truncated overflow remains in the
destination.

S:0/2

Zero (Z)

sets if result is zero; otherwise resets.

S:0/3

Sign (S)

sets if result is negative; otherwise resets.

Execution Times

(

µ

sec) when:

True

False

29.48

6.78

NEG

NEGATE
Source

Dest