0% found this document useful (0 votes)
7 views

4. Ladder Logic Programming

The document provides an overview of Programmable Logic Controllers (PLCs) and their programming using Ladder Logic. It covers various topics including the instruction set, implementation of Boolean functions, combinational logic circuits, timers, counters, and practical applications such as motor control and security systems. Additionally, it includes examples and exercises for designing PLC programs for different scenarios.

Uploaded by

clementmawa8
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

4. Ladder Logic Programming

The document provides an overview of Programmable Logic Controllers (PLCs) and their programming using Ladder Logic. It covers various topics including the instruction set, implementation of Boolean functions, combinational logic circuits, timers, counters, and practical applications such as motor control and security systems. Additionally, it includes examples and exercises for designing PLC programs for different scenarios.

Uploaded by

clementmawa8
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 51

Programmable Logic Controllers

(PLC)

Ladder Logic Programming


BY: EK. KOKUMO
SENIOR INSTRUCTOR – ELECTRONICS
ARUSHA TECHNICAL COLLEGE
Ladder Logic
 The oldest programming language for
PLC
 Well suited to express Combinational
logic
 The main ladder logic symbols represent
the elements:
PLC Instruction Set

• The instruction set for a particular PLC type lists the


different types of instructions supported.
• An instruction is a command that will cause a PLC to
perform a certain predetermined operation.
Ladder Logic for Basic Gates
Ladder Logic for Basic Gates
PLC Program to Implement Various Boolean Functions
1. Implement following Boolean Functions in PLC Ladder Diagram
programming language,
(a)F(w,x,y)=∑(1,3,5,7)
(b)F(a,b,c,d)=∑(0,1,2,3,5,7,9,11)
PLC Program to Implement Various Boolean Functions

2. Implement given Boolean Function having don’t care conditions.


F(A,B,C,D)=∑m(0,1,5,9,13,14,15) + d(3,4,7,10,11)
PLC Program to Implement a Combinational Logic Circuit
A circuit has 4 inputs (A, B, C, and D) and 2 outputs (Y1, Y2). One of
the outputs is high when majority of inputs are high. The second
output is high when all inputs are of same type. Design the
combinational circuit and implement it in PLC using Ladder Diagram
programming language.
PLC Program to Implement a Combinational Logic Circuit
PLC Program to Implement a Combinational Logic Circuit
Implementing Binary to Gray Code conversion in PLC using Ladder
Diagram programming language.
PLC Program to Implement a Combinational Logic Circuit
PLC Program to Implement a Combinational Logic Circuit
Implementing 8:1 Multiplexer in PLC using Ladder Diagram
programming language.
PLC Program to Implement a Combinational Logic Circuit
Ladder Logic Programming example
Ladder Logic Program for Start/Stop of motor
PLC Mixer Process Control
Problem
• Mixer motor to automatically stir the
liquid in the vat when the temperature
and pressure reach preset values.

• Alternate manual pushbutton control of


the motor to be provided.

• The temperature and pressure sensor


switches close their respective contacts
when conditions reach their preset
Process Control Relay Ladder Diagram

• Motor starter coil is energized when both the pressure and


temperature switches are closed or when pushbutton is pressed.
PLC Input Module Connection

• The same input field devices are used

• These devices are wired to the input


module according to the manufacturer’s
labeling scheme.
PLC Output Module Connections
PLC Ladder Logic Program

• The format used is similar to that of the hard – wired relay


circuit
• The symbols represents instructions
PLC Ladder Logic Program

• I/O address format will differ, depending on the PLC


manufacturer.
• You give each input and output an address.
• This lets the PLC know where they are physically connected
Modified PLC Program

Relay ladder diagram

The change requires that the manual pushbutton control


should be permitted to operate at any pressure but not
unless the specified temperature setting has been reached.
Modified PLC Program

PLC ladder logic diagram

If a PLC is used, no rewiring is necessary


PLC Program
A PLC is being used to start and stop an
electric motor, and also to shut it down
automatically if any of three “shutdown”
conditions occur:
 Excessive vibration
 Overcurrent (overload heater contact)
 High winding temperature
The status of each shutdown contact is as
follows:
• Vibration contact: closed when okay,
opens when vibration becomes excessive
• Overload contact: closed when okay,
opens when overloaded
• Temperature contact: open when okay,
closes when hot
Draw a PLC ladder-logic program to start and
stop this motor.
Answer
PLC Program Example

