You are on page 1of 37

The Software Environment and

Programming of PLCs
The PLC System
Working of a PLC
PLC’s Are ...
• Similar to a Microcontroller:
– Microprocessor Based
– Onboard Memory for Storing Programs
– Special Programming Language: Ladder Logic
– Input/Output Ports
PLC’s Are...
• Dissimilar to Microcontrollers:
– Intended for Industrial Applications
– I/O Designed to interface with Control Relays
– Emphasis on Maximum Reliability
How does a PLC differ from a computer?
• A computer is optimized for calculation and display
• A computer is programmed by specialists
• A PLC is programmed by non-specialists
• A PLC is designed for (logic) control and regulation
• A PLC is well adapted to industrial environment
PLC Origin

• Developed to replace relays in the late 1960s

• Costs dropped and became popular by 1980s
• Now used in many industrial designs
Historical Background
• The Hydramatic Division of the General
Motors Corporation specified the design
criteria for the first programmable controller
in 1968
• Their primary goal :
• To eliminate the high costs associated with
inflexible, relay-controlled systems.
Historical Background
• The controller had to be designed in modular
form, so that sub-assemblies could be
removed easily for replacement or repair.
• The control system needed the capability to
pass data collection to a central system.
• The system had to be reusable.
• The method used to program the controller
had to be simple, so that it could be easily
understood by plant personnel.
Programmable Controller Development
• 1968: Programmable concept developed
• 1969: Hardware CPU controller, with logic instructions, 1 K of
memory and 128 I/O points
• 1974: Use of several (multi) processors within a PLC - timers
and counters; arithmetic operations; 12 K of memory and 1024
I/O points
• 1976: Remote input/output systems introduced
• 1977: Microprocessors - based PLC introduced
• 1980 Intelligent I/O modules developed Enhanced
communications facilities Enhanced software features (e.g.
documentation). Use of personal microcomputers as
programming aids
• 1983 Low - cost small PLC’s introduced
• After 1985: Networking of all levels of PLC, computer onwards
and machine using SCADA software.
A PLC illustrated by Relays
A Simple Relay Controller
Ex1.: Show the logic gate, truth table, and circuit representation for
a solenoid valve (V1) that will be open (ON) if selector switch S1 is
ON and if level switch L1 is NOT ON (liquid has not reached level).
Ex. 2: Show the logic gate, truth table, and circuit representation
for an alarm horn that will sound if push button PB1 is 1 (ON or
depressed) and PB2 is NOT 0 (not depressed).
Structure of a PLC Program
• PLC programs are structured in their composition. i.e.
they consist of individual, separately defined programs
sections which are executed in sequence.
• These program sections are called ‘’blocks”.
• Each program section contains statements.
• The blocks are supposed to be functionally independent.
• Various types of blocks are available according to the
function of the program section.
• Special Function Blocks, which are similar to application
library modules, are used to realize either frequently
reoccurring or extremely complex functions. The function
block can be “parameterized”.
Program Execution: Cyclic
• 1. After the PLC is initialized, the processor
reads the individual inputs. This status of the
input is stored in the process- image input
table (PII).
• 2. This processor processes the program stored
in the program memory. This consists of a list of
logic functions and instructions, which are
successively processed, so that the required
input information will already be accessed
before the read in PII and the matching results
are written into a process-image output table
• 3. In the third step after the processing of the
user program, the status from the PIO will
transfer to the outputs and then be switched
on and/or off.
• Afterwards it begins the execution of the next
cycle from step 1.
Scanning the Ladder Program
Interrupt Driven and Clock Driven
Execution Modes
• A cyclically executing program can however be
interrupted by a suitably defined signal resulting in an
interrupt driven mode of program execution (when fast
reaction time is required).
• If the interrupting signal occurs at fixed intervals we can
also realize time synchronous execution. The cyclic
execution, synchronized by a real time clock is the most
common program structure for a PLC.
• Similarly, programmers can also define error-handling
routines in their programs.
Input Scan
Output Scan
Logical AND ladder diagram
Logical OR ladder diagram
1. Example
2. Example
3. Latching control Circuit
4. Interlock Control Circuit
5. Forward Reverse Control
6. Industrial Stamping Machine
• The control computer for the process has 3 inputs (2 from the limit
sensors and 1 from the master switch) and controls 2 outputs (1 to
each actuator solenoid).

• The desired control algorithm for the process is simply as follows.

When the master switch is turned on, the die-stamping piston is to
reciprocate between the extended and retracted positions,
stamping parts that have been placed in the extended piston
machine. When the master switch is switched off, the piston is to
return to a shutdown configuration with the actuators off and the
piston fully retracted.
Program logic

• Program logic indicates that the Up solenoid output becomes

activated when the Master Switch is on and the bottom Limit
Switch is on.
• Also there is interlock provided, so that when the Down
solenoid is on, the Up solenoid cannot be on.
• Further, once the Up solenoid is on, the output is latched by an
auxiliary contact, so that it remains on till the bottom LS is
made on, when it turns off.
• A similar logic has been implemented for the activation of the
Down solenoid.