commenting out a rung (similar to # in c++)

Rockwell processors have the MCR instruction that you can wrap around a series of rungs (or just 1). That's about the only way I know of to completely ignore a rung of code.
You can put an "always off" bit in the front of it, but that will cause any output instructions to turn off. This is probably OK if the rung is only doing math, but may not work for you if it has a boolean output.
 
The way I do this is to create a Bit I call Always Off. I have this bit in a rung early in the program with an OTU unlatch output set. So this bit is “always off”. Then I use it in my program when I need to make sure something stays off. Then if I don't want to scan/execute a rung I use this bit. I try to limit its use but find when used it easy for me to scan my program to find where I used it. My goal is when I am finished with my project it will not be used.
 
Fer instance, Allen-Bradley Logix 5000 uses the AFI (always false) instruction.

But please, please include comment why it was 'commented out.' Nothing worse than trying to figure out what someone was thinking two years down the road.

I know it is probably a 'temporary' troubleshooting method, but I've found that 'temporary' can be years.
 
RSLogix 500 includes the MCR instruction, but I just ran a little experiment. It looks like it will work the same as putting an "always off" bit in front of the rung (rung outputs turn off when the rung is disabled), so it's probably simpler just to use the bit instead.

If this is something you want to be able to switch off and on, just find an unused bit somewhere and use it as the operand in an XIC instruction at the beginning of the rung. That's probably the best you can do. Be aware that any outputs on that rung will turn OFF when you disable the rung.
 
If you don't want the logic executed AT ALL, even as an OFF rung - any outputs totally unaffected - then use a JMP before to a Lable after the rung.
 
The old timey way was to put an XIO and XIC contact in series at the beginning of the rung. Use an unused bit address.
 
RSLogix500 doesn't have an AFI for some boneheaded reason known only to some programmers somewhere in the basement lab at Rockwell.


A very handy quick and dirty always off bit for temporary use in Logix500 is T4:0.PRE/15. A timer preset can never be negative so T4:0.PRE/15 is always false.


If this is a temporary thing and you are online then do anything that would make the rung false (AFI, off bit) or mark the rung for deletion and then TEST EDITS only. Do not assemble edits! When you test the edits the green rails for the rung will turn off. The rung is no longer being scanned but it is still in the PLC. When you are done the UNTEST EDITS and then right click the rung number and pick cancel edits to return to the unedited rung.
 
Last edited:
If the old logic is for reference only, move it to a new ladder. Make it clear in your comments that the ladder is not to be called elsewhere in the program. You might go so far as to create a rung with an AFI and JSR to the new ladder.
 
The old timey way was to put an XIO and XIC contact in series at the beginning of the rung. Use an unused bit address.

This is how I disable a rung or branch in a SLC/Micro...Note that this may not be the same as commenting it out since it will execute false...I may pick any bit that already exists on the rung, like the "Auto Mode" bit.

But, it is pretty obvious to anyone who sees it that, "well, this rung can't ever go true".

Especially when the rung comment says "This rung has been disabled because....."

I only do that if the rung is going to be needed again, or needs to be left behind as some sort of a reference. It is much better than leaving forces or edits in test mode when waiting for parts or downtime to finish a mod./repair.
 
Last edited:

Similar Topics

Hi, Is there anyway of inserting comments into the ladder diagram other then inserting one comment per "instruction" or output. I wan't to add...
Replies
3
Views
1,996
Hi Has anyone a good workaroung when we want to comment a rung with no "box" instruction. It seems that I can only write comments in the ladder on...
Replies
0
Views
1,340
Running SoMachine v4.3 and writing a small program in SFC. I am stalling on how to comment my logic. I haven't been able to find a way to add...
Replies
1
Views
1,558
Hey everyone, I'm writing a program in TIA Portal V13. I have an array of a UDT I've made with 500 members. I'm finding I am unable to put...
Replies
8
Views
3,043
Hey, I was wondering if it is possible to comment indirect memory areas somehow in GX works 2. I have profibus communication in my system...
Replies
1
Views
3,945
Back
Top Bottom