Ladder Logic Examples and PLC Programming Examples

I will start this article by making a confession:

When I develop a PLC program, I steal other people’s ladder logic.

I am stealing ladder logic examples for inspiration and solutions to my PLC programs.

From time to time you will be facing the same problem, when you do PLC programming with ladder logic. By looking at examples of ladder logic programs, you will be able to find a solution to your problem very fast. You may even find a smarter solution in the ladder logic examples than your own solution.

There are several reasons to use examples of PLC ladder logic. You can skip those and go straight to the PLC program examples:

Ladder Logic Examples and PLC Program Examples ⇓.

Why Use PLC Ladder Logic Examples?

The reason I use ladder logic examples is one of the big advantages of code. In this case the PLC programming language ladder logic. You can reuse chunks of a PLC program in your own PLC program. In fact reusable code is widely used and many automation projects are build on the ISA-88 or S88 batch control standard which encourages reusable function blocks. Reusing code can also have advantages when you’re integrating a SCADA system.

You can “copy and paste” lines of ladder logic symbols from one PLC program to another PLC program. By doing so, you will shorten the development time of a project. So that you don’t have to invent everything from the very bottom each time you are developing a new PLC program. That is why I often make use of PLC program examples.

I wrote another article where I included examples of PLC analog input and output programming. If you want to learn ladder logic from the beginning, you should check out my ladder logic tutorial or maybe even start learning from an online PLC training course.

If you are new to ladder logic, check out these short video tutorials to learn about the basic instructions:

and this one to learn how to build logic gates:

Learn from PLC Programming Examples

Another reason to make use of ladder logic examples is, that you can learn from them. Let’s say you have a specific functionality, you want to implement in your ladder logic, a PLC timer function for example. The first thing you naturally would do, is to think about it for yourself. Try to design the ladder logic by yourself.

But even though you come to a solution, there might be a smarter way to make that piece of ladder logic. When you look at a ladder logic example it may look different from your ladder logic. This is due to the fact that every function you want to implement in your PLC program, there are many different solutions.

However, finding clear ladder logic examples can be challenging. Their names might be confusing or misleading, and their strategies can greatly vary—for instance, in traffic light controls. Additionally, ladder logic is often specific to particular PLC brands, so you might need to download different programming software to view and understand each example.

Another brand specific issue is the names for the instructions and functions. For example in the Siemens S7-1200 and other PLC’s from Siemens the latching function is referred to as the set/reset function. While that function, in Allen Bradley PLCs, are the called latch/unlatch function. You can start exploring the latch/unlatch function already now with RSLogix Micro Starter Lite from Allen Bradley.

Learn PLC programming from scratch

Learn ladder logic PLC programming with Udemy

Collecting the Best PLC Programming Examples

For those reasons I have made this collection of PLC ladder logic examples. I have divided all the ladder examples into categories, so you can find them with ease. The first examples are general ladder logic examples. These examples can be used in almost every ladder logic PLC program.

If you need a simple function implemented in your ladder logic, you can use the general examples. General ladder logic examples can almost always be copied into your own ladder diagrams. The only thing you need to edit, is the names and the symbols for the bit logic instructions.

At last you will find real-world PLC ladder logic examples. This is a collection of PLC programs from the real-world, where simulations, videos or photos are a part of the example. Real-world PLC examples from a factory or a traffic light can be very useful, when you are searching for inspiration. These examples can rarely be copied to fit your own project, but you can use chunks and ideas from the real-world examples.

Do you have your own PLC ladder logic examples, even better than these?

Feel free to contact me.

I will gladly put your PLC ladder logic example on this site. In that way, we can all benefit from this list of the best examples of PLC ladder logic.

Ladder Logic Examples and Example PLC Programs

Click on the type of PLC program example you want to see, or scroll down to see the all:

Simple Ladder Logic Program Examples

Ladder diagram examples and solutions to simple PLC logic functions. These are all basic PLC functions implemented in ladder logic. 

