You are on page 1of 13

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. 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.

If you want to learn ladder logic from the beginning, you should check out my ladder
logic tutorial!

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.
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.

Ladder logic examples can be hard to find, though. Especially because the names of
the ladder logic examples often are confusing and even misguiding. A ladder logic
example of a trafic light can, as an example, vary a lot.
One other thing that causes good PLC ladder logic examples to be so hard to find, is
that ladder logic often is brand specific. Many PLC ladder logic program examples are
available for download, and you will have to install the PLC programming software to
view the example ladder.

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.

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.

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.

 
 

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:


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. 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 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 timers available in ladder logic. The on-delay timer, the off-delay timer and the
retentive 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 Litefrom Allen Bradley.

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:

1. HEATING ON:
Heating element and cooling fans turn on.
2. HEATING OFF:
Heating element off and off delay timer starts counting down.
3. TIMER DONE:
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. Off delay timer for extra delay.

You might also like