Posted 3 Dec 2016 (edited) 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. Edited 3 Dec 2016 by Zerav Spelling error Share this post Link to post Share on other sites
Posted 3 Dec 2016 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
Posted 3 Dec 2016 (edited) 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 3 Dec 2016 by Zerav Share this post Link to post Share on other sites
Posted 3 Dec 2016 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
Posted 4 Dec 2016 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
Posted 5 Dec 2016 (edited) 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 5 Dec 2016 by PLCMentor.com 2 people like this Share this post Link to post Share on other sites
Posted 5 Dec 2016 (edited) 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 5 Dec 2016 by Mickey Share this post Link to post Share on other sites
Posted 6 Dec 2016 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
Posted 6 Dec 2016 (edited) 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 7 Dec 2016 by Zerav Share this post Link to post Share on other sites