Simple Start/Stop Ladder Logic Relay

This is how the ladder diagram looks for a simple start/stop function. The function can be used to start and stop anything like a motor start/stop.

In this ladder logic example, there are two inputs.

  1. “Start button” or PLC input I0.0.
  2. “Stop button” or PLC input I0.1.

The start button will activate the relay, or ladder logic relay M10.0. When the start button is released, the relay will still be activated, because of the latch in ladder rung 2. This latching will be broken when the stop button is activated.

You might wonder why the stop button in this example is normally open. And the reason for that, is that you should use normally closed as stop button, to avoid dangerous situations under failure.

Here is what the PLC program example looks like:

start stop ladder logic example

Simple ladder logic examples of start/stop of relay.

Single Push Button On/Off Ladder Logic

This function is also called push on push off logic sometimes even flip-flop or toggle function. It is the same function as the on/off button on your computer or mobile phone. When you push the button the first time, the output will be activated. Now, when you push the button for the second time, the output will deactivate and turn off. The single push button has two functions: on and off.

Push on push off logic can be done in several ways. It can be done by using ladder logic and boolean logic instructions or it can be done with a counter. It can even be done with PLC rising edge and falling edge triggers or with shift registers.

Here is the example using boolean logic instructions only (complicated version):

Single Push Button On/Off Ladder Logic Example

Single push button ON/OFF ladder logic example. Also known as “push to on, push to off” logic function.

This example is from the PLC, Scada, DCS blog. The blog has a lot of very useful information about PLC programming and especially ladder logic. Take a look at the blog and see the many ladder logic examples.

But… there is a faster way to make the same toggle function with a single push button:

The example is from Mayur Haldankar’s blog about PLC programming and DSP (digital signal processing). He even has examples of DSP programs written in C++.

In his example, he uses 3 (4) rungs only to make the toggle function of a push button (simple version):

Ladder logic example with toggle or flip-flop function

Ladder toggle or flip-flop function (single push button on/off).

Ladder Logic Examples with Timers

PLC program examples with timers in ladder logic.

Generally speaking, you have three types of PLC timers available in ladder logic. The on-delay timer, the off-delay timer and the retentive timer or pulse timer.

PLC Program Example with On Delay Timer

The first type of timer in ladder logic is the on delay timer. Its name comes from the fact, that the on delay timer delays its output from the on signal.

As soon as the on delay timer gets a signal at the input, the timer starts to count down. When the preset time is up, the output of the on delay timer will turn on. If the input is turned off before the count down finish, the time will reset.

On delay timers in ladder logic can look different depending on the PLC programming software. But common for all of them are the following:

  • Input
  • Enable Output (EN)
  • Done Output (DN)
  • Preset Time Value

The enable output (EN) is the first output and it is on when the timer is energized. So, as long as the input is true or on, the enable output will be true.

Second output is the done output (DN). This output in an on delay timer is only on, when the timer has counted down the preset time.

Look at this great video for more info about the on delay timer. The software used is the free RSLogic Micro Starter Lite from Allen Bradley.

You can also check out my own video about the on delay timer:

PLC Program Example with Off Delay Timer

The off delay timer works just like the on delay timer with one exception.

Instead of starting the count down from the signal at the input turns on, the off delay timer starts to count down from the signal turning off at the input signal.

The example below is from Sakshat Virtual Labs. In the example, ladder logic is used to visualize the values of the three bits in an off delay timer. These three bits are from Allen Bradley PLCs, but other brands has similar bits.

  1. Enable bit (EN) – On when the timer is energized (input is on)
  2. Done bit (DN) –  On when the timer is done counting down
  3. Timer timing bit (TT) – On when the timer is counting

Cooling Example With Off Delay Timer

Another example with the use of the off delay timer in ladder logic is in heating. When you are heating something, you often have some sort of cooling too. A good example of that is a heating oven. The oven is heated by an electrical heater, and in the side there are ventilation motors to cool the oven after use.