Suppose we have a PLC connected to three


pushbutton switches as shown in this illustration:

Sketch a Ladder Diagram program for this PLC to


energize the lamp if the following input conditions
are met:
• Either switch A or switch B pressed
• Switch C un-pressed
Answer
Ladder Logic Programming

You are given the following main circuit of three phase motor
control.

(1) Sketch its control circuit diagram for hard wired system.
(2) Develop a ladder logic PLC
Program
(3) Sketch wiring diagram for the PLC
Ladder Logic Programming
PLC Inputs List

 FWD PB : I0.0
 REV : I0.1
 STOP PB : I0.2
 Motor Trip : I0.3

PLC Outputs List

 Motor forward : Q0.0


 Motor reverse : Q0.1
LATCHES, TIMERS AND
COUNTERS
LATCHES

• A latch is like a sticky switch - when pushed it


will turn on, but stick in place, it must be pulled
to release it and turn it off.

• A latch in ladder logic uses one instruction to


latch, and a second instruction to unlatch.
PLC Program to Latch and Unlatch an Output by
Sealing
Problem: Implement Latching and Unlatching of Output without using
manufacturer provided Latching and Unlatching Instructions. That is
called Latching by Sealing of contacts.

List of Inputs and Outputs


I:1/0 = Start Push Button
(Input)
I:1/1 = Stop Push Button
(Input)
O:2/0 = Output (Input &
Output)
TIMERS
• There are four fundamental types of timers:
1. on-delay timer
 will wait for a set time after a line of ladder logic has
been true before turning on, but it will turn off
immediately
2. off-delay timer
 will turn on immediately when a line of ladder logic is
true, but it will delay before turning off
3. retentive timer
 will sum all of the on or off time for a timer, even if the
timer never finished.
4. nonretentive timer
 will start timing the delay from zero each time.
TIMERS

An Allen Bradley Retentive On-Delay Timer

An Allen Bradley Off-Delay Timer

An Allen-Bradley TON Timer


TIMERS SAMPLE APPLICATIONS
 An on-delay timer can be used to allow an oven to reach temperature
before starting production
 An off delay timer can keep cooling fans on for a set time after the
oven has been turned off
 Typical applications for retentive timers include tracking the time
before maintenance is needed
 A non retentive timer can be used for a start button to give a short
delay before a conveyor begins moving.
 Retentive off-delay (RTF) timers have few applications and are rarely
used, therefore many PLC vendors do not include them.
TIMERS EXAMPLE 1
When the PLC starts, the second timer
will be off and the T4:1/DN bit will be off,
therefore the normally closed input to
the first timer will be on. T4:0 will start
timing until it reaches 0.5s, when it is
done the second timer will start timing,
until it reaches 0.5s. At that point
T4:1/DN will become true, and the input
to the first time will become false. T4:0
is then set back to zero, and then T4:1 is
set back to zero. And, the process starts
again from the beginning. In this
example the first timer is used to drive
the second timer. This type of
arrangement is normally called
cascading, and can use more that two
timers.
TIMERS EXAMPLE 2

The system is started with a Start


button that seals in the Auto mode.
This can be stopped if the Stop button
is pushed. (Remember: Stop buttons
are normally closed.) When the Auto
goes on initially the TON timer is used
to sound the horn for the first 10
seconds to warn that the oven will
start, and after that the horn stops and
the heating coils start. When the oven
is turned off the fan continues to blow
for 300s or 5 minutes after.
PLC Program to Latch and Unlatch Output With Time Delay
Problem: Implement Latching and Unlatching of output with a particular
time delay in PLC using Ladder Diagram.
• List of Inputs and Outputs
• I:1/0 = Start Push Button (Input)
• T4:0/DN = Timer 4.0 done bit (Input)
• O:2/0 = (Output)
• T4:0 = (Timer)
COUNTERS
• There are two basic counter types: count-up and count-down.

• When the input to a count-up counter goes true the accumulator


value will increase by 1 (no matter how long the input is true.) If the
accumulator value reaches the preset value the counter DN bit will
be set.

• A count-down counter will decrease the accumulator value until the


preset value is reached.
COUNTERS

An Allen Bradley count-up (CTU)


