beautypg.com

Subtract (sub), Using arithmetic status bits, Math register – Rockwell Automation 1747-PT1, D1747NP002 Hand-Held Terminal User Manual

Page 280

background image

Chapter 20
Math Instructions

20–4

Subtract

SUB

Output Instruction

(SUB)

SUB

SUBTRACT
Source A

N7:0

879

Source B

N7:1
2150

Dest

N7:2

–1271

F1

F2

F3

F4

F5

ZOOM on SUB –(SUB)– 2.3.0.0.2
NAME: SUBTRACT
SOURCE A: N7:0 879
SOURCE B: N7:1 2150
DEST: N7:2 –1271

EDT_DAT

HHT Ladder Display:

HHT Zoom Display:

Ladder Diagrams and APS Displays:

(online monitor mode)

The value at source B is subtracted from the value at source A and then
stored in the destination.

Using Arithmetic Status Bits

C set if borrow is generated; otherwise reset

V set if underflow; otherwise reset. On underflow, the minor error flag

(S:5/0) is also set, and the value-32,768 or 32,767 will be placed in the
destination. Exception: If you are using a Series C or later SLC 5/02
processor and have the Math Overflow Selection Bit S:2/14 set, then the
unsigned, truncated overflow remains in the destination.

Z set if the result is zero; otherwise reset

S set if the result is negative; otherwise reset

Math Register

Contents unchanged.

Subtract (SUB)