Here is a simplification of how the cooling PLC program should work:

    Heating element and cooling fans turn on.
    Heating element off and off delay timer starts counting down.
    Cooling fans turn off.

The electrical heater and the cooling fans should turn on simultaneously. Why the cooling fans has to turn on too, is to circulate the hot air and spread the heat.

Since both the fans and the heater has to start at the same time, the two outputs should work simultaneously. But keep in mind, that the cooling fans has to run for some time, after the heater is turned off.

This is the exact function of an off delay timer, and the ladder logic example looks like this:

Example of motors with cooling in ladder logic

Example of motors with cooling in ladder logic. Off delay timer for extra delay.

At last, don’t forget to check out my own video about the off delay timer:

PLC Program Example with Retentive Timer

Retentive timers are just like on delay and off delay timers, but with one crucial exception.

The time only pauses if the input is turned off before the count down is finished. When the input is turned on again, the timer continues counting down from where the time was paused.

The word retentive even means to retain, and that is what retentive timers do. They retain the time they have counted when the input is off.

If you’re still not sure, check out this video of a functioning retentive timer in ladder logic:

KronoTech has published a very informative PLC program example. With the use of a retentive timer to control a motor with an automatic lubrication system, they have made a great practical example.

Ladder logic program for automatc lubrication

More About Timers In PLC Programming Examples

Feel free to watch this video for more information about PLC timers in ladder logic. The video illustrates some great examples and the basics of PLC timers. The PLC programming software used is RSLogix 500.

Finally I will encourage you to take a look at my video about the pulse timer. The pulse timer is used for generating pulses of a specific length and is very useful in ladder logic:

Ladder Diagram for Motor Control

Motor control can be done with a PLC program. In fact, the PLC is a common choice for controlling AC motors. Here are some examples of ladder diagrams for motor control.

Star Delta PLC Ladder Diagram

One of the most common ways to start an AC motor is by first starting the motor in star connection. When the motor speed is sufficient, the connection is switched to delta. This is due to the high current AC motors use when starting.

Star/delta motor control can be done in several ways. To switch between the star and the delta relay, a timer is used. The ladder logic for a star/delta motor control is quite simple, and that is one of the advantages of using a PLC for motor control.

Ladder diagram of star/delta starter with a Mitsubishi PLC

Another great example of how to use a PLC for star/delta start of an AC motor is example #5 in the PDF file below. It includes a lot explination and a lot of great power and control circuit diagrams. Example #5 is on page 30.

Star/delta start PLC example (PDF)

Ladder Diagram for DOL Direct On Line Motor Starter

Still commonly used in many factories the DOL or direct on line motor starter is another way of starting AC motors. The DOL is made of a contactor (usually 3-phase contactor), an overload relay like the thermal relay, and some connections in between.

Controlling the DOL motor starter with a PLC program is simple. This video below shows an example of how to control a DOL with a PLC program. In the example the PLC Zelio from Schneider Electric is used.

You can use any PLC that handles digital inputs and outputs, including compact models like the Siemens S7-200 or S7-1200. There might be occasions where a smaller relay is needed between the PLC output and the contactor’s coil. Always ensure to verify the PLC output ratings to maintain system integrity.

PLC Program Examples From The Real World

These next PLC programs are examples of real-world PLC applications. All examples of how to use PLC programming and ladder logic to solve real problems.

Traffic Light Ladder Logic Diagram

One of the most used applications for a PLC is the traffic lights. At many schools, universities and even companies you will get the challenge to make a traffic light ladder logic diagram.

The traffic light PLC program is a combination of timers to control which lights are turned on and for how long time. But some sort of interlock must be there to prevent the green light to be on in multiple directions.

A PLC program like the traffic light is a little more complicated and therefore are a lot more solutions to. For inspiration you can look at these good examples of traffic light ladder diagrams:

The first ladder logic example is from Engineer On A Disk, which is a marvelous site full of great articles. In the example you will get all the ladder diagrams and step-by-step instructions and explanation.

