Ladder Logic 205: System Routine 1

System1

This is a continuation of the series on PLC ladder logic. It is meant to be a mid-level tutorial for people who have some familiarity with programming in ladder logic, but want to start the next phase of writing their own programs. So far I have covered Inputs, Outputs, Faults and Auto Sequences. I also posted some general organizational tips last year as “Ladder Logic 101, Where Do I Start?” and “Ladder Logic 102: Organization”. These gave a general overview of how a program is concepted and organized but really didn’t get into any programming examples. For now I am going to leave the basics of what contacts, devices and coils do up to many of the other sites and training books you can find online. I will be posting a true 100 level description of how the individual items work on the ladder rungs at a later time, but for now this tutorial assumes that you know the basics of ladder logic.

6.8_CodeOrg For this series I have been using the organization chart shown at the left. The last 201-204 level posts have illustrated what kind of code might be found in the b_Inputs, c_Outputs, d_AutoSequence and e_Faults subroutines along with the reasons for organizing a program this way. There are no hard and fast rules for arranging a program, this is just an example of how a lot of programmers go about making their programs more organized and readable. This posts concerns the contents of the a_System subroutine. This routine generally contains things like mode control, cycle start and stop and overall system housekeeping. The logic example at the top of this post shows how auto and manual modes might be set up. In this example machine operators are prevented from changing modes if the system is faulted or entering manual mode if the machine is auto cycling. The machine is also placed in manual mode upon a home request. The Auto Cycle command allows starting of the auto cycle when in auto mode if no faults are present and stopping of the cycle only when the auto sequence (from last week) has not been started.

In the auto sequence topic a couple of weeks ago you will note that the sequence would only step if the machine was auto cycling. If a fault were to occur, this would ensure that the machine would hold its present state. Other things you might see in this example might be only allowing cycle start when the machine is at home or origin position, a three second hold-down requirement for the cycle start pushbutton (during which a horn might sound), or any number of special requirements as defined by a customer. Other items such as an immediate stop button (allowing stooping of the machine even if in auto cycle) or a memory bit for cycle stop (allowing the cycle to complete without having to press the button again) are common.
A note on the format of the last rung: notice that the first two rungs use latch or “set” bits for auto and manual mode. The last auto cycle rung is also latched by means of a “hold-in” contact, the parallel autocycle bit with the same address as the coil. This is a common technique used in PLC ladder programming and is really just a matter of preference. I use both types, latching and hold-in contacts, depending on the application.
I have titled this post System Routine 1 because there are a lot of other topics that can be covered in the a_System routine, I may wish to discuss these later. If there are other things you would like to discuss in ladder logic programming please leave a comment!

Share
Tagged with: ,
Posted in Software & Programming
2 comments on “Ladder Logic 205: System Routine 1
  1. Hello, I have been reading all of your posts here and really like all the information. One question I have is how do you actually get the information down on paper and start designing the code. I have done this many times as an integrator but I also always get stuck here and end up redoing the layout and code ten times. I guess I’m curious as to how to design the system layout right the first time and how to organize and get all pertinent information. I don’t have any trouble writing code as I am fluent in ladder, st, c#, swift, fb and so on. It’s always the layout and design that slow me down. Thanks

    • Frank says:

      Hi Dustin, your question is actually somewhat related to today’s post. I mentioned that though there are over 300 pages of information on this site, it can be pretty hard to find things.

      There are a lot of articles under the PLC tab at the top of this page related to how to get started, in particular the first few articles in the Ladder Logic 100 series. Also check out some of the PLC/Other articles and the stories under the Applications tab.

      I am also pretty open to creating posts based on suggestions, so if there is a specific question on some part of the design process let me know. Thanks for asking!

Leave a Reply to Frank Cancel reply

Your email address will not be published. Required fields are marked *

*

Categories
Are You the Master of Your Automated Machinery?

Subscribe to Automation Primer!