Publication 1763-RM001C-EN-P - October 2009
Math Instructions
193
ADD - Add
SUB - Subtract
Instruction Type: output
Use the ADD instruction to add one value to another value (Source A +
Source B) and place the sum in the Destination.
Use the SUB instruction to subtract one value from another value (Source
A - Source B) and place the result in the Destination.
Updates to Math Status Bits:
•
Carry - is reset
•
Overflow - Is set if the result is infinity, NAN, or if a conversion to integer overflows;
otherwise it is reset.
•
Zero - Is set if the lower 31 bits of the Floating Point Data result is all zero’s, otherwise it is
reset.
•
Sign - Is set if the most significant bit of the Destination is set (bit 15 for word, bit 31 for long
word or floating point data); otherwise it is reset.
•
Overflow Trap - The Math Overflow Trap Bit is only set if the Overflow bit is set. Otherwise, it
remains in its last state.
Considerations When Using Floating Point Data
ADD
Add
Source A
N7:0
0<
Source B
N7:1
0<
Dest
N7:2
0<
ADD
SUB
Subtract
Source A
N7:0
0<
Source B
N7:1
0<
Dest
N7:2
0<
SUB
Execution Time for the ADD and SUB Instructions
Controller
Instruction
Data Size
When Rung Is:
True
False
MicroLogix 1100
ADD
word
13.44
μ
s
0.87
μ
s
long word
13.34
μ
s
0.87
μ
s
SUB
word
13.31
μ
s
0.84
μ
s
long word
13.46
μ
s
0.84
μ
s
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive