Ladder Logic Symbols
Ladder Logic Symbols
The ladder logic symbols that are used in ladder logic programming have been derived from
traditional relay logic control circuits. If you have a basic knowledge of electric circuits then
getting started in ladder logic programming should be a breeze.
If not, don’t worry, ladder logic is a graphical programming language and getting to know the
basic ladder logic symbols and concepts is quite easy.
Learning the basic ladder logic symbols will give you a solid foundation.
Generally speaking a large majority of real world applications can be accomplished with the
basic ladder logic symbols outlined below.
As your desire to program complex automation and process control functions increases then
higher level ladder logic symbols can be used.
These include, but are not limited to math operations, PID loops, data manipulation and data
conversion.
Operation:
Common Uses:
Operation:
Common uses:
Output
Operation:
Common uses:
Motor Contactors.
Actuators.
Indication lamps.
Warning sirens.
Internal programming.
Operation:
If the input condition transitions from FALSE to TRUE then the output is ON, for the time
taken to do one PLC program scan.
Common uses:
Counting applications.
Math commands.
Data Transfer commands.
Latch output during a specific set of conditions.
Timer Delay On
Operation:
When the pre-set time has been reached the output turns ON.
If the input condition goes FALSE, at any stage, the timer stops and the output turns OFF as
well.
Common uses:
Operation:
When the pre-set time has been reached the output turns OFF.
If the input condition goes TRUE, at any stage, the timer stops and the output turns ON as well.
Common Uses:
Comparison –
Greater Than or Equal To
Equal To
Operation:
If the comparison between two inputs is TRUE then the output turns ON.
Common uses:
Math Instructions –
Addition
Subtraction
Multiplication
Division
Operation:
Common uses:
Scaling of Analogue Inputs and Outputs (Temperature, Flow, Motor Current, Weight etc).
The advent of the microprocessor meant that relay logic control functionality could be
programmed and stored in a computer. In the late 1960’s some really brainy people realized
this and pressed ahead to create a device called a Programmable Logic Controller (PLC).
Relay logic in a PLC is the method of formulating logical expressions in order to automate
machinery and processes in industrial applications. The programming language that is
used to create relay logic in a PLC is called Ladder Logic.
This was a massive breakthrough in the industrial automation industry which would eventually
render relay logic control systems near redundant.
In an automated control system the main advantages of a PLC over relays are:
The fundamental component of a relay logic is the relay. So let’s look at how relays work in a
little more detail…
What Is A Relay?
A relay is an electromechanical device that consists of two basic components, a relay coil and
relay contact. The relay contact is used to switch a circuit on or off and the relay coil is used to
change the state of the relay contact. The three main types of relays are spring return relays,
latching relays and multipole relays.
Relays are used because they allow electric isolation between the switching circuit (contact)
and control signal circuit (coil) via means of electromagnetics. That means relays can be used
to connect circuits with different voltage and current levels to control equipment like motors
and actuators. A relay can also switch multiple circuits with different states at the same time
making them ideal for logic control circuits in industrial automation.
Allowing control circuits to switch a load circuit even if the voltages of both circuit are
different.
Able to switch a high current device using a low current electronic control signal.
Relays can be wired in combination to perform logical operations using a network of
electric circuits known as relay logic.
Relay coil.
Relay Contact.
A relay coil is essentially copper wire wound around a chunk of iron that is used to produce
an electromagnetic field that can attract metal. Think of a junk yard crane that is used to pick
up scrap metal. It uses the same principle to generate a magnetic field that attracts metal.
A relay contact is basically a switch that is used to turn an electric circuit on or off.
Hang on a minute! If the contacts of a relay turn an electric circuit on or off why do we need
the coil?
Well, the relay coil’s purpose is to change the state of the relay contacts. Just like your finger
is used to change the state of a light switch from off to on. So, we are changing the state of the
contacts using an electrical signal instead of your using your finger.
Electromechanical Relay
To energize the coil we need to connect it to a voltage source, which is sometimes called a
relay input.
Some common DC voltage relays are 5V relay, 12V relay and 24V relay. Some common AC
voltage relays are 120VAC relay and 240VAC relay.
The voltage rating is usually written on the casing of the relay. The coil voltage rating needs to
be adhered to otherwise the relay coil may fail to change the state of the contacts or overheat
and burn out.
When we energize the relay coil with it’s rated voltage it allows current to flow within the relay
coil and produces and electromagnetic field. This electromagnetic field is used to attract the
relay contact towards the relay coil, thus changing the state of the relay contacts.
The relay contacts are either configured normally open (NO) or normally closed (NC). Quite
often a relay will have changeover contacts.
A changeover contact is the combination of both normally open (NO) and normally closed
(NC) contacts in the same contact block. The changeover contact allows selection of either the
normally open (NO) or the normally closed (NC) contact depending on the way it is wired. It
is sometimes called a double throw contact.
The contact voltage and current rating is usually written on the casing of the relay. The contact
voltage and current rating needs to be adhered to otherwise the relay contact may overheat and
burn out.
If the relay coil voltage rating and contact voltage and current rating are not written on the relay
casing then check the relay base. Sometimes it’s a combination of both the case and base. If all
else fails then consult the data sheet.
If a relay is wired to a normally open (NO) contact and the relay is energized then the contact
will change state from OPEN to CLOSED…..
If a relay is wired to a normally closed (NC) contact and the relay is energized then the contact
will change state from CLOSED to OPEN…..
If a relay with changeover contacts is wired in a normally open (NO) configuration and the
relay is energized then the contact will change state from OPEN to CLOSED…..
Basic Relay Operation with Changeover Contacts wired Normally Open (NO)
If a relay with changeover contacts is wired in a normally closed (NC) configuration and the
relay is energized then the contact will change state from CLOSED to OPEN. Notice that the
wiring of the contacts has changed sides…..
Types of Relays
There are several types of relays each with their specific characteristics and uses. The 3 types
that are used frequently in industrial applications are spring return relays, latching relays and
multipole relays.
The most common relays are spring return relays. They have one relay coil and use a spring to
return the relay contact back to it’s normal state after the relay coil is de-energized and the
electromagnetic field has collapses.
The relay coil must be energized at all times in order for the state of the relay contact to remain
in it’s changed state. As soon as the coil is de-energized then the relay contact returns back to
it’s normal state.
Can you see the spring in the “Electromechanical Relay” picture above? The spring is at the
very top of the relay.
Latching Relay
A latching relay is a type of relay that can change and maintain the state of the contact without
the need for the coil to be constantly energized. It utilizes two separate coils, each of which are
responsible for a certain state of the contact either open or closed. A short voltage pulse to
energize either coil in the latching relay is all that is required to change the state of the contact.
Multi Pole Relay
A multi pole relay is any type of relay with more than one contact. Each relay contact is called
a pole. So a relay with two contacts will be called a two pole relay and a relay with four contacts
will be called a four pole relay.
When using multi pole relays multiple coils are not required to change the state of the contacts.
The state of all the relay contacts is changed at the same time by a single relay coil.
In short, the operation of a single pole relay is the same as a multi pole relay, we just have more
contacts to play with!
This is handy when we are activating more than one device. Especially when the devices need
different voltage levels or the combined current draw of multiple devices exceeds the current
rating of a single contact. It’s also handy having multi pole relays when the process control
logic gets complex.
In order to connect a relay we need to wire the coil to a voltage supply (generally switched)
and the contacts to the load device like a light, motor, solenoid valve or another relay. This can
be done by connecting the relay coil and contact wires to the terminals of a relay base. The
relay base terminal allocation for connection is usually drawn on the relay casing, labelled on
the relay base or detailed in the relay data sheet.
How to connect a Relay
The common on a relay is the terminal associated with the part of the contact that does not
switch when the relay coil is energized. In a relay with a changeover contact it is the terminal
“common” to both the NO and NC contacts. When the common is wired correctly it is
connected to the load supply voltage.
Common On A Relay
Power supply.
Relay components.
Connection wires.
The power supply voltage needs to match the rated relay coil voltage. Also, the power supply
needs to be big enough to accommodate the current draw of all the relays when they are
energized.
The relays are selected according to the power supply’s output voltage, functionality and
current rating of the contacts required.
Because relay logic is a hard wired system some sort of wiring diagram or relay schematic
diagram is required to make sense of it all.
Now please take note, there are many ways to draw an electric circuit. Depending on which
country you are from will determine which standard relay wiring diagram you will need to
use. The way circuits are laid out and the component symbols will vary from one drawing
standard to the next. Also, some drawing standards arrange their control circuits from left to
right and some use top to bottom. Check out the sample drawings below….
For the purposes of this explanation a left to right arrangement will be used because it ties in
with ladder logic diagrams later on.
A relay schematic diagram consists of a supply voltage rail on the left hand side and a zero
voltage rail on the right hand side drawn as vertical lines.
The relay components and other devices are packed in between connected by wires, drawn as
horizontal lines, to form a circuit.
The relay coil and relay contacts can be drawn as per the relay logic symbols diagram below….
Relay Logic Vs Ladder Logic – Relay Logic Symbols
The most basic of relay logic circuits uses a power supply, a relay, a switch and a device that
needs to be switched ON or OFF all wired together as shown in the simple relay diagram
below….
The above relay logic circuit example shows a lamp (Lamp No.1) being switched on via a relay
(Relay No.1).
The first line has a rotary switch connected to the coil of Relay No.1 with the relay coil labelled
as R1.
The second line has a normally open contact from Relay No.1 also labelled R1 which is
connected to Lamp No.1.
To aid in understanding relay schematics the sequence of events is read from the first horizontal
line downwards and from the left hand side power rail to the right hand side power rail.
We read from left to right because the potential difference between the left and right hand side
power rails creates current flow in that direction. In the example relay schematics a green line
is used to highlight current flow in the circuit.
So, in the first line we start at the left hand side power rail and follow the horizontal line until
we get to the normally open Rotary Switch.
If the rotary switch is in the OPEN state there is an open circuit and current cannot flow to the
right hand side of the circuit. So the relay coil (R1) stays de-energized.
If we go to the second line we notice that the normally open relay contact (R1) stays OPEN
because Relay No.1 coil (R1) is de-energized. Therefore there is also an open circuit on the
second line so no current can flow to the lamp and it stays OFF….
When the Rotary Switch is turned ON it’s state changes from OPEN to CLOSED.
If we look at the first line and start at the left hand side power rail then follow the horizontal
line until we get to the Rotary Switch we can observe that it is in the CLOSED state and current
can flow to the right hand side of the circuit.
So in this case the relay coil (R1) is energized and then we reach the end of the right hand side
rail.
Now let’s go to the left hand side of the second line where we notice that the normally open
relay contact (R1) has also changed state to CLOSED because the relay coil is energized.
Therefore there is a closed circuit on the second line so current can flow to the right hand side
of the circuit and Lamp No1 turns ON….
Basic Relay Logic Circuit Example – With Rotary Switch On
Let’s spice it up and add another line to the relay logic circuit.
This time we’ll use a second relay contact from Relay No1 and wire it as a normally closed
contact. Then we’ll add a second lamp (Lamp No2) to the new circuit.
In this case the operation of that lamp will be reversed. So when the Rotary Switch is OFF,
Lamp No.2 is ON and when the Rotary Switch is ON, Lamp No.2 is OFF.
Wait, what????
Don’t believe me then check out the relay logic circuit below….
The new relay contact in the third line is now a normally closed instead of normally open.
When Relay No.1 coil is de-energized it’s normally closed contact is in it’s normal state, that
is CLOSED.
When Relay No.1 coil is energized it’s normally closed contact changes state to OPEN.
A normally closed contact behaves the opposite of a normally open contact. It’s sometimes
referred to as reverse relay logic or just reverse logic. See below….
Relay Reverse Logic – With Rotary Switch On
So, what is the difference between relay logic and ladder logic?
The big difference between relay logic and ladder logic is that relay logic needs to hard
wire each and every control circuit for every single control function. Whereas ladder logic
uses the assistance of a microprocessor based device called a Programmable Logic
Controller (PLC).
The difference between a PLC and relay logic is that a PLC is a programmable device
whereas relay logic is a network of hardwired electrical devices. Both a PLC and relay
logic can perform logical computation, but a PLC does it using a microprocessor and
relay logic does it using electric circuits.
So essentially what we are doing is getting a mass of relays and wires and replacing them with
a tiny box that has awesome computing power.
Even with a PLC and ladder logic programming we still need to hard wire certain devices such
as the switches and lamps just like in the relay logic examples above. But the wiring is greatly
reduced because only the input and output devices need hard wiring. The control relays that
are used to form the control functionality and logic functions are replaced by the ladder logic
program stored internally within the PLC memory.
Relay Logic Vs Ladder Logic – Programmable Logic Controller
The format of a ladder logic diagram is similar to that of a relay logic circuit.
There is power rail on the left hand side and a power rail on the right hand side drawn as vertical
lines.
The logic programming is inserted in between the power rails and connected with horizontal
lines to form a logic expression.
STOP…. rails and rungs….That’s why the term “Ladder” is used in Ladder Logic…. Light
bulb moment!
However the symbols used are a bit different to the relay logic circuit drawings. Check out the
table below to compare the differences of the basic components…
If we were to use a latching relay which uses two coils, one to latch (or set) the relay and the
other to un-latch (or reset) the relay. The relay symbols are represented as below….
Ladder Logic Latching Relay
To outline the difference let’s use the example above where a switch is turning two lamps ON
and OFF alternatively.
If we use a PLC with a ladder logic program we firstly need to hard wire the switch to the input
terminals of the PLC. Then we need to hard wire the lamps to the output terminals. Lastly, we
need to write our ladder logic program and load it into the PLC memory.
The diagram below shows a ladder logic diagram when the Rotary Switch is OFF….
The diagram below shows a ladder logic diagram when the Rotary Switch is on.
Installation time is greatly reduced with ladder logic control systems due to the reduced
amount of hard wiring required. In other words, we only need to hard wire the input
and output devices. The control logic is implemented using software not hard wired
relays.
Modifications to the control logic can easily be done using software to modify the
ladder logic program rather than hardware and wiring modifications that would
normally be the case with relay logic control.
The same PLC can be used for a wide range of control system applications by simply
loading a different ladder logic program into the PLC memory.
Control system expansion is simplified with a PLC by adding expansion modules as
opposed to complex hardware and wiring modifications that would be the case with
relay logic control.
Ladder logic is microprocessor based which has faster execution times, is far more
reliable and longer lasting than relay logic control systems which have a large amount
of mechanical components.
Ladder logic control systems are far more compact than relay logic control systems.
So, in the battle of relay logic vs ladder logic we can confirm that ladder logic is definitely
winning. In fact it can be said that relay logic control systems for larger installations are all but
dead. Some countries still have regulations for burner control panels to be relay logic
controlled, but these will no doubt be eventually replaced with PLC based control systems.
For some smaller installations where you have a handful of devices to control with basic
functionality it’s still handy to use relay logic for controlling the application. But with the cheap
price of PLC’s and the ease of ladder logic programming they are increasingly attractive for
even the smaller applications.
In the next section we’ll build on ladder logic basics and uncover the seven essential rules that
you must know to in order to program a Programmable Logic Controller ( PLC ) with ladder
logic diagrams along with the basics of implementing PLC ladder logic programming.
When we use the term latching in a PLC it refers to changing the state of an output to TRUE,
holding the state of that output TRUE until certain conditions occur, then returning the state
of the output back to FASLE.
Latching in a PLC
Latching is one of the most important pieces of ladder logic programming that you’ll ever
use.
1. Set and Reset instructions. In an Allen Bradley PLC they are called Latch and
Unlatch instructions. These instructions simulate the function of an
electromechanical latching relay. Advantages include flexibility in programming
because the Set (Latch) and Reset (Unlatch) symbols do not need to be in the same
rung. The disadvantage is that debugging can become more difficult because the Set
(Latch) and Reset (Unlatch) symbols may be scattered throughout the program.
2. Latching logic. Quite often hold in logic is referred to as hold in logic. It’s ok to
interchange the terms. The advantage of latching logic is that troubleshooting is easier
because the symbols used are all in the same rung. The disadvantage is that there is
some inflexibility in programming because latching logic requires all the symbols to
be on the same rung and may even overflow to the next rung. This can be restrictive
in some cases.
Simple applications requiring a latch are well suited to use latching logic.
But when it comes to more complex applications the use of Set (Latch) and Reset (Unlatch)
symbols may be required.
Latching in a PLC requires at least one input to set the latch (Input A), one input to reset the
latch (Input B) and one output to store the latch state (Output Y).
The inputs that set and reset the latch are usually momentary pulses. A great example of a
device that can provide a momentary pulse to a PLC input is a push button.
When both Input A and Input B are FALSE then the state of Output Y does not change. If
Output Y is FALSE then it stays FALSE….
Ladder Logic Programming Examples – Ladder Latch
If Input A goes TRUE momentarily then the Set symbol changes the state of Output Y to
TRUE.
Then, after subsequent scans, if Input A changes state to FALSE it does not affect the state of
Output Y. In other words, Output Y is latched TRUE…
Only when Input B changes state to TRUE will the Reset symbol change the state of Output
Y back to FALSE. In other words, Output Y is now unlatched….
Remember the PLC scan runs from left to right and from top to bottom.
So if both Input A and Input B are TRUE at the same time, then in the ladder diagram above
the first rung is evaluated and Output Y is set TRUE.
But, then the second rung is evaluated and Output Y is set FALSE.
Once the scan reaches the end of the entire program it will execute the state of Output Y as
FALSE.
Ladder Logic Latch with Hold In Logic
Using hold in logic to achieve latching has a similar outcome to using Set (Latch) and Reset
(Unlatch) symbols.
But with hold in logic both Input A and Input B are on the same rung as Output Y. Also, the
way in which the latch is SET and RESET is done differently.
Notice that Input B is a normally closed (NC) contact symbol and Output Y is used twice and
branched (or in parallel with Input A).
Ladder Logic Programming Examples – Ladder logic latch with hold in logic
Remember the scan goes from left to right and top to bottom.
So the scan starts from the left hand side of the rung and moves right to Input A.
If Input A goes TRUE and Input B is FALSE then Output Y goes TRUE….
The scan continues on with the rest of the program and it cycles back to the rung.
Previously Output Y had changed state to TRUE, so now Output Y that is in a branch across
Output A, also goes TRUE and there is no other change….
When the scan cycles back again from the top, if Input A goes FALSE, with Input B still
FALSE, then Output Y stays TRUE.
This is because Output Y is held in by itself using the branch across Input A.
Notice that the logic flows from the left hand side rail through the Output Y branch and then
through Input B to Output Y at the right hand side rail. Pretty cool…..
Once we have triggered the hold in logic using Input A, Output Y will remain latched even if
Input A goes FALSE.
Output Y will remain latched TRUE until Input B goes TRUE. Because Input B is a normally
closed (NC) contact symbol, when it goes TRUE, the logic flow is blocked and Output Y
goes FALSE. Thus releasing the latch.
Remember the NC contact symbol works like a NOT statement, it’s reverse logic….
So, when the scan cycles back again from the top then Output Y, branched across Input A,
also goes FALSE….
Ladder Logic Programming Examples – Ladder hold in logic (Unlatched)
Once Input B returns to the FALSE state we are back at the start, ready to initiate the latch
again.
Hold in logic is great to use because it simplifies your code. It enables us to place all the
conditions that initiate and release latch in the same rung. This makes it easier to read and
troubleshoot.
Simple ladder logic for motor control using push button start stop logic includes a start
button, stop button, motor thermal overload and motor run contactor.
When we wire up the inputs to the PLC the start push button input is wired normally open
(NO). So when the start button is pushed the PLC input changes state from FALSE to
TRUE…
But the stop push button and thermal overload are always wired normally closed (NC). So
when the stop button is pushed it changes from CLOSED to OPEN. In turn the PLC input
changes state from TRUE to FALSE….
PLC Wiring Basics – Stop Button
In fact the rule of thumb is that any device that is required to stop the motor should be wired
normally closed (NC), to make it “fail safe”.
The most common failures are wire break, device failure or PLC input failure.
Wiring the stop push button normally closed (NC) is done because when a failure occurs in
the PLC input circuit it will, more often than not, lead to an open circuit which changes the
state of the PLC input from TRUE to FALSE.
However, if we wire the stop PLC inputs as normally open (NO) and a failure occurs then the
state of the PLC input does not change. It stays FALSE, even if the stop button is pressed,
because there is an open circuit in the connection to the PLC input.
So if there is no change in state, we cannot tell the motor to stop in our ladder logic program.
This is really bad!!!
So for any PLC input that is intended to stop the motor we need to..…
WIRE THE MOTOR STOP SIGNALS NORMALLY CLOSED AND USE A NORMALLY
OPEN SYMBOLS IN THE PLC.
Now that we’ve grasped the concept of the fail safe stop input let’s move on to the motor
control ladder logic programming example.
First up let’s list the required inputs and outputs for our motor control ladder diagram.
PLC manufacturers use different memory address allocation so the input output allocations
used here are arbitrary address.
The M1 RUN output is used a second time to latch the M1 RUN output.
Both M1 STOP and M1 TOL are wired normally closed (NC) to the PLC inputs and thus
need to be configured as normally open (NO) symbols in the logic.
So when either stop is activated the logic flow is broken and the latch is reset….
Remember, we must wire M1 Stop and M1 TOL using normally closed (NC) contacts to the
PLC inputs to make it “fail safe” and for this motor control ladder diagram to work.
If you don’t know what the heck I’m talking about you’ve probably skipped straight to the
motor control ladder diagram. Please….Go back and read the section above to get full bottle
on latching logic…..It’s important!
To help out we’ve developed a nifty table which displays the different combinations of PLC
digital input wiring and ladder logic symbols that can be used.
Further more, it outlines the logic state each of the ladder logic symbols depending on
whether the PLC input is activated or de-activated.
PLC Wiring Basics and Ladder Logic Symbols
In the next section we’ll build on our newly discovered knowledge by exploring the timer
symbol and it’s use in PLC motor control
Ladder Logic Basics
Ladder logic is a programming language that is used to program a PLC (Programmable Logic
Controller). It is a graphical PLC programming language which expresses logic operations with
symbolic notation using ladder diagrams, much like the rails and rungs of a traditional relay
logic circuit. It is used by engineers and electricians to execute logical, sequential, counting,
timing and arithmetic tasks in order to carry industrial automation applications.
In the good ol’ days, machine and process automation was accomplished using a hard wired
control system known as relay logic. With the advent of microprocessors and the invention of
the PLC, relay logic quickly became superseded by programming languages such as ladder
logic.
Because ladder logic was originally designed to replace the use of hard wired relay logic
circuits for machine control the ladder logic programming code actual looks like an electrical
schematic drawing. You might be thinking that ladder logic sounds like an old programming
language. So, with the advancements in software that the world has recently made, is ladder
logic still used?
Ladder logic is definitely still being used in PLC programming. It is the most common method
for programming a PLC. Ladder logic programming is still used today because the core
fundamental logic principles for machine and process control are still the same.
Having said that, the advancements in software have resulted in other PLC programming
languages that compliment ladder logic and vastly improved interface and programming
software has also been developed.
In PLC programming, ladder logic is a programming language that is used for developing logic
expressions in order to automate tasks. Recent advancements in software technology means
that PLC programming using ladder logic has been extended into counting, timing, arithmetic,
sequencers, PID control, data manipulation functions and more. Over the years ladder logic has
developed into the powerful PLC programming language that it is today.
Ladder logic is used extensively for programming PLCs in a multitude of industrial automation
applications. Some examples include….
Trying to learn ladder logic basics can be an overwhelming task. If you have some experience
with electric circuits then the PLC programming concepts of ladder logic should be relatively
easy to grasp. Otherwise take comfort in knowing that ladder logic is the quickest and easiest
PLC programming language to learn. In order to help you grasp ladder logic basics we
will….
So let’s begin….
1 or 0
True or False
On or Off
High or Low
Yes or No
Microprocessors
love binary…..10101011101000111010001010100010100100101010010011.
I don’t know about you, but my head hurts just looking at that.
Luckily ladder logic uses symbolic expressions and a graphical editor for writing and reading
ladder diagrams making it easier for us mere humans to comprehend. If we translate a real
world event into ladder logic we can express it symbolically in the form of a normally open
(NO) contact. This event could be something like a button being pushed or a limit switch being
activated.
Let’s call it event ‘A’. It follows the binary concept and has one of two states, TRUE or FALSE.
The event associated with the normally open (NO) contact can be TRUE or FALSE. When that
event is TRUE then it is highlighted green and the logic flow can move past it to the next logic
expression. Just like the current flow in an electric circuit when a switch is turned on.
The ladder logic truth table for a normally open (NO) contact which denotes event ‘A’ is shown
below….
A normally open (NO) contact alone cannot decide what action to take to automate
something, it merely tells us in what state the event is.
Logic is the ability to decide what action needs to be taken depending on the state of one or
more events.
We use the binary and logic concepts every day in our own lives. For example, if I feel cold
then I put my sweater on, but if I fell hot then I take my sweater off.
Now, let’s call the result of the logic function ‘Y’. In ladder logic the result of a rung logic
function is defined as a PLC output.
When we take these two fundamental elements and insert them into a rung in a ladder
diagram we get your first line of code!
Now, let’s expose the hidden inbuilt functions by highlighting them in blue in order to
illustrate the relationship between the ladder diagram rung structure and it’s inbuilt IF, THEN
functions….
We can write out the logic expression in the above as rung as IF A THEN Y.
Because PLC input A follows the binary concept it has two possible states, TRUE or FALSE.
If we translate this into a ladder logic diagram we express it symbolically in the form of a
normally open (NO) contact for the input and a relay coil for the output. Remember the logic
flow is from left to right and follows the same concept of current flow in an electric circuit.
In order to fast track our understanding ladder logic there are three more fundamental logic
functions that are essential to know.
You may be surprised, but when we combine these three functions with IF, THEN we will be
able to program the majority of automation control requirements.
1. NOT
2. AND
3. OR
The result of the NOT function is basically the opposite state of an event that occurs.
So if PLC input A is FALSE the result will be TRUE. And vise versa when PLC input A is
TRUE the result will be FALSE.
The NOT Function is sometimes referred to as reverse logic. Check out the truth table
below….
Truth Table – NOT Function
If we translate a NOT function into a ladder logic diagram we express it symbolically in the
form of a normally closed (NC) contact.
The AND function examines multiple PLC inputs and has one resulting output.
If we translate an AND function into a ladder diagram we can express it symbolically in the
form of two normally open (NO) contacts (PLC inputs A and B) and a relay coil (PLC output
Y).
They are all connected in line, just like a series connection in an electric circuit.
This time we have also highlighted the hidden AND function to illustrate the relationship
between the ladder logic functions and the ladder diagram rung structure.
The AND function examines if all the PLC inputs are TRUE, then the corresponding result is
also TRUE. However if any one of the PLC inputs is FALSE then the corresponding result is
also FALSE.
Because PLC input A and B follows the binary concept and are part of the AND function
there are four possible logic iterations.
The number of logic iterations increases with the number of PLC inputs (2PLC Inputs). But that
doesn’t matter too much with the AND function because the result can only be TRUE if all the
PLC inputs are TRUE.
If we translate an AND function into a ladder logic truth table we get the table below….
The OR function examines multiple PLC inputs and has one resulting output.
If we translate an OR function into a ladder diagram we can express it symbolically in the form
of two normally open (NO) contacts (PLC inputs A and B) and a relay coil (PLC output Y).
The inputs are placed in the rung in what is known as a branch. This is the equivalent of a
parallel connection in an electric circuit.
This time we have also highlighted the hidden OR function when we create a branch (parallel
connection) with PLC input B across PLC input A.
We can write out the logic expression above as IF A OR B THEN Y.
The OR function examines if any of the PLC inputs are TRUE, then the corresponding result
is also TRUE. However, all the PLC inputs must be FALSE in order for the corresponding
result is also be FALSE.
Because PLC input A and B follows the binary concept and are part of the OR function there
are four possible logic iterations.
Remember, the number of logic iterations increases with the number of PLC inputs (2PLC
Inputs
). But that doesn’t matter too much with the OR function because the result can be TRUE
if any of the PLC inputs are TRUE.
If we translate an OR function into a ladder logic truth table we get the table below….
Ladder Logic Basics Truth Table – OR Function
Well done! You now have a handle on the basics of ladder logic.
In the next section we will jump straight into the most common symbols that you can’t do
without when ladder logic programming. We’ll also examine their operation and outline
some of their most popular uses.