I'm trying to do something similar with RSLogix 5000 V20.12, 1769-L36ERM PLC.
What I am trying to do is to do major changes to the subroutine, but I want to keep original for reference to troubleshoot.
I've made a backup copy of it with different name that is does not have a JSR to it from main routine. Yet the backup still have green rails when it doesn't have JSR to it from main.
I know that AFI will turn off OTE bit, rung in false condition will also turn off OTE bit.
Both subroutines have the same OTE bits. I want the PLC to only turn on/off the same OTE bits in one subroutine and ignore them in the backup. Is that possible?
I could keep back up ACD with one of those routines in each but then I would lose online state of the XIC, XIO bits in the back up.
Sorry about asking before trying but I would like to find out also if there consequences I don't know about if it actually works.
So far I agree with pretty much all of the comments ... to summarize:
- if the subroutine is not called, you don't have to worry about 'commenting out' the code - it is not executing
- to be paranoid, add a TND or RET as the first rung of the backup copy so that the subroutine returns immediately after being called instead of executing
- a separate unscheduled task works fine as well
- as mentioned, multiple OTEs to a single bit give warnings and make experienced programmers 'CRAZY' as they try to figure out what you did and why
My own comments, to add a bit ..
- I like using a NOP in the first rung, then tying a big comment to it to explain that the logic is not executing but is kept for reference
- My single bits, used to switch between 'old method' logic and 'new method' logic are called Upgrade, a boolean array of maybe 10 - 16 bits. Once you get past 16 upgrades at a time, you need to clean stuff up!
XIO Upgrade[1] JSR Old_SBR
XIC Upgrade[1] JSR New_SBR
- After your New_SBR has been running for a week/month/year you need to remove the old one, get rid of the Uprade[1] condition on the new one .. some housekeeping.
- If you don't clean house at least yearly, you begin to look at the old code and ask questions like 'did I DO THIS?' or 'Man, is this OLD CODE'.
I would like to think that I can point to my present code as an example of what a newbie should do ... not a list of things that a newbie should avoid!
This takes time .. but it's worth it when you are trying to bring a new contractor or new employee up to speed on how things are done. If there is no style or rules for them to follow, they will make up new stuff!! Exceptions drive *EVERYONE* crazy.