![a single rung of a ladder logic program is arranged with a single rung of a ladder logic program is arranged with](https://www.coursehero.com/thumb/77/3e/773ee74ff3879cd1821a25a2d4c3f139243bae26_180.jpg)
- A SINGLE RUNG OF A LADDER LOGIC PROGRAM IS ARRANGED WITH CODE
- A SINGLE RUNG OF A LADDER LOGIC PROGRAM IS ARRANGED WITH SERIES
For four different outputs, the single rung takes up 29 instruction words while the easier to read four rung version takes up 32 words. More importantly: The memory impact for easier reading is not bad.
A SINGLE RUNG OF A LADDER LOGIC PROGRAM IS ARRANGED WITH CODE
However, if there are twenty "cases" then the single rung code would be difficult to display or print. In this trivial example, either is readily understandable. SOR XIC A XIC B1 OTE C1 EOR SOR XIC A XIC B2 OTE C2 EOR SOR XIC A XIC B3 OTE C3 EOR SOR XIC A XIC B4 OTE C4 EOR
![a single rung of a ladder logic program is arranged with a single rung of a ladder logic program is arranged with](https://media.cheggcdn.com/media/ecb/ecbcbeb7-fee6-4c1d-8252-98e582204318/phpSvnVNF.png)
Now, here is a relaxed set of four rungs, doing the same thing: SOR XIC A BST XIC B1 OTE C1 NXB XIC B2 OTE C2 NXB XIC B3 OTE C3 NXB XIC B4 OTE C4 BND EOR SOR XIC A EOR
![a single rung of a ladder logic program is arranged with a single rung of a ladder logic program is arranged with](https://blog.jonasneubert.com/assets/2019/2019-10-29-ladder-logic-screenshot-productivity.png)
Given A, they want to make a selection of one of many choices, and they put all of the possibilities into conditions on a single rung, when it might be easier to read (and not take up much more memory) if coded as multiple rungs.įor an example, here is a relaxed RSLogix500 rung that chooses four different outputs (C1, C2, C3, C4) based upon values of B1, B2, B3, and B4, given that A is true: His logic marches proudly across the screen at the font size he's comfortable with, while it's convoluted and requires a lot of scrolling at a zoom level I can actually read! Younger coders may also be driven toward the type of structure you describe because they are trying to implement a CASE statement that, like indentation, remains foreign to ladder logic. One of my brilliant younger clients uses a 1280x1024 screen and a font size that uses about three pixels per character. However, like many of us with "over 20 years" doing this stuff, you may also be having a problem with your personal preferences on those convenient Zoom In and Zoom Out buttons on the RSLogix toolbar. If you can't see the entire code at once for a particular function, it's difficult to understand, even for the coder after a little time has passed. I encourage my clients to write their theory of operation in conversational English, and code ladder logic so that the words complement the logic, and make great rung comments. PLC2 logic was simple, turns out it was not simple to read 2000 simple rungs in a simple one program arrangement and keep track of what was going on. If the branching threatens to continue beyond what can be seen on the screen (without scrolling), break up the topic (after all I want to make visualizing easier - not harder).Įinstein said something to the effect that things should be simple - but not too simple. Then use braches to continue the idea or topic.
A SINGLE RUNG OF A LADDER LOGIC PROGRAM IS ARRANGED WITH SERIES
Here are Hugo's "rules" for parenthetic use of branch instructions: Combine output instructions that belong together on a single rung in series (on the processors I use you can put multiple output instructions in series) until just before the rung begins to wrap around.
![a single rung of a ladder logic program is arranged with a single rung of a ladder logic program is arranged with](https://blog.jonasneubert.com/assets/2019/2019-10-29-ladder-logic-slide-terminology.png)
When troubleshooting, analyzing, re-evaluating, expanding or improving an existing ladder logic I find myself constantly looking for what belongs together (I know I do - with program I or others wrote yesterday or 20 years ago), or where something I want to add in belongs. A series of "simple rungs" contain no visual clue as to their belonging together, you (the human observer) have to read each rung and process the information to see if it continues the ideas contained in the previous rung (if you include a rung comment you have to read even more). I will defend branching (when used as kind of parenthesis rather than out of logic necessity) as a more readable programming style for ladder logic, rather than the "simple" in out rung style. If "the logic works but it is hard to follow" in the view of the intended audience, then the program was not well written. I believe that Nicolas Wirth (creator of Pascal) once said something to the effect that a programing language should be judged by how well it conveys information to a human. Again, however, I find it difficult to imagine where more than 2 or 3 outputs could be so closely related.Ī rung of logic should express a single, simple, idea or expression. Sometimes several outputs are grouped together on a rung because it is important they they do not become separated from one another due to new rungs being inserted between them later. This might be justifiable if this were a simple case of resetting 20 flags together, but that doesn't appear to be what you have described. However, I find it difficult to believe that 20 typical outputs could be so closely related to one another that they all form one "function". Either method may be suitable, depending upon the application.