PLC program example of a traffic light

If you are using LogixPro Simulator, then you should absolutely take a look at this great example video:

Ladder Diagram for Bottle Filling Plant

Detailed example from Electrical Engineering Portal. This is a great example because of all the explanation it gives. You will be introduced to the actuators (motors), sensors and switches and a step-by-step guide to how to make the PLC program. At last you will see the example ladder logic for the bottle filling application.

Before you check out this application, be sure to include counters in your program. For a bottle filling plant, it is very important to keep track of how many bottles that went through the system. For this you can use the PLC counter instructions. Here’s a video about how they work:

PLC implementation of bottle filling application

If you are using LogixPro Simulator from Allen Bradley, then you can learn a lot from this example video:

PLC Ladder Diagram for Elevator Control

Elevators are often controlled by a PLC or a similar controller (sometimes even relay controllers). In fact a PLC program is a great way to make an elevator control. But before you start looking at ladder diagrams and PLC program examples for elevator control, some safety issues are important to know about. You might want to incorporate a safety relay in the system.

Here are the things you need to know before you start to build a PLC elevator control:

  • Mechanical safety
    No elevator control without mechanical parts. All these parts has to be tested and verified to make sure that they will last.
  • Electrical safety
    Be sure to follow the rules and regulations for electrical safety. They differ a bit depending on whether you are in the US, Europe, Asia or anywhere in the World. This includes proper grounding, using the right circuit breakers, wire gauges and so on.
  • PLC elevator program safety
    The last but not least part is the PLC elevator program. In the elevator examples you will be looking at, there will be a lot of interlocks, to prevent some functions to run at the same time. This is a highly critical point. For example, you don’t want to elevator to run before the doors are closed!

This is a great introduction to how the elevator control system works:

Elevator Control System: How they work

And here is an example of a ladder diagram for elevator control from circuit4hobby:

Elevator PLC program (PDF)

Did these example PLC programs help you?

Rate this article below or write a comment if you found this article helpful or you have any questions.

If you would like to share your ladder logic examples, please write a comment below or send me a message. You can also find us on Facebook.

