Publication 1766-RM001A-EN-P - October 2008
200
Math Instructions
Updates to Math Status
Bits
After a math instruction is executed, the arithmetic status bits in the status
file are updated. The arithmetic status bits are in word 0 in the processor
status file (S2).
Overflow Trap Bit, S:5/0
Minor error bit (S:5/0) is set upon detection of a mathematical overflow or
division by zero. If this bit is set upon execution of an END statement or a
Temporary End (TND) instruction, the recoverable major error code 0020
is declared.
In applications where a math overflow or divide by zero occurs, you can
avoid a controller fault by using an unlatch (OTU) instruction with
address S:5/0 in your program. The rung must be between the overflow
point and the END or TND statement.
The following illustration shows the rung you can use to unlatch the
overflow trap bit.
Math Status Bits
With this Bit:
The Controller:
S:0/0
Carry
sets if carry is generated; otherwise resets
S:0/1
Overflow
sets when the result of a math instruction does not fit into the
destination, otherwise resets
S:0/2
Zero Bit
sets if result is zero, otherwise resets
S:0/3
Sign Bit
sets if result is negative (MSB is set), otherwise resets
S:2/14
Math Overflow
Selected
(1)
(1) Control bits.
examines the state of this bit to determine the value of the
result when an overflow occurs
S:5/0
Overflow Trap
sets if the Overflow Bit is set, otherwise resets
U
S:5
0
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive