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

Chapter 10
Using Math Instructions
10–5
Use the SUB instruction to subtract one value (Source B) from another
(source A) and place the result in the destination.
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)
sets if borrow is generated; otherwise resets.
S0/1
Overflow (V)
sets if underflow; otherwise reset. On underflow, the minor
error flag is also set. The value –32,768 or 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.
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
S U B
S R C A
N 1 0
0
P 0 0 0
S U B
S R C B
1 0 0 0
P 0 0 0
S U B
D E S T
N 2 0
0
SUB
SUBTRACT
Source A
N7:10
0
Source B
1000
Dest
N7:20
0
Execution Times (
µ
sec) when:
True
False
33.52
6.78
Ladder representation:
Subtract (SUB)
8
FUN
ENT
To enter the function code, press:
1