Leave a response
  • Tom Opoku
    August 5, 2015 at 10:21 am

    Pls send more stuff on PLC project examples

  • nalin
    August 7, 2015 at 10:00 am

    how to write a overlap programme.. i mean ,there are two programmes in plc,but its run separately…

  • Akshay
    September 3, 2015 at 2:22 pm

    how to make ladder logic from flow chart??

  • October 6, 2015 at 11:20 am

    hello everyone,i am a first year student at CPUT doing electrical engineering,we have been given a project about on/off controller using PLC,my problem i never used PLC before and i don’t even know how they work,,,,can someone plz explain to me how does it work?

    • Dwayne S
      November 27, 2016 at 5:17 pm

      I been using Plcs for over 20 yrs.. Once you know it its very easy. I still watch all videos on youtube.
      Type in good place to start.

      • umair
        March 26, 2019 at 4:37 pm

        what is best way to learn the plc ladder logic and how can i train my self to advance level.
        I have been looking for example and videos or notes for using all those symbol in ladder logic and how can i use the in future for my programming. can you help me out in this please.
        i have created one way traffic signal with pedestrian crossing wait so far by using TOn.

  • tayceer
    October 14, 2015 at 4:03 pm

    i want to learn about delta plc

  • jossi
    November 20, 2015 at 10:27 am

    hi guys…whr can I get a plc software for a laptop…without necessarily buying online

    • Tushar Chavan
      September 7, 2016 at 10:10 am

      you have one choice download delta plc software its free. and then practice on it . this the only softwtwar eits free on web site. and it easy to learn. if u have want any plc program. mail i can make program. mail me your details. i will teach you how to learn.

  • krp
    November 20, 2015 at 10:38 am

    single push button controls output on/off

  • November 20, 2015 at 1:34 pm

    Would like to attatend lessons on ladder logics and plcs.

  • JEET
    November 22, 2015 at 10:56 am

    i need digital watch ladder diagram.

  • G.N.S.
    November 23, 2015 at 8:53 am

    How i’m build water level indication logic. give me idea for ladder program.

  • pavan
    November 25, 2015 at 9:37 pm

    ladder diagram for 3motors & 3timers

    • Khalid Morales
      January 3, 2016 at 4:08 pm

      How to make a ladder diagram for oil and gas tank level? Using P&ID controller, AUTOMATICALLY.

  • Rajeev Kirar
    December 31, 2015 at 6:40 pm

    I want to need more examples of omron plc & Twido & Delta

  • kirose
    January 4, 2016 at 11:39 am

    what types of sensor you used in lighting system

  • kirose
    January 13, 2016 at 12:17 pm

    principle aperation of lighting of using plc

  • Sam
    January 18, 2016 at 3:25 pm

    Hey guys… I have to program the “Batching Process” on ITS PLC,using Automgen, but i find it to be very complicated…
    Can anyone help me,please?
    All the best!

  • aranganathan
    January 21, 2016 at 5:10 pm

    is there a software to draw plc ladder diagrams??

  • fatemeh
    February 19, 2016 at 4:03 pm

    when I run S7 pro I need to test my program ,PLC simulation on/off button is disabled.
    How to enable this button in manager?

  • Shailesh Mishra
    March 1, 2016 at 4:12 am

    Design PLC program of One coil on/off by one push button..

  • Nasiem Amer
    March 3, 2016 at 6:24 am

    Thanks for these examples and we hope more specially for automation in industrial process

  • sushil
    April 28, 2016 at 5:12 am

    thank you for giving example of plc programming . i need more example plz send my e-mail id.

  • jyoti parkhe
    May 4, 2016 at 9:26 am

    i want ladder ladder prgm to count 0-100 & 100-0 up-down counter using single push button . & its continuous operation.

  • Allen Dubberly
    June 21, 2016 at 1:01 am

    Awesome!!! Thank you so much for this. You should start a account and let people buy you a cup of coffee or donate to the cause!

  • muhammad khan
    June 21, 2016 at 11:17 am

    it is a good site abuot plc training,

    June 25, 2016 at 3:08 am

    thank you for giving example of plc programming . i need more example plz send my e-mail id.

  • rajivgandhi
    September 8, 2016 at 6:41 am

    Thank you for giving example of plc programming . i need more example please send my e-mail id.

  • Richie
    September 13, 2016 at 12:45 am

    I’m looking for anything dealing with studio 5000 and servo motor drive interface. We use Parker drives. I have to coordinate a sequence of motors to flow at one speed with the ability to draft.

  • selva ganabathi
    September 15, 2016 at 6:05 am

    hi i need a V/F open loop control on plc ladder logic program please send a model of plc on my mail id

  • rushikesh
    September 19, 2016 at 9:14 am

    write a program to find frequency of given signal (analog)
    this question was given by my teacher and Im curious to know about ladder program
    It would be very helpful if you can guide me in this

  • The Keyboard Cowboy
    December 1, 2016 at 10:19 pm

    There is a huge programming error.

    Single Push Button On/Off Ladder Logic
    “Here is the example using boolean logic instructions only (complicated version):”

    under this complicated version, Extend M0.1 and M0.2 on rungs 4,7 past the Push Button….

    “Rung 4 Edit.”

    | M0.0 I0.0 M0.2 M0.1 |
    |—| |——|/|–+—-|/|—————————( )—|
    | M0.1 | |
    |—| |———-+ |

    Then do the same for rung 7….

    It will not latch right and the second Press will never activate.

    -The keyboard cowboy.

  • The Keyboard Cowboy
    December 1, 2016 at 10:34 pm

    Well the post removed my spaces, in the last post. UGH…
    Copy and paste this into notepad, Then Replace * with a single space for the edit….


  • Parveen
    December 6, 2016 at 9:16 am

    I want to know about rise/fall edge trigger switch working

  • Claudiu Adascalitei
    December 12, 2016 at 10:37 am

    My name is Mr. Claudiu Adascalitei, and i’m a student of University from Sibiu city, Romania. So, I want to help me with a project for school. It’s about a ladder diagram programming. Can you help me, please. I send my adress e-mail to contact: [email protected].

    Thank you,

  • alem
    December 23, 2016 at 6:19 am

    it is rely good for bigginer

  • Sumon Ahmed
    December 28, 2016 at 3:09 am

    Hi I am new for PLC,,I start learning from today of PLC ladder programming..I hope it will help me like a near teacher….

  • Emmanuel Koomson
    January 6, 2017 at 1:58 pm

    It’s so simple and easily to understand the stuff,but need some more diagram to practice in order to master the process

  • Matt Edwards
    February 16, 2017 at 5:49 pm

    I am having a hard time trying to figure out a simple logic issue. Can you please draw me or explain the logic for:
    SW1 turns on a green pilot light.
    SW2 turns on a red pilot light.
    When both SW1 and SW2 are pushed, a white pilot light only comes on.

  • Umesh more
    March 21, 2017 at 10:56 am

    I want a plc program for magnet cranes

  • M.koteswar
    March 25, 2017 at 5:10 pm

    guys does anybody know about textile industry ladder logic and how they work??

  • tryfom
    March 25, 2017 at 9:16 pm

    i need to write code for in ladder for a task with a conveyor with three color sencor and tree bin so when a bin is full the conveyor is stop the first color sensor is alone and it is at begin the second two is next to it and below them are the bin in the end of the conveyor are the red bin . we put object on the conveyor one each time . is anyone can help in ladder (brandley )

  • temesgen shibru
    May 15, 2018 at 6:03 pm

    i dont now how to draw a ladder logic diagram for diffrent instructions please help me

  • Vishal golakiya
    May 16, 2018 at 11:12 am

    I am going to make a traffic light control using ladder logic.
    I don’t know from where should I start.?
    Can u plz help me

  • Ahmed Eisa
    July 30, 2018 at 7:33 am

    “You might wonder why the stop button in this example is normally open. And the reason for that is that you should use normally closed as a stop button, to avoid dangerous situations under failure.”

    Your first example shows the stop button as NO, and you recommend using NC as a stop button. The sentence above contradicts itself?

  • September 27, 2018 at 12:53 pm

    Great article. Starting with ladder logic is the foundation of understanding any kind of PLC program. Here’s another great resource for four steps to writing a PLC program–%20PLC-Program-in-4-Simple-Steps

  • Josheno
    October 17, 2018 at 8:12 pm

    I have an issue here.. I have this power station, that runs 4 generators synchronised together.. One serves as an emergency genset.

    Now, when powered, it comes up, but when you now on the breaker to supply the load on the ladder logic, it shows that it’s on, but the load won’t really come on, until I go to the genset and manually turn on the breaker that’s only when the load will receive power..

    Can someone help me in troubleshooting this scenario..

    It’s a Siemens S7-213 PLC

  • February 24, 2019 at 2:15 am

    Nice article for newbie

  • March 9, 2019 at 7:50 am

    Thanks for the brief information about plc

  • March 13, 2019 at 4:27 pm

    Really good article.
    Good structured and well explained!

  • Monish K Mohandas
    April 3, 2019 at 6:12 pm

    Can you please help me for doing Ladder logic of weighing scale?
    Kindly share details.

  • Maruthi
    June 6, 2019 at 12:15 am

    Most valuable information regarding Ladder logic examples. Thank-you so much . Great Job. keep it up.

  • elenka
    November 19, 2019 at 8:34 am

    There is a much simpler solution to the ON/OFF single button problem:
    Q’ = Button AND NOT State OR NOT Button OR Q
    State’ = NOT Button AND Q OR Button AND State

Leave a Response