Using Math Instructions
8–5
Subtract (SUB)
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 constant.
Updates to Arithmetic Status Bits
With this Bit:
The Controller:
S:0/0
Carry (C)
sets if borrow is generated; otherwise resets.
S:0/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 S:2/14 (math overflow selection bit) 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.
Programming
Execution Times
(
µ
sec) when:
True
False
33.52
6.78
SUB
SUBTRACT
Source A
Source B
Dest
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive