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

Page 205

Advertising
background image

Chapter 11
Using Data Handling Instructions

11–22

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:

S0/0

Carry (C)

clears if 0 or overflow, otherwise sets.

S0/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
S14 is set, then the unsigned, truncated overflow remains
in the destination.

S0/2

Zero (Z)

sets if result is zero; otherwise resets.

S0/3

Sign (S)

sets if result is negative; otherwise resets.

Entering the Instruction

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

P 0 0 0

N E G

S R C

N 4

0

P 0 0 0

N E G

D E S T

N 1 1

0

NEG

NEGATE
Source

N7:4

0

Dest

N7:11

0

Execution Times (

µ

sec) when:

True

False

29.48

6.78

Ladder representation:

Negate (NEG)

2

L

To enter the function code, press:

ENT

1

FUN

1

Advertising