Publication 1763-RM001C-EN-P - October 2009
Math Instructions
195
ABS - Absolute Value
Instruction Type: output
Exeution Time for the ABS Instruction
The ABS instruction takes the absolute value of the Source and places it in
the Destination. The data range for this instruction is -2,147,483,648 to
2,147,483,647 or IEEE-754 floating point value.
Source and Destination do not have to be the same data type. However, if
the signed result does not fit in Destination, the following will occur.
The following table shows how the math status bits are updated upon
execution of the ABS instruction:
ABS
Absolute Value
Source
N7:0
0<
Dest
N7:1
0<
ABS
Controller
Data Size
When Rung Is:
True
False
MicroLogix 1100
word
9.62
μ
s
0.87
μ
s
long word
9.71
μ
s
0.87
μ
s
ABS Result Does Not Fit in Destination
When Both Operands Are Integers
When At Least One Operand is Floating Point Data
•
If the Math Overflow Selection Bit is clear, a saturated result
(32767 for word or 2,147,836,647 for long word) is stored in
the Destination.
•
If the Math Overflow Selection Bit is set, the unsigned truncated
value of the result is stored in the Destination.
•
The ABS instruction clears the sign bit. No operation is performed
on the remaining bits.
•
If Destination is an integer and Source is NAN or infinity, a
saturated result (32767 for word or 2,147,836,647 for long
word) is stored in Destination and the Math Overflow
Selection Bit is ignored.
•
If Destination is an integer, the rounded result is stored. If an
overflow occurs after rounding, a saturated result (32767 for
word or 2,147,836,647 for long word) is stored in Destination
and the Math Overflow Selection Bit is ignored.
Updates to Math Status Bits
When Both Operands Are Integers
When At Least One Operand is Floating Point Data
•
Carry - Is set if input is negative, otherwise resets.
•
Overflow - Is set if the signed result cannot fit in the Destination;
otherwise it is reset.
•
Zero - Is set if Destination is all zero’s, otherwise it is reset.
•
Sign - Is set if the most significant bit of the Destination is set,
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.
•
Carry - Is reset.
•
Overflow - Is set if the signed result is infinity, NAN, or cannot fit
in the Destination; otherwise it is reset.
•
Zero - Is set if Destination is all zero’s, otherwise it is reset.
•
Sign - Is set if the most significant bit of the Destination is set,
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.
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive