Sign in to follow this  
Followers 0
BobLfoot

Control Logix math Overflow

8 posts in this topic

Anybody seen this before. The Following instruction will produce a math overflow. While this rewrite does not.

Share this post


Link to post
Share on other sites
'Overflow' is a reaction to a particular result of a math operation. The math operation in the second example did not overflow. You ended up with a minus value ('N' register interpreted as signed) in the destination. But that's ok.

Share this post


Link to post
Share on other sites
I suspect that the DIV instruction still creates a math overflow, but the following instructions reset it before you can see it.

Share this post


Link to post
Share on other sites
In his second example the DIV operation does not cause an overflow. The destination can take the result without a sign change. Of the other operations one is a 'math' (the MOV which interprets value) but it isn't being allowed to execute. The MVM is definately not a math operation, just a bit move through a mask. Since the final integer can legitimately have a negative value, moving one into it by means of the MVM is not an overflow. To test, just do the second example but just do the DIV into the DINT destination. There is no overflow. Edited by b_carlton

Share this post


Link to post
Share on other sites
I see it now. I didn't notice that the destination of the DIV was a different tag.

Share this post


Link to post
Share on other sites
The final question would be, since -24586 is not the proper result of the division of 4095 by .1, then does the end item which uses the value in the integer interpreting it as an unsigned number? In that case it should be ok. Otherwise the overflow says "the proper result cannot be stored into the destination".

Share this post


Link to post
Share on other sites
It looks like it's being used only on a Panelview. Must be displayed as a "unsigned integer".

Share this post


Link to post
Share on other sites
It would seem to me that the result of the original DIV would exceed 32767 with or without sign change thus the destination address could not handle it. I might have been better to have the result be a DINT tag and the error might not have appeared. Might need to add additional compares and MOVs to protect process.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0