SLC 5/04 Math Error

Brian S

Member
Join Date
Aug 2004
Location
WA
Posts
2
I recently had a SLC 5/04 processor fault out due to a math error. The overflow trap and zero bits were both set. I was finally able to locate it by searching through the various math instructions (ADD,SUB,MUL,DIV). The problem was division by zero.

Question: Is there an easier way to locate the file/rung location of the math error rather than look through each type of instruction?

Thanks
Brian
 
Prevention, Dear Watson, prevention!

Brian,
The best cure is not have the fault occur. The DIV instruction will always fault the processor if you attempt a divide by zero. Obviously that is undefined or infinity or what ever you like to refer to it as so stop it before it occurs. Check the value of the divisor in your instruction and make sure it is non-zero. If it is zero then either jump the divide rung or set the value to a harmless number like 1 or something. The other major cause of math errors is number value overrun. The limit in the SLC processors is -32768 to +32767 and if you attempt to go past those values, you will get an overrun error. There are processors with wider ranges but all have limits except these new Control Logix things and they are almost like PCs. Same idea as the DIV, make sure you do not go past the limit and if you do, then reset the overrun bit in the last rung of the program right ahead of the END rung. Now, if you are going to do these things then also be aware of the impact such a thing can have on your calculations and program accordingly. Just remember, the errors are there and to react to them is one way to program but to prevent them is even better.
 
Thanks for the advice. I agree that initial prevention is the key, and have made the necessary changes. I was just curious if there was a shortcut key or something to locate the actual math error. Sort of like using CTRL-F to quickly locate IRD zones.

Brian
 
I have run across this one before myself also, what I had done, was under my main program at the last rung always have put in an overflow unlatch instruction to prevent such an incident. As stated before prevention is the best cure, but also no one is perfect, and it is always a pain in the *** to have to go out to a machine and reset that fault.
 
Same old, same old

You might want to take a look at THIS OLD THREAD.

THIS ONE provides useful information about how to fix the problem.


Whoops. I just realized I replied to a resurrected 3-week old post. Oh well, I haven't been around much lately (long start-up)....
 
Last edited:

Similar Topics

We are getting a fault...... Math Overflow Trap S:5/0 = 1 Apparently we are getting a value greater than 32767 or less than -32766. If...
Replies
6
Views
7,826
I am using the cpt instruction on a slc 5/05 i have used this before to add, subtracted and multiply but not to divid. now when i enter the...
Replies
3
Views
3,700
I need to multiply a float (0 - 36) by 1,000,000 and then totalize this. What I am thinking of doing is using the 32b math operations, but I'm not...
Replies
10
Views
2,134
Please see the attached file. There are two rungs of interest - 9 and 10. The CPT compute blocks should execute identically mathematically...
Replies
16
Views
4,644
Hello all, As the topic name says I am having an issue with math. I am using the CPT function with an equation of ((N7:60-N7:61)|N7:60)* 100) and...
Replies
7
Views
3,490
Back
Top Bottom