instruction. The instruction requires
memory in the PLC to store values and
status, in this case is C5:0. The C5:
indicates that it is counter memory, and
the 0 indicates that it is the first location.
The preset value is 4 and the value in the
accumulator is 2. If the input A were to go
from false to true the value in the
accumulator would increase to 3. If A were
to go off, then on again the accumulator
value would increase to 4, and the DN bit
would go on. The count can continue
above the preset value. If input B goes true
the value in the counter accumulator will
become zero.
COUNTERS EXAMPLE 1
In the example input I/1 drives the
count-up instruction for counter C5:1.
Input I/2 drives the count-down
instruction for the same counter
location. The preset value for a
counter is stored in memory location
C5:1 so both the count-up and count-
down instruction must have the same
preset. Input I/3 will reset the counter.
COUNTERS EXAMPLE 2
The program is used to remove 5
out of every 10 parts from a
conveyor with a pneumatic cylinder.
When the part is detected both
counters will increase their values
by 1. When the sixth part arrives
the first counter will then be done,
thereby allowing the pneumatic
cylinder to actuate for any part
after the fifth. The second counter
will continue until the eleventh part
is detected and then both of the
counters will be reset
PLC Program for a Car Parking System
Problem: A parking plot has total capacity of Cars. Number of empty
spots are displayed on the display outside the Parking Plot and which
spots are available is to be indicated by LEDs. Implement this in PLC
using Ladder Diagram programming language.

PLC Program

List of Inputs and Outputs


I:1/0 to I:1/4 = IR Sensor to detect the presence of cars (Inputs)
O:2/0 to O:2/4 = LEDs to indicate presence of car spots (Outputs)
C5:0 = To increment when Car exits (Counter Up)
C5:0 = To decrement when Car enters (Counter Down)
O:6 = Display address (Output)
Ladder Diagram
Problem: A parking plot has total
capacity of Cars. Number of empty
spots are displayed on the display
outside the Parking Plot and which
spots are available is to be indicated
by LEDs. Implement this in PLC using
Ladder Diagram programming
language.
PLC Program for Burglar Alarm Security System
Problem: Consider the design of a Burglar Alarm for a house. This alarm will be
activated if an unauthorized person is detected by a Window Sensor or a Motion
Detector. Implement this Alarm System in PLC using Ladder Diagram
programming language.

PLC Program
• List of Inputs and Outputs
• I:1/0 = Master Switch (Input)
• I:1/1 = Deactivate system (Input)
• I:1/2 = Motion Detector (Input)
• I:1/3 = Window Sensor (Input)
• I:1/4 = Button to Stop Alarm (Input)
• O:2/0 = Master Coil (Output)
• O:2/1 = Alarm Coil (Output)
• O:2/2 = Alarm (Output)
INTERNAL RELAYS

• Inputs are used to set outputs in simple programs.

• More complex programs also use internal memory locations that are
not inputs or outputs.

• These are sometimes referred to as ’internal relays’ or ’control relays’.


Knowledgeable programmers will often refer to these as ’bit memory’.

• In the Allen Bradley PLCs these addresses begin with ’B3’ by default.

• The first bit in memory is ’B3:0/0’, where the first zero represents the
first 16 bit word, and the second zero represents the first bit in the
word
The sequence of bit
INTERNAL RELAYS-EXAMPLE

The first ladder logic rung will


turn on the internal memory
bit ’B3:0/0’ when input
’hand_A’ is activated, and
input ’clear’ is off. (Notice that
the B3 memory is being used
as both an input and output.)
The second line of ladder logic
similar. In this case when both
inputs have been activated,
the output ’press on’ is active
Exercise
Problem 1
A classroom has a capacity of maximum 120 students. There are two doors, one for Entry and the other for
Exit. When number of students in the classroom is less than 120, Entry door has a Green light on it which
remains ON. When number of students in the classroom is 120 or more than that, Red light goes ON turning
OFF the Green light which indicates that the classroom has reached its maximum capacity and is full.
Problem 2
When a Car enters the hall, a certain sequence is to be followed automatically. Steps are, 1) Soaping, 2)
Washing, 3) Rinsing and 4) Drying. Implement this process sequence in PLC using Ladder Diagram
programming language.
Problem 3
Two Motors are running in a sequence one by one for a particular time. If the start button is pressed Motors
run in sequence such that 1st Motor stays ON for 5secs and then 2nd Motor is turned ON and stays ON for
5secs. And the cycle is repeated until it is interrupted. While motors are running in the sequence, if one
motor is running and the button of other motor is pressed, then the running Motor should stop and the
other motor should run. Implement this logic in PLC using Ladder Diagram programming language.

You might also like