Negate (Neg); Updates To Arithmetic Status Bits - Allen-Bradley SLC 500 Series Reference Manual

Hide thumbs Also See for SLC 500 Series:
Table of Contents
5-24
Data Handling Instructions

Negate (NEG)

NEG
NEG
Negate
Source
B3:2
0001011011001000<
Dest
B3:7
1110100100111000<
Fixed SLC
SLC
SLC
5/01
5/02
5/03
Output Instruction
Publication 1747-RM001G-EN-P - November 2008
Use the NEG instruction to change the sign of the source and then place it in
the destination. The destination contains the two's complement of the source.
For example, if the source is 5, the destination would be -5.
The source and destination must be word addresses.

Updates to Arithmetic Status Bits

The arithmetic status bits are found in Word 0, bits 0 to 3 in the controller
SLC
SLC
status file. After an instruction is executed, the arithmetic status bits in the
5/04
5/05
status file are updated.
Table 5.17 Controller Function
With this Bit
S:0/0
S:0/1
S:0/2
S:0/3
The Controller
Carry (C)
clears if 0 or overflow, otherwise sets.
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.
For floating point destinations, the overflow result
remains in the destination.
Zero (Z)
sets if result is zero; otherwise resets.
Sign (S)
sets if result is negative; otherwise resets.
Table of Contents
loading

Table of Contents