Zerav

RSLogix 5000, ADD is not adding

9 posts in this topic

Hello.

 

A colleague sent me a screenshot (attached) with a peculiar issue. An ADD function that only sends 0 as the outcome, and a DTOS function that only sends " .

I have confirmed that all variables used in the ADD block are declared as integers, and both SumInt6 and String10 are not currently being modified somewhere else. 

This impatient colleague is baffled, while I am just sharing this issue in the hopes that someone will eventually come with the simple answer that we are overlooking, or a complex one that we could never hope to realize by ourselves.

 

Thanks in advance.

WhatsApp Image 2016-12-03 at 11.01.58 AM.jpeg

Edited by Zerav
Spelling error

Share this post


Link to post
Share on other sites

Sounds simple but it's a mistake I've made more than once- Is he calling the routine?

1 person likes this

Share this post


Link to post
Share on other sites

No, he was not calling the routine.

Once called, the routine seems to be working up to the 24th row, like if the last 6 rows don't exist, he is editing in REMOTE RUN mode and claims that this new rungs are already assembled, yet they don't seem to work.

So, how can we call the full routine?

Edited by Zerav

Share this post


Link to post
Share on other sites

Any chance he's exiting the routine programmatically with a RET instruction ?

That last rung is weird;  it uses the same tag for both argument A and B in an EQU, so it's logically always true.   In addition, you almost never want to compare REAL values with an EQU, since they can be slightly different while appearing similar.

When I'm troubleshooting a routine and am not certain it's being executed, I put in a diagnostic rung with a new DINT, and just an ADD( MyDint, 1, MiDint) instruction.   If the value increments every scan I know for sure the logic is being called.

1 person likes this

Share this post


Link to post
Share on other sites
14 hours ago, Zerav said:

No, he was not calling the routine.

Once called, the routine seems to be working up to the 24th row, like if the last 6 rows don't exist, he is editing in REMOTE RUN mode and claims that this new rungs are already assembled, yet they don't seem to work.

So, how can we call the full routine?

The call is for the complete routine. If the complete routine isn't running there is a problem with the logic. I can only see rung 28 and 29, which appear to be assembled.

Share this post


Link to post
Share on other sites

It could be that your DN bit is actually set by the time it gets to that location in the logic.  Try putting a rung with a latch statement above that rung to see if the done bit is set and inhibiting your ADD from working.  Good call on the missing JSR Michael!  (Hmmm no pun intended)  We have all done that one I'm sure. 

Edited by PLCMentor.com
2 people like this

Share this post


Link to post
Share on other sites

In the picture shown the DN bit is set,the XIO instruction  makes the rung false. The ADD instruction is not going to execute.

Edited by Mickey

Share this post


Link to post
Share on other sites

Well the done bit shows that its off in the picture, but you know you cant always rely on the colorful things that the software has for you.  Thats why I would check it with a new rung right above it to make sure the dn bit is as you assume it is - off. 

Share this post


Link to post
Share on other sites

Truth is, I am not in the same location as my colleague and, because he is not fluent with English, I was the chosen one to look for clues and ideas on the wilderness of the internet. This distance, in combination with other job related responsibilities, makes for a great delay in feedback.
I know that this particular issue is solved since Sunday morning, and I am curious to know how it was fixed, but my colleague is busy and who knows when (or if) he will answer to my curiosity.

Thank you all for your feedback, I hope I can answer soon with the (hopefully simple enough) fix that solved this issue.

 

---Update---

Well, there was an AFI function that prevented the routine from proper execution... so that's it.

Again, thank you all for your ideas.

Edited by Zerav

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