Ladder Logic Examples and PLC Programming Examples

Here is how I often begin a PLC programming project:
When I develop a PLC program, I steal other people’s ladder logic.
I use other people’s ladder logic examples to find ideas and solutions for my PLC programs.
When programming a PLC with ladder logic, you will sometimes encounter a problem you have solved before. Looking through ladder logic program examples can help you find a solution quickly. An example may even suggest a better approach than the one you first had in mind.
There are several reasons to use examples of PLC ladder logic. You can skip those and go straight to the PLC program examples:
Why Use PLC Ladder Logic Examples?
I use ladder logic examples because code can be reused. Parts of one PLC program can become part of your own ladder logic program. Reusable code is common in automation, with many projects built 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 between PLC programs to shorten development time. Reusing existing work saves you from building everything from the beginning whenever you develop a new program. This is why I often turn to PLC program examples.
Another article I wrote includes examples of PLC analog input and output programming. To learn ladder logic from the beginning, read my ladder logic tutorial or maybe even start learning from an online PLC training course.
These short video tutorials introduce the basic instructions if you are new to ladder logic:
This video then shows how to build logic gates:
Learn from PLC Programming Examples
You can also learn from ladder logic examples. Suppose you want to add a specific function to your ladder logic, such as a PLC timer function function. Start by thinking through the problem and designing the ladder logic yourself.
After finding a solution, you may discover a better way to implement it. A ladder logic example may differ from your own program because each function can have several possible solutions.
Clear ladder logic examples can be hard to find. Names may be confusing or misleading, and approaches can differ considerably, as traffic light controls show. Examples are also often specific to a PLC brand. You may need to download different programming software to open and understand them.
Instruction and function names also differ between brands. For example, in the Siemens S7-1200 and other Siemens PLCs, the latching function is called set/reset. Allen Bradley PLCs call it latch/unlatch. To explore latch/unlatch now, try RSLogix Micro Starter Lite from Allen Bradley.
Collecting the Best PLC Programming Examples
These are the reasons behind this collection of PLC ladder logic examples. Categories make the examples easier to find. The collection starts with general ladder logic functions that you can use in almost any ladder logic PLC program.
Use the general examples when you need a simple ladder logic function. You can almost always copy these examples into your own ladder diagrams, changing only the names and symbols for the bit logic instructions.
The final section collects PLC programs from real applications, with simulations, videos or photos to explain them. Factory and traffic light examples can help you find ideas. Although they rarely fit your project well enough to copy in full, you can reuse parts of the logic and the ideas behind it.
Do you have your own PLC ladder logic examples, even better than these?
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
Choose a PLC program example from the list, or scroll down to view them 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
The ladder diagram below shows a simple start/stop function. You can use this function to start and stop equipment such as a motor.
This ladder logic example uses two inputs.
- “Start button” or PLC input I0.0.
- “Stop button” or PLC input I0.1.
Pressing start activates the ladder logic relay M10.0. The latch in ladder rung 2 keeps the relay active after you release start. Activating the stop button breaks that latch.
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.
The PLC program example is shown below:
Single Push Button On/Off Ladder Logic
Known as push on push off logic, this function is also called a flip-flop or toggle function. It works like the on/off button on a computer or mobile phone. Pressing it once activates the output; pressing it again turns the output off. A single push button therefore controls both on and off.
There are several ways to implement push on push off logic. You can use ladder logic with boolean instructions, or use a counter. PLC rising edge and falling edge triggers are other options, as are shift registers.
This more complicated example uses only boolean logic instructions:

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 covers PLC programming, particularly ladder logic. Browse it for more ladder logic examples and explanations.
You can create the same single push button toggle function in a faster way:
The example is from Mayur Haldankar’s blog about PLC programming and DSP (digital signal processing). His blog also includes DSP program examples written in C++.
His simpler push button toggle example uses only 3 (4) rungs:
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
Start with the on delay timer, which delays its output after receiving an on signal. That delay gives the timer its name.
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.
The appearance of an on delay timer varies with the PLC programming software. All have the following in common:
- Input
- Enable Output (EN)
- Done Output (DN)
- Preset Time Value
The first output, enable (EN), turns on when the timer is energised. It stays true while the input remains true or on.
The second output is done (DN). On an on delay timer, it turns on only after the timer has counted down the preset time.
Watch this video for more on the on delay timer. It uses the free RSLogic Micro Starter Lite from Allen Bradley.
My own on delay timer video is another way to see it in use:
PLC Program Example with Off Delay Timer
An off delay timer works like an on delay timer except for when it starts counting.
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. The ladder logic example shows the values of the three bits in an off delay timer. It uses Allen Bradley PLC bits, with similar bits available in other brands.
- Enable bit (EN) – On when the timer is energized (input is on)
- Done bit (DN) – On when the timer is done counting down
- Timer timing bit (TT) – On when the timer is counting
Cooling Example With Off Delay Timer
Heating systems give another example of off delay timers in ladder logic. Heating often requires cooling as well. In a heating oven, an electrical heater supplies heat while ventilation motors at the side cool the oven after use.
Here is a simplification of how the cooling PLC program should work:
- HEATING ON:
Heating element and cooling fans turn on. - HEATING OFF:
Heating element off and off delay timer starts counting down. - TIMER DONE:
Cooling fans turn off.
The cooling fans turn on with the electrical heater so they can circulate hot air and spread the heat.
Both outputs must operate together to start the fans and heater at the same time. After the heater turns off, however, the cooling fans must continue running for a while.
An off delay timer performs this function, as the following ladder logic example shows:
You can also watch my own off delay timer video:
PLC Program Example with Retentive Timer
A retentive timer differs from on delay and off delay timers in how it handles an interrupted input.
If the input turns off before the countdown finishes, the timer pauses. Turning the input on again resumes the countdown from the paused time.
The word retentive even means to retain. A retentive timer keeps the time it has counted while the input is off.
Watch this working retentive timer in ladder logic to see the behaviour:
KronoTech demonstrates a practical use of a retentive timer in a PLC program. Its example controls a motor with an automatic lubrication system.
Ladder logic program for automatc lubrication
More About Timers In PLC Programming Examples
This video explains PLC timer basics through ladder logic examples. It uses RSLogix 500 as the PLC programming software.
My pulse timer video shows how to generate pulses of a specific length, a useful function 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
To address the high starting current of AC motors, one common method starts the motor in star connection. Once it reaches sufficient speed, the connection switches to delta.
There are several ways to implement star/delta motor control. A timer handles the switch between the star and delta relays. Its simple ladder logic is one reason to use a PLC for this type of motor control.
Ladder diagram of star/delta starter with a Mitsubishi PLC
For another PLC example of star/delta AC motor starting, see example #5 in the PDF below. Detailed explanations accompany its power and control circuit diagrams. You will find example #5 on page 30.
Star/delta start PLC example (PDF)
Ladder Diagram for DOL Direct On Line Motor Starter
Another way to start AC motors is the DOL, or direct on line, motor starter, still common in many factories. It combines a contactor (usually a 3-phase contactor) with an overload relay (such as a thermal relay) and the connections between them.
A PLC program can control a DOL motor starter with simple logic. The video below demonstrates this using the Zelio PLC from Schneider Electric.
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.
A traffic light PLC program combines timers to control which lights turn on and how long they remain on. An interlock must prevent green lights from turning on in multiple directions.
Traffic light programs involve more complicated logic, with many possible solutions. These traffic light ladder diagram examples can help you find ideas:
Engineer On A Disk has the first example among its many articles. It includes all the ladder diagrams, with step-by-step instructions and explanations.
PLC program example of a traffic light
If you use LogixPro Simulator, watch this example video:
Ladder Diagram for Bottle Filling Plant
Electrical Engineering Portal explains this example in detail. It introduces the actuators (motors), sensors and switches before walking you through the PLC program step by step. The example ladder logic for the bottle filling application follows the guide.
Include counters in your program when working through this application. A bottle filling plant needs to track how many bottles pass through its system. To do that, use the PLC counter instructions. The following video explains how they work:
PLC implementation of bottle filling application
This example video can help you learn if you are using LogixPro Simulator from Allen Bradley:
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.
Before building a PLC elevator control, consider the following safety requirements:
- 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 introduction explains how an elevator control system works:
Elevator Control System: How they work
For a ladder diagram example of elevator control, see circuit4hobby:
Elevator PLC program (PDF)
Did these example PLC programs help you?
If these examples helped you, rate the article below. You can also leave a comment with feedback or questions.
To share your own ladder logic examples, leave a comment below or send me a message. Find us on Facebook.










Pls send more stuff on PLC project examples
Super
Superr
how to write a overlap programme.. i mean ,there are two programmes in plc,but its run separately…
USE SELECTOR SWITCH IN OFF CONDITION PROGRAM 1 WORKING AND IN ON CONDITION PROGRAM 2 WORKING
you can use subroutine
how to make ladder logic from flow chart??
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?
I been using Plcs for over 20 yrs.. Once you know it its very easy. I still watch all videos on youtube.
Type in ladiesandtech.com good place to start.
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.
i want to learn about delta plc
hi guys…whr can I get a plc software for a laptop…without necessarily buying online
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.
hi,
can you please help me to learn how analog outputs are used in delta.
my mail id- [email protected]
thank you
Got a simmilar problem Chavan….please assist: [email protected]
Hi Tushar
Do you have a program, for a conveyor system in a distribution warehouse setting, moving boxes/totes etc.
Thank you.
awsm
single push button controls output on/off
Would like to attatend lessons on ladder logics and plcs.
i need digital watch ladder diagram.
How i’m build water level indication logic. give me idea for ladder program.
ladder diagram for 3motors & 3timers
How to make a ladder diagram for oil and gas tank level? Using P&ID controller, AUTOMATICALLY.
How to make a ladder diagram for oil and gas tank level? Using P&ID controller, AUTOMATICALLY.
I want to need more examples of omron plc & Twido & Delta
what types of sensor you used in lighting system
principle aperation of lighting of using plc
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!
is there a software to draw plc ladder diagrams??
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?
Design PLC program of One coil on/off by one push button..
Pls use toggle switch
Thanks for these examples and we hope more specially for automation in industrial process
thank you for giving example of plc programming . i need more example plz send my e-mail id.
i want ladder ladder prgm to count 0-100 & 100-0 up-down counter using single push button . & its continuous operation.
Awesome!!! Thank you so much for this. You should start a paypal.me/yourname account and let people buy you a cup of coffee or donate to the cause!
it is a good site abuot plc training,
thank you for giving example of plc programming . i need more example plz send my e-mail id.
Thank you for giving example of plc programming . i need more example please send my e-mail id.
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.
hi i need a V/F open loop control on plc ladder logic program please send a model of plc on my mail id
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
ERROR!!!!!!
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.
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….
|***M0.0****I0.0*******M0.2**************************M0.1**|
|—|*|——|/|–+—-|/|—————————(*)—|
|***M0.1**********|****************************************|
|—|*|———–+****************************************|
|***M0.0*********************************************Q0.0**|
|—|*|———————————————-(*)—|
|***M0.1****I0.0*******M0.3**************************M0.1**|
|—|*|——|/|–+—-|/|—————————(*)—|
|***M0.2**********|****************************************|
|—|*|———–+****************************************|
I want to know about rise/fall edge trigger switch working
Hi,
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,
Claudiu
it is rely good for bigginer
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….
good
It’s so simple and easily to understand the stuff,but need some more diagram to practice in order to master the process
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.
S1 AND NOT S2 = GREEN LIGHT
S2 AND NOT S1 = RED LIGHT
S1 AND S2 = WHITE LIGHT
I want a plc program for magnet cranes
guys does anybody know about textile industry ladder logic and how they work??
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 )
i dont now how to draw a ladder logic diagram for diffrent instructions please help me
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
“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?
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
https://www.plctechnician.com/news-blog/Intro-to-Writing–%20PLC-Program-in-4-Simple-Steps
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
Nice Post
Thank you! I’m glad you liked it 🙂
Nice article for newbie
Thanks!
Hi,
Thanks for the brief information about plc
Really good article.
Good structured and well explained!
Can you please help me for doing Ladder logic of weighing scale?
Kindly share details.
Most valuable information regarding Ladder logic examples. Thank-you so much . Great Job. keep it up.
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
https://imgur.com/B57jI4A
Nice Article