13.07.2015 Views

1766-RM001A-EN-P MicroLogix 1400 Programmable Controllers ...

1766-RM001A-EN-P MicroLogix 1400 Programmable Controllers ...

1766-RM001A-EN-P MicroLogix 1400 Programmable Controllers ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Math Instructions 207Source and Destination do not have to be the same data type. However, ifthe signed result does not fit in Destination, the following will occur.ABS Result Does Not Fit in DestinationWhen Both Operands Are Integers• If the Math Overflow Selection Bit is clear, a saturated result(32767 for word or 2,147,836,647 for long word) is stored inthe Destination.• If the Math Overflow Selection Bit is set, the unsigned truncatedvalue of the result is stored in the Destination.When At Least One Operand is Floating Point Data• The ABS instruction clears the sign bit. No operation is performedon the remaining bits.• If Destination is an integer and Source is NAN or infinity, asaturated result (32767 for word or 2,147,836,647 for longword) is stored in Destination and the Math OverflowSelection Bit is ignored.• If Destination is an integer, the rounded result is stored. If anoverflow occurs after rounding, a saturated result (32767 forword or 2,147,836,647 for long word) is stored in Destinationand the Math Overflow Selection Bit is ignored.The following table shows how the math status bits are updated uponexecution of the ABS instruction:Updates to Math Status BitsWhen Both Operands Are Integers• 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 theOverflow bit is set. Otherwise, it remains in its last state.When At Least One Operand is Floating Point Data• Carry - Is reset.• Overflow - Is set if the signed result is infinity, NAN, or cannot fitin 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 theOverflow bit is set. Otherwise, it remains in its last state.Publication <strong>1766</strong>-<strong>RM001A</strong>-<strong>EN</strong>-P - October 2008

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!