plc course presentation

346

Upload: osama-wahdan

Post on 16-Apr-2017

546 views

Category:

Engineering


2 download

TRANSCRIPT

Page 1: Plc course presentation
Page 2: Plc course presentation

HIGHER

TECHNOLOGICAL

INSTITUTE

Page 3: Plc course presentation
Page 4: Plc course presentation

Prepared by

Dr. Mohiy Bahgat

Faculty of Engineering

Helwan University

Page 5: Plc course presentation

Course Contents

1. Introduction and Review

2. Internal Construction of the PLC

3. Sequential Control Systems

4. Input / Output Devices

5. PLC Networks and Hardwiring

Page 6: Plc course presentation

6. Programming of the PLC

7. Internal Relays

8. Timers

9. Counters

10. Shift Registers

Page 7: Plc course presentation

Chapter 1

Introduction

and Review

Page 8: Plc course presentation

Control System Task

• The main task of a control system is to

control a sequence of events or maintain

some variable constant or follow some

prescribed change.

• The inputs to such control systems

might come from switches or sensors,

however the outputs of the controller

might go to run a motor in order to move

an object, or to turn a valve, or perhaps

some heater on or off.

Page 9: Plc course presentation

• In the traditional form of control systems,

the governing rules and the control actions

depend on the wiring of the control circuit.

• When changing the rules used for giving the

control actions, the wiring has to be

changed too. This leads to expensive cost

of replacing the controllers.

• Instead of hardwiring each control circuit

for each control rule or action, the basic

system for all situations can be used with a

microprocessor based controller.

Page 10: Plc course presentation

• So, by changing the program instructions, the

same control circuit may be used with a wide

variety of control rules or actions, which

saves the cost.

• This was the main idea behind inventing the

programmable logic controllers (PLC).

• The PLC was invented in response to the

needs of the automotive manufacturing

industry where software revision replaced the

re-wiring of hard-wired control panels when

production models changed.

Page 11: Plc course presentation

• Before the PLC, control, sequencing, and

safety interlock logic for manufacturing

automobiles was accomplished using

hundreds or thousands of relays, cam timers,

and drum sequencers and dedicated closed-

loop controllers.

• The process for updating such facilities for

the yearly model change-over was very time

consuming and expensive, as the relay

systems needed to be rewired by skilled

electricians.

Page 12: Plc course presentation

• In the late 1960's PLCs were first introduced.

• The primary reason for designing such a

device, as mentioned before, was eliminating

the large cost involved in replacing the

complicated relay based machine control

systems.

• Bedford Associates proposed something

called a Modular Digital Controller (MODICON)

to a major car manufacturer.

Page 13: Plc course presentation

• Other companies at the time proposed

computer based schemes, one of which was

based upon the PDP-8.

• The MODICON 084 brought the world's first

PLC into commercial production.

• These new controllers also had to be easily

programmed by maintenance and plant

engineers.

• The lifetime had to be long and programming

changes easily performed. They also had to

survive the harsh industrial environment

Page 14: Plc course presentation

• In the mid 70's the dominant PLC technologies

were sequencer state-machines and the bit-

slice based CPU.

• The AMD 2901 and 2903 were quite popular in

MODICON and A-B PLCs.

• As conventional microprocessors evolved,

larger and larger PLCs were being based upon

them.

• Communications abilities began to appear in

approximately 1973. The first such system

was MODICON's MODBUS.

Page 15: Plc course presentation

• The 80's saw an attempt to standardize

communications with General Motor's

manufacturing automation protocol (MAP).

• It was also a time for reducing the size of the

PLC and making them software programmable

through symbolic programming on personal

computers instead of dedicated programming

terminals or handheld programmers.

• Today the world's smallest PLC is about the

size of a single control relay.

Page 16: Plc course presentation

• The 90's have seen a gradual reduction in

introducing new protocols, and modernization

of the physical layers of some of the more

popular protocols that survived the 1980's.

• The latest standard (IEC 1131-3) has tried to

merge PLC programming languages under one

international standard.

• We now have PLCs that are programmable in

function block diagrams, instruction lists, C

and structured text, at the same time PC's are

also being used to replace PLCs in some

applications.

Page 17: Plc course presentation

Chapter 2

Internal

Construction

of a PLC

Page 18: Plc course presentation

Power Supply Module

Central

Processing

Unit

Outputs

Interfacing

and

Multiplexing

Inputs

Interfacing

and

Multiplexing

Memory devices

ROM – RAM – EEPROM

A.C main supply

D.C main supply

to other modules

Communication link to personal

computer or programmer

Page 19: Plc course presentation
Page 20: Plc course presentation

1. Rack or mounting part.

2. Processor or central processing

unit (CPU).

3. Input assembly.

4. Output assembly.

5. Power supply.

6. Programming unit.

Page 21: Plc course presentation

Empty Rack

Page 22: Plc course presentation

Mounting a module

Page 23: Plc course presentation

Rack with modules

Page 24: Plc course presentation

Large scale modular type PLC system

Page 25: Plc course presentation

Large scale modular type PLC system

Page 26: Plc course presentation

Bricks or shoebox PLCs

Page 27: Plc course presentation

PLC main CPU unit

Page 28: Plc course presentation

PLC physical internal architecture

Page 29: Plc course presentation

Digital module

Page 30: Plc course presentation

time

Digital signal

voltage

Page 31: Plc course presentation

Analog modules

Page 32: Plc course presentation

time

Analog signal

voltage

Page 33: Plc course presentation

PLC handheld programming devices

Page 34: Plc course presentation

Memory

Input Output

interface interface

CPU

input image output image

memory memory

Input Output

port s ports

Page 35: Plc course presentation
Page 36: Plc course presentation

Input/ output

unit

Data RAM

System ROM

CPUUser

program RAM C

lock

Bat

tery

Address Bus

Control Bus

Data Bus

I/O system Bus

Buffer Latch

Opto-coupler

Driver interface

Drivers

PLC internal architecture

Page 37: Plc course presentation

Input/Output Unit

• The input/output unit provides the interface

between the PLC system and the outside

world allowing the connections to be made

through input/output channels to input

devices such as sensors or output devices

such as motors and solenoids.

• The input/output provides isolation and

signal conditioning.

Page 38: Plc course presentation

Electrical isolation from the external world is

usually done by means of optoisolators or

optocouplers whose circuitry is displayed :

Light emitting photo

diode transistor

Optoisolator

Page 39: Plc course presentation

PLC Optocoupler

Input Signal

to PLC

to CPU

Protection

diode Voltage

divider

circuit

Basic D.C circuit for PLC

Page 40: Plc course presentation

• The signal isolation enables supplying

the input channels of the PLCs with a

wide range of input signals.

• The range of input signals might be :

5 V , 24 V , 110 V and 240 V in the

form of ON/OFF or digital / discrete

signals.

Page 41: Plc course presentation

Input

channel

5 V

24 V

110 V

240 V

To input/output unit

5 volt digital

signal level

Input signal level of a PLC

Page 42: Plc course presentation

Output are often specified to be in

one of the following forms :

1. Relay type.

2. Transistor type.

3. Triac type.

Page 43: Plc course presentation

Relay Type

• In such a type, the output signal from the

PLC operates a relay which switches

small current in the external circuit and

isolates the PLC from the external circuit

that having larger currents.

• Since the relay outputs are relatively

slow, thus it would be suitable for A.C

and D.C switching.

Page 44: Plc course presentation

PLC

Relay

Relay type output

output

Page 45: Plc course presentation

Transistor Type

• In such a type, a transistor is to be used to

switch current in the external circuit.

• This type of output gives faster switching and

being restricted to the D.C switching.

• It is destroyed by over currents or high

reverse voltages therefore; a protection is

used in the form of either a fuse or a built-in

electronic protection.

• Also, the optoisolators are used to provide the

essential isolation.

Page 46: Plc course presentation

Optocoupler Fuse Output

PLC

Basic form of transistor type output

Page 47: Plc course presentation
Page 48: Plc course presentation

Triac Type

• Such type can be used with optoisolators

to control the external loads which are

connected to an A.C power supply.

• So, such type is strictly being used with

A.C and must be protected by fuses

against over currents.

Page 49: Plc course presentation
Page 50: Plc course presentation

24 V, 100mA

240 V, 1A, A.C

240 V, 2A, A.C

Output

channel

110 V, 1A, A.Cfrom input/output unit

5 volt digital

PLC output levels

Page 51: Plc course presentation

Chapter 3

Sequential

Control

Systems

Page 52: Plc course presentation

Continuous Control

• In continuous control systems the inputs

are sending information into the system

all the time and the outputs of the

system are being controlled all the time.

• A change to the input leads directly to a

change in the output.

• An example of this kind of system is a

security floodlight that comes on in the

dark.

Page 53: Plc course presentation
Page 54: Plc course presentation

Sequential Control

In a sequential control system a

series of different events takes

place one after the other.

The finishing of one event in the

sequence provides the signal for the

next event to start.

Page 55: Plc course presentation

Examples of sequential systems :

1. The timers that control

central heating systems.

2. Washing machines.

3. Traffic lights.

4. Lifts in buildings

Page 56: Plc course presentation

Examples of sequential control systems

Page 57: Plc course presentation

Sometimes one of the events in the

sequence is itself a continuous control

system. For example, filling a washing

machine with water uses a continuous

control system that monitors the water

level and controls the water input valves.

Page 58: Plc course presentation

However this is only one event in the series of

events that makes up the complete sequential

control system for the washing machine. It

will be started by the event that comes before

it and, when the machine is full, it will start

the next event off.

Page 59: Plc course presentation

Conventional sequential control systems

usually adopt a centralized control approach,

and usually being implemented using

programmable controllers (PLCs).

This results in a wiring layout that becomes

complex as the number of devices increases

where complex bundles of wires are always

seen in PLC control systems due to the point-

to-point connections from all the I/O devices

to the PLC.

Page 60: Plc course presentation

Types of Sequential Systems

1. Asynchronous systems.

2. Synchronous systems.

3. Mixed systems.

Page 61: Plc course presentation

Asynchronous Systems

Such systems are event-based, which

means that a control action begins only

after the previous control action is

successfully completed.

In an asynchronous control system all of

the events in the sequence take place as

a result either due to an external event or

because the previous event has finished,

regardless of the time taken.

Page 62: Plc course presentation

Asynchronous systems require sensors to detect

the completion of an event or an outside event and

so must be closed loop.

The control system for a lift is asynchronous where

the sequence of events depends entirely on

external events (people pressing the call buttons

outside the lift, and the floor buttons inside it) or

the completion of lift movements (the lift stops

moving, and the doors are opened, when a switch

detects that a floor has been reached).

Page 63: Plc course presentation

Lift as an asynchronous sequential system

Page 64: Plc course presentation

Synchronous Systems

These systems are time-based, that

is, the system is driven by a clock

producing pulses at fixed intervals.

These pulses trigger the sequence of

control actions.

In a fully synchronous control system

all of the events in the sequence take

place at set points in time,

regardless of any external change.

Page 65: Plc course presentation

Synchronous control systems are

used where the control of a

sequence of events must take place

at pre-set time intervals.

Such a system doesn’t take any

account of events outside it, only the

time between events is important.

Therefore it doesn’t need any

sensors; it is an open loop control

system.

Page 66: Plc course presentation

Central heating timers are synchronous

controllers where the points at which the

heating and hot water systems are turned

on and off are fixed in time.

It should be noticed that, although once the

heating or hot water is turned on, that part

of the sequence is usually a continuous

system where temperature is continuously

monitored to control the heating system.

Page 67: Plc course presentation

Central heating as a synchronous

sequential system

Page 68: Plc course presentation

Mixed Systems

In most real sequential control systems

there is a mixture of synchronous and

asynchronous control. For example :

• Modern traffic light sets.

• A car burglar alarm.

• An automatic car park barrier.

• A microwave oven.

• A dishwasher

• A time lock on a bank’s safe.

• A robot arm welding parts of a car

together.

Page 69: Plc course presentation

Implementation of Synchronous

Systems

The heart of a synchronous control

system is some kind of timer. This

timer can be mechanical or

electronic. The timer also needs :

1. A sequencing element that sets the

times at which outputs are switched

on and off. Remember that there are

no external inputs into a synchronous

timer.

2. An output stage that provides the

start and stop signals.

Page 70: Plc course presentation

The timer may be :

1.Mechanical timer.

2.Electronic timer.

3.Microcontroller.

Page 71: Plc course presentation

Mechanical Timer

All mechanical timers are

different kinds of cam timer, in

which a motor turning at a

constant speed is used to turn

lots of cams, as the cams turn

they push on switches to turn

them on or off.

Page 72: Plc course presentation

Mechanical cam timers

Page 73: Plc course presentation

Electronic Timer

• A dedicated circuit uses an oscillator

to give electronic clock pulses. Its

circuitry often involving the use of

logic gates which is then used to

control a sequence of switching.

• Programmable Logic Controllers

(PLCs) are commonly used in industry,

where a PLC contains the same kind

of microprocessor as a computer

Page 74: Plc course presentation

PLC as an electronic timer

Page 75: Plc course presentation

Microcontroller

• It is a computer on a chip with an integrated

circuit that has all of the main bits of a computer

system in it.

• The timing sequence is usually programmed from

a computer before the microcontroller is placed in

the device to be controlled.

• Microcontrollers are used in mass production

because they are very cheap, also, the modern

washing machines and central heating systems

often use microcontrollers.

Page 76: Plc course presentation

Microcontroller as an electronic timer

Page 77: Plc course presentation

Sequential Function Charts

(SFCs)

• Many systems have sequential operation

requirements and Sequential Function

Charts (SFC’s) have become a popular

method of accurately specifying sequential

control requirements.

• It has long been established as a means of

designing and implementing sequential

control systems utilizing PLCs.

Page 78: Plc course presentation

Many manufacturers offer program-ming

environments that allow engineers to

program controllers using graphical

methods.

SFC’s have many advantages for software

development both in the design stage as

well as the implementation, testing,

maintaining and fault finding stages.

Page 79: Plc course presentation

In design stage :

• Detailed clear graphical specification.

• Non software people can specify or

verify programs.

In implementation and testing :

• Straight forward conversion from

specification to code .

• Structured testing or debugging.

Page 80: Plc course presentation

In maintenance of software :

• Readily understood by engineer

modifying software.

In machine maintenance :

• Allows quick accurate fault

diagnosis.

Page 81: Plc course presentation

Sequential function charts break a

sequential task down into steps

called transitions and actions.

These are drawn graphically to

describe a sequence of interactions.

Convention states that flow through

an SFC is from top to bottom unless

indicated by an arrow.

Page 82: Plc course presentation
Page 83: Plc course presentation

The sequence is broken down into

steps (or states) where actions are

carried out.

The transition conditions define

logical conditions that cause the

process to move from the existing

step to the next step. Actions

contain three fields

Page 84: Plc course presentation

An action consists of a qualifier

which defines what type of action,

for example S for set, R for reset and

N for continuous while in step.

As the design progresses more detail

can be added such as address

information as follows :

• Memory (%M)

• Input (%I)

• Output (%Q)

Page 85: Plc course presentation
Page 86: Plc course presentation

Example

To illustrate the use of SFCs and how

they may be implemented, consider

the following simple example where

two pistons have to be controlled

using a PLC.

The operation requirements are as

follows :

Page 87: Plc course presentation

1. When a normally open switch (%I0.7) is

closed momentarily and both pistons are

home the following sequence should occur :

• Piston A has to be extended.

• When A is extended piston B is

extended.

• After B is extended for 3 seconds

piston B is retracted.

• When B is retracted piston A is

retracted.

Page 88: Plc course presentation

2.The sequence does not operate

until the switch is closed again i.e.,

it operates every time the switch is

closed and if piston A is in its

home position.

Page 89: Plc course presentation
Page 90: Plc course presentation
Page 91: Plc course presentation

In some cases, the PLC has to start

and follow two branches separately

and simultaneously as follows :

Page 92: Plc course presentation

Chapter 4

Input / Output

Devices

Page 93: Plc course presentation

Input / Output Devices

The input/output devices (I/O) used

with PLCs are different in type and

usage where it might be analog or

digital devices.

The I/O system provides the physical

connection between the equipment

and the PLC. Opening the doors on

an I/O card reveals a terminal strip

where the devices connect.

Page 94: Plc course presentation
Page 95: Plc course presentation

There are many different kinds of I/O

cards which serve to condition the type

of input or output so the CPU can use it

for it’s logic. It's simply a matter of

determining what inputs and outputs

are needed, filling the rack with the

appropriate cards and then addressing

them correctly in the CPUs program.

Page 96: Plc course presentation

Typical input devices used with PLCs

include :

1. Mechanical switches for position

detection.

2. Proximity switches.

3. Photoelectric switches.

4. Encoders.

5. Temperature & pressure switches.

Page 97: Plc course presentation

6. Potentiometers.

7. Linear variable differential Tr.

8. Strain gauges.

9. Thermistors.

10. Thermotransistors.

11. Thermocouples.

Page 98: Plc course presentation

On the other hand, typical output

devices used with PLCs include :

1.Relays.

2.Contactors.

3.Solenoid valves.

4.Motors.

Page 99: Plc course presentation

Input devices

• A digital input card handles

discrete devices which give a

signal that is either on or off such

as a pushbutton, limit switch,

sensors or selector switches.

• An analog input card converts a

voltage or current (e.g. a signal

that can be anywhere from 0 to

20mA) into a digitally equivalent

number that can be understood by

the CPU.

Page 100: Plc course presentation

Digital or discrete sensors or on/off

sensors are considered input devices and

can easily be connected to the input

ports of the PLCs.

The input devices that give an analog

signal must be converted into digital

ones before inputting them to the PLC.

The following is a brief description for

each type of common input devices to be

used with PLCs.

Page 101: Plc course presentation
Page 102: Plc course presentation

Mechanical switches

• A mechanical switch generates an

on/off signal due to some mechanical

input causing the switch to be opened

or closed, e.g, a cam or an arm.

• The presence of the mechanical input

leads to closing the switch or giving

level 1 to the PLC.

• On the other hand, the absence of it

leads to opening the switch or giving

level 0 to the PLC.

Page 103: Plc course presentation

Workpiece present 1

Workpiece absent 0

Supply

Voltage

Input

channel

PLC

Supply

Voltage

PLC

Input

channel

Workpiece present 0

Workpiece absent 1

Page 104: Plc course presentation

The mechanical switches may take one

of the following forms :

1.Normally opened contact NOC :

such switch has its contacts opened

at the absence of the mechanical

input, however that input is used to

close the switch contacts.

2. Normally closed contact NCC:

such switch has its contacts closed

at the absence of the mechanical

input, however that input is used to

open the switch contacts.

Page 105: Plc course presentation

3.Limit switches : these switches

are used to detect the presence

or passage of moving parts, e.g,

in case of lifts. It may be

actuated by a cam, roller or a

lever

Rotating cam

Page 106: Plc course presentation

Lever pushed

down for contact

Button to operate the

switch

Page 107: Plc course presentation

Roller pushed down

for contact

Page 108: Plc course presentation

For example the limit switches are used to

detect the presence or passage of a movable

mechanical object such as :

• Rotary cam actuated type.

• Roller actuated type.

• Lever actuated type.

Page 109: Plc course presentation

Proximity switches

The proximity switches are used to

detect the presence of an item without

making contact with it.

The forms of the proximity switches are :

1. Eddy current type.

2. Inductive type.

3. Reed type.

4. Capacitive type.

Page 110: Plc course presentation

1.Eddy current proximity switch : this

type has a coil supplied with constant

A.C and produces constant magnetic

field.

When a metallic object is close to that

coil, an eddy current will be induced in it.

Due to the eddy current a back e.m.f will

be induced in the original coil which will

affect the amplitude of its voltage.

The voltage amplitude can then be used

as a measure to indicate the distance

between the coil and the metallic object.

Page 111: Plc course presentation

The voltage variation is used to activate

an electronic circuit comprising a

transistor, i.e, making that circuit on or off

according to the distance of the metallic

object. This conduction distance ranges

between 0.5 and 20 mm.

Metal object

Alternating magnetic field

Eddy current

Constant

alternating

current

Page 112: Plc course presentation

2. Inductive proximity switch : this type has

a coil wound on a ferrous core.

When one end of the core is being near a ferrous

object, there will be a change in the coil

inductance .

The inductance change can be monitored using a

resonant circuit, where the current in that circuit

may be used to activate an electronic switch

circuit to give an on/off device. The range of

detecting objects is from 2 to 15 mm.

Page 113: Plc course presentation

3.Reed proximity switch : this type is

consisting of two overlapping non-

touching strips of springy ferromagnetic

material sealed in a glass or plastic

envelope

Page 114: Plc course presentation

4.Capacitive type :

Page 115: Plc course presentation
Page 116: Plc course presentation

Features of Proximity Sensor

1. Stable operation, unsusceptible to water, oil,

dust, light, etc.. :

Be able to use for machine tools splashed

with cutting oil or food processing machine

washed with water (magnetic type).

2. Resistant to vibration and shock :

Anti-vibration/shock since the whole circuit

can be coated with resin.

Page 117: Plc course presentation

3. Able to detect without any contact :

Detection distance is bout 0-30mm. No

damage on an object.

4. Higher speed/performance compared with

limit switch :

Long life and quick response.

5. Magnetic type is for metal detection,

capacitance is for everything except fluid :

Liquid in a paper cup can be also detectable.

Page 118: Plc course presentation

6. Susceptible to magnet effect :

High possibility of malfunction in an area

where large amount of electric current flows

such as

welding or electro magnetism.

Page 119: Plc course presentation

Photoelectric switches

Transmissive type

Reflective type

Page 120: Plc course presentation
Page 121: Plc course presentation

TLS 220 - Light to frequency converter

Page 122: Plc course presentation

Encoders

Led

Incremental encoder

Page 123: Plc course presentation

Incremental

Encoders

Page 124: Plc course presentation

3-bit absolute encoder

Page 125: Plc course presentation

Absolute encoders

Page 126: Plc course presentation

Temperature and Pressure

switches

Temp- bimetallic strip

Page 127: Plc course presentation

Resistive

temperature

detector

Page 128: Plc course presentation

Thermo diodes and

thermotransistors

Thermmotransistor

sensor LM3911N

Page 129: Plc course presentation

Thermocouple

Page 130: Plc course presentation

Poteniometers

or Displacement sensors

Linear or rotary

poteniometers

Linear potentiometer

displacement sensor

Page 131: Plc course presentation

Linear Variable Differential

Transformers

Page 132: Plc course presentation

Linear Variable Differential Transformer

(LVDT) sensor

Page 133: Plc course presentation

Strain gauges

Metal foil strain

gauges

Wheatstone bridge

circuit

Page 134: Plc course presentation
Page 135: Plc course presentation
Page 136: Plc course presentation

Force sensing strain gauges

Page 137: Plc course presentation

Pressure sensing strain gauges

Page 138: Plc course presentation

Pressure Sensors

Piezoelectric

pressure sensor

MPX100AP

pressure sensor

Page 139: Plc course presentation

Pressure switches

Page 140: Plc course presentation

Liquid level detector

Page 141: Plc course presentation

Fluid flow measurement

Orifice flow meter

Page 142: Plc course presentation

Keypads

12-way keypad

Page 143: Plc course presentation

Output devices

• Output devices can also consist

of digital or analog types.

• A digital output card either

turns a device on or off such as

lights, LEDs, small motors, and

relays.

Page 144: Plc course presentation

• An analog output card will

convert a digital number sent by

the CPU to it’s real world

voltage or current.

• Typical outputs signals can

range from 0 - 10 V D.C or 4 - 20

m.A and are used to drive mass

flow controllers, pressure

regulators and position controls.

Page 145: Plc course presentation

Types of Output Devices

1.Contactors .

2.Control Valves .

a. Types of valves .

b. Actuation of valves .

c. Cylinders : single and double acting .

3.Motors .

a. D.C motors .

b. Induction motors .

c. Stepper motors .

Page 146: Plc course presentation

Contactors

Page 147: Plc course presentation

Two position valve

The 4/2 valve

2/2 Valve : flow from P to A

switched to no flow

A

P

A

P T

3/2 Valve : flow from P to A and

from A to T switched to T being

closed and flow from P to A

Control

Valves

Page 148: Plc course presentation

Directional control valves

A – Piston with no current

A current through the

solenoid pulls to the right,

with no current the spring

pulls back to the left

Page 149: Plc course presentation

Directional control valves

A – Piston with current

Page 150: Plc course presentation

Actuation

Solenoid

Push button

Spring

operated

Page 151: Plc course presentation

Cylinders

Single acting

cylinder

Double acting

cylinder

Page 152: Plc course presentation

(a) - Cylinder in retracted position

Control of a single–acting cylinder

Page 153: Plc course presentation

(b) - Current to solenoid cylinder extends

Page 154: Plc course presentation

(c) - Solenoid current switched off

Cylinder retracts

Page 155: Plc course presentation

(a) - Cylinder in retracted position

Control of a double–acting cylinder

Page 156: Plc course presentation

(b) - Solenoid A energized,

cylinder extends

Page 157: Plc course presentation

(c) - Solenoid B energized,

cylinder retracts

Page 158: Plc course presentation

Motors

Basic elements of D.C motors

Page 159: Plc course presentation

On – Off control of D.C motors

Page 160: Plc course presentation

Direction control of D.C motors

Page 161: Plc course presentation

Brushless D.C motors

Page 162: Plc course presentation

Induction motors

Page 163: Plc course presentation

Stepper motors

Page 164: Plc course presentation

Linear positioning using stepper motors

Page 165: Plc course presentation

Variable reluctance stepper motors

Page 166: Plc course presentation

Drive system for a four-phase

stepper motor

Page 167: Plc course presentation

Input and outputs of the drive system

for a four-phase stepper motor

Page 168: Plc course presentation

Drive circuit connections with an

integrated circuit for stepper motors

Page 169: Plc course presentation

Examples

Conveyor system

Page 170: Plc course presentation

Pneumatic door opening system

Page 171: Plc course presentation

Chapter 5

PLC

Networking

Page 172: Plc course presentation

PLC Networks

• Necessity

• Types :

1.Bus/single highway network

2.Star network

3.Ring network

• Standards :

Layer 1 … … … … Layer 7

• Protocol

• PLC operation and scans

• Addressing

Page 173: Plc course presentation

Why communication networks

• Less Expensive

• Less Physical Space Required

• Simple Installation

• More Information Available at Lower Cost

• More Adaptable to Changes

• Future Expansion

• Easier Troubleshooting

• Easier PLC Programming

Page 174: Plc course presentation

Automation & Control System Hierarchy

Page 175: Plc course presentation

Data Networks

Data Networks extend the information capabilities

Page 176: Plc course presentation

Control Networks

Control Networks require critical performance

Page 177: Plc course presentation

Device / Field Bus

Device Buses incorporate intelligent devices.

Page 178: Plc course presentation

Sensor / Actuator Bus

Sensor Actuator Buses are bit level oriented

Page 179: Plc course presentation

Networking types

a.Bus/single highway network :

Terminals

Bus/single highway

Page 180: Plc course presentation

b.Star network :

Host

Terminals

Page 181: Plc course presentation

c.Ring network :

Terminals

Page 182: Plc course presentation

Plant

computer

Supervisory

PLCPLCPLCComputer

I/OI/O

I/O

I/OI/O

Supervisory

Robot PLC

I/OI/O

PLC

I/O

Control hierarchy

Page 183: Plc course presentation

Network Standards

Layer 7

Application

Layer 6

Presentation

Layer 5

Session

Layer 4

Transport

Layer 3

Network

Layer 2

Data Link

Layer 1

Physical medium

Layer 7

Application

Layer 6

Presentation

Layer 5

Session

Layer 4

Transport

Layer 3

Network

Layer 2

Data Link

Layer 1

Physical medium

Application

Program

Application

Program

Transmission

Path ISO/OSI

model

Page 184: Plc course presentation

PLC Operation Scan

Scan all inputs

Updating all

outputs

Running the

program

Repeat

sequence

Page 185: Plc course presentation
Page 186: Plc course presentation

PLC Addressing

1. Mitsubishi PLC :

Inputs : X400 , X401 , X402 , … … etc

Outputs : Y430 , Y431 , Y432 , … … etc

2. Toshiba PLC :

Inputs : X000 , X001 , X002 , … … etc

Outputs : Y000 , Y001 , Y002 , … … etc

Page 187: Plc course presentation

3. Allen Bradley :

I = input

O = output

Rack

number

Terminal

number

Module

number

x : xxx / xx

Examples : I : 03 4 / 12

O: 00 2 / 05

Page 188: Plc course presentation

4. Siemens SISMATIC S5 :

I = input

Q = output

Byte

number

Bit number

X xx . x

Examples : I 1.4

Q2.1

Page 189: Plc course presentation

PLC Hardwiring

There are three types of wiring associated with

a PLC namely :

The PLC wiring.

The device wiring.

The common (or return) wiring.

PLC Wiring :

The PLC has built-in input interfaces in both

the 16 and 32 I/O models. Since the input

interface is already wired to the PLC, input

wiring is easy and quick.

Page 190: Plc course presentation

Device Wiring :

Input devices can be wired to a 120

VAC input interface in one of two

ways:

•They can be wired directly to the

interface.

•They can be wired to a terminal block

that is wired to the interface.

Page 191: Plc course presentation

• If an input device is wired directly

to a PLC input interface, then one

side of the device should be wired

to the L1 hot line of the incoming

AC power source. The other side

should be wired to an input

terminal on the PLC.

Page 192: Plc course presentation

An input device wired directly to

a PLC input interface.

120 V AC line

L1

Page 193: Plc course presentation

If an input device is wired to a terminal

block instead of directly to the PLC

interface, then the line going out of the

input device should be wired to the

terminal block. The block, in turn, should

be wired to the PLC. In PLC applications,

the wiring of devices through a terminal

block is more common than wiring them

directly to the PLC.

Page 194: Plc course presentation

120 V AC line

L1

An input device wired to a PLC via a terminal

block.

Page 195: Plc course presentation

Common Wiring :

Each input device connected to a PLC’s 120

VAC input interface must also be connected

to the AC return line, called the L2 common

line.

The device must have this common

connection for its electrical circuit to be

complete.

The input terminals on a 120 VAC interface

are arranged in two groups with each group

sharing a connection to the common line.

Page 196: Plc course presentation

In a 10-input PLC, the first four input terminals

share one common connection, and the last six

share another.

Page 197: Plc course presentation

In a 20-input model, the first four inputs

again share one common connection,

while the last sixteen share another

Page 198: Plc course presentation
Page 199: Plc course presentation
Page 200: Plc course presentation

24 V DCOutput Card

V+

00

01

02

03

04

05

06

07

24 V lamp

Relay

+24 V DC

Power

120 V AC

Power

Motor

Supply

Supply

Neut.

COM

Page 201: Plc course presentation

24 V DCOutput Card

V+

00

01

02

03

04

05

06

07

24 V lamp

Relay

+24 V DC

Power

120 V AC

Power

Motor

Supply

Supply

Neut.

COM

Page 202: Plc course presentation

24-Volt DC input interfaces

Two types of DC input devices are used

with PLCs:

• Sourcing devices provide current

when they are ON.

• sinking devices receive current

when they are ON.

Page 203: Plc course presentation

Sourcing devices

Page 204: Plc course presentation

Sourcing devices

Page 205: Plc course presentation

Sinking devices

Page 206: Plc course presentation

AC wiring of a PLC

Page 207: Plc course presentation

DC input unit

Page 208: Plc course presentation

AC input unit

Page 209: Plc course presentation

A/D converter

Multiplexer

D/A converter (DAC)

Page 210: Plc course presentation

Relay output unit

Page 211: Plc course presentation

Transistor output unit

Page 212: Plc course presentation

Triac output unit

Page 213: Plc course presentation

Signal Conditioning

• The potential divider can be used to reduce the

voltage from the sensor to the required level

such that :

in

21

2 V . R R

R

outV

Vin

Vout

R1

R2

Page 214: Plc course presentation

• Amplifiers can be used to increase the voltage

level using the Op Amps in one of three forms :

in

1

2 V . R

R outV

A : inverting

amplifier

Page 215: Plc course presentation

in

1

21 V . R

R R

outV

B : non-inverting

amplifier

Page 216: Plc course presentation

)V - (V . R

R 12

1

2outV

C : differential

amplifier

Page 217: Plc course presentation

Signal conditioning with

a strain gauge sensor

Page 218: Plc course presentation

Use of remote

input/output modules

Page 219: Plc course presentation

Use of remote

input/output PLC systems

Page 220: Plc course presentation

Chapter 6

PLC

Programming

Page 221: Plc course presentation

Programming Rules

• Programs for microprocessor-based

controllers usually being loaded in

machine code as binary numbers and

representing the instructions.

• Assembly language can be used in

the form of mnemonics to indicate

the operations, e.g : LD , OUT , OR , …

… etc.

Page 222: Plc course presentation

PLC Programming Methods

1. IL (Instruction List Programming) :

This is effectively mnemonic

programming.

2. ST (Structured Text) - A BASIC like

programming language.

3. LD (Ladder Diagram) - Relay logic

diagram based programming.

Page 223: Plc course presentation

4. FBD (Function Block Diagram) - A

graphical dataflow programming

method

5. SFC (Sequential Function Charts) -

A graphical method for structuring

programs

Page 224: Plc course presentation

Relay Ladder Logics (RLL)

• Ladder logic is a drawing of

electrical logic schematics which

results from the usage of relays.

• It is now a graphical language very

popular for programming PLCs,

where sequential control of a

process or manufacturing operation

is simulated.

Page 225: Plc course presentation

Motor stop – start circuit

L1 L2

1

2

M

Holding switch

Page 226: Plc course presentation

• Its name is based on the observation that

programs are resembled by ladders, with

two vertical rails and a series of horizontal

rungs between them.

• Generally, manufacturers of programmable

logic controllers provide associated ladder

logic programming systems. However, the

ladder logic languages from two

manufacturers will not be completely

compatible.

Page 227: Plc course presentation

• Even different models of programmable

controller within the same family may

have different ladder notation such that

programs cannot be interchanged

between models.

• Ladder logic can be thought of as a

rule-based language, rather than a

procedural language. A rung in the

ladder represents a rule.

Page 228: Plc course presentation

• When implemented in a program-

mable logic controller, the rules are

typically executed sequentially by

software, in a continuous loop

(scan).

• However, proper use of programma-

ble controllers requires understand-

ing the limitations of the execution

order of rungs.

Page 229: Plc course presentation
Page 230: Plc course presentation

Scanning the ladder program

END

Page 231: Plc course presentation

RELAY LADDER LOGIC

PROGRAMS & PROGRAMMING

The LD language itself can be considered

as a set of connections between logical

checkers (contacts) and actuators (coils)

such that :

If a path can be traced between the left

side of the rung and the output, through

asserted (true or closed) contacts, the

rung is true and the output coil storage

bit is asserted (1) or true.

Page 232: Plc course presentation

If no path can be traced, then the

output is false (0) and the coil by

analogy to electromechanical relays is

considered de-energized

So, one can say that, ladder logic has

contacts that make or break circuits to

control coils. Each coil or contact

corresponds to the status of a single

bit in the programmable controller's

memory.

Page 233: Plc course presentation

The contacts may refer to physical hard

inputs to the programmable controller

from physical devices such as

pushbuttons and limit switches via an

integrated or external input module, or

may represent the status of internal

storage bits which may be generated

elsewhere in the program.

Page 234: Plc course presentation

The coil (output of a rung) may represent a

physical output which operates some device

connected to the programmable controller, or

may represent an internal storage bit for use

elsewhere in the program.

Each rung of ladder language typically has one

coil at the far right. Some manufacturers may

allow more than one output coil on a rung. On

the other hand, several contacts may be used

in different logic arrangements may be used at

the beginning of the rung to represent the

inputs.

Page 235: Plc course presentation

115 VACw a l l p l u g

r e l a y l o g i c

i n p u t A( n o r m a l l y c l o s e d )

i n p u t B( n o r m a l l y o p e n )

o u t p u t C( n o r m a l l y o p e n )

l a d d e r l o g i c

A B C

Page 236: Plc course presentation

l a d d e r

p o w e rs u p p l y

+ 2 4 V

c o m .

i n p u t s

o u t p u t s

p u s h b u t t o n s

l o g i c

P L C

A C p o w e r

115 Vac

n e u t .

A B C

l i g h t

Page 237: Plc course presentation

Each program is a set of rungs that

reveals the sequence of the

operations in the controlled process.

H O T N E U T R A L

I N P U T S O U T P U T S

A B X

C D

E F

G

H

Y

N o t e : P o w e r n e e d s t o f l o w t h r o u g h s o m e c o m b i n a t i o n o f t h e i n p u t s

( A , B , C , D , E , F, G , H ) t o t u r n o n o u t p u t s ( X , Y ) .

Page 238: Plc course presentation

LD contacts & their types

As mentioned before, the contacts may

refer to physical hard inputs to the

programmable controller from physical

devices such as pushbutton switches,

selector switches and limit switches via an

integrated or external input module, or may

represent the status of internal storage

bits which may be generated elsewhere in

the program

Page 239: Plc course presentation

disconnect circuit interrupter

breaker (3 phase AC)

normally openlimit switch

normally closedlimit switch

normally openpush-button

normally closedpush-button double pole

push-buttonmushroom headpush-button

(3 phase AC) (3 phase AC)

Page 240: Plc course presentation

Normally Open Contact (NOC)

This can be used to represent any input to

the control logic such as : a switch or

sensor, a contact from an output, or an

internal output. When solved, the

referenced input is examined for an ON

(logical 1) condition :

Page 241: Plc course presentation

• If it is ON, the contact will close

and allow power (logic) to flow

from left to right.

• If the status is OFF (logical 0), the

contact is Open, power (logic)

will NOT flow from left to right.

Page 242: Plc course presentation

Normally Closed Contact (NCC)

When solved, the referenced input is

examined for an OFF condition :

• If the status is OFF (logical 0) power

(logic) will flow from left to right.

• If the status is ON, power will not

flow.

Page 243: Plc course presentation

LD coils & their types

Also, the coils (output of a rung) may

represent a physical output which

operates some device connected to the

programmable controller such as solenoid

valves, lights, motor starters and servo

motors, or may represent an internal

storage bit for use elsewhere in the

program.

Page 244: Plc course presentation

Normally Open Coil

This can be used to represent any discrete

output from the control logic. When solved :

• If the logic to the left of the coil is

TRUE, the referenced output is ON

(logical 1).

• If the logic to the left of the coil is

FALSE, the referenced output is OFF

(logical 0).

Page 245: Plc course presentation

Normally Closed Coil

This can be used to represent any discrete

output from the control logic. When solved :

• If the logic to the left of the coil is TRUE,

the referenced output is OFF (logical 0).

• If the logic to the left of the coil is FALSE,

the referenced output is ON (logical 1)

Page 246: Plc course presentation

To identify an input or an output in a

program, a numbering system is used. This

numbering system has three purposes :

• To tell contacts apart in the program.

• Serves as an address for the location

of the input module in the real world.

• Serves as a memory address for the

contact in the processor memory.

Page 247: Plc course presentation

Solving a Single Rung

Suppose a switch is wired to Input1, and a light

bulb is wired through Output1 in such a way that

the light is OFF when Output1 is OFF, and ON when

Output1 is ON.

• When Input1 is OFF (logical 0) the contact

remains open and power cannot flow from left to

right. Therefore, Output1 remains OFF (logical 0).

• When Input1 is ON (logical 1) then the contact

closes, power flows from left to right, and

Output1 becomes ON (the light turns ON).

Page 248: Plc course presentation

Output1

Input1

controller

Load

Page 249: Plc course presentation

Examples

The AND rung

The AND is a logic condition where an

output is not energized unless two NOC are

closed.

Page 250: Plc course presentation

x400 x401Y430

Mitsubishi PLC

x000 x001Y000

Toshiba PLC notation

I0.1 I0.2Q2.0

Siemens PLC

Logic gate

control

output

inputs

A

B

Inputs

Output

A B

0 0 0

0 1 0

1 0 0

1 1 1

Address Instruction Data

0 LOAD IN1

1 AND IN2

2 OUT OUT1

3 END

Page 251: Plc course presentation

The OR rung

The OR is a logic condition where an

output is energized when one or both of

two NOC are closed.

Page 252: Plc course presentation

Logic gate

control

output

inputs

A

B

Inputs

Output

A B

0 0 0

0 1 1

1 0 1

1 1 1

Address Instruction Data

0 LOAD IN1

1 OR IN2

2 OUT OUT1

3 END

x400

x401

Y430

Mitsubishi PLC

x000

x001

Y000

Toshiba PLC

I0.1

I0.2

Q2.0

Siemens PLC

Page 253: Plc course presentation

The NOT rung

The NOT is a logic condition where an

output is de-energized when a NCC is

opened.

Output1

Input1

controller

Load

Page 254: Plc course presentation

Logic gate

control

output

inputs

A

Inputs

Output

A

0 1

1 0

Address Instruction Data

0 LOAD IN1

1 NOT IN1

2 OUT OUT1

3 END

x400Y430

Mitsubishi PLC

I0,1O0,0

Telemecanique PLC

I0.1Q2.0

Siemens PLC

Page 255: Plc course presentation

The NAND rung

The NAND is a logic condition where an

AND gate is followed by a NOT gate or

putting a NOT gate on each input of an OR

gate as follows :

ANDA

BNOT

NOT

NOT

OR

A

B

Page 256: Plc course presentation

Inputs

Output

A B

0 0 1

0 1 1

1 0 1

1 1 0

Address Instruction Data

0 LOAD IN1

1 AND IN2

2 NOT

3 OUT OUT1

4 END

x400

x401

Y430

Mitsubishi PLC

x000

x001

Y000

Toshiba PLC

I0.1

I0.2

Q2.0

Siemens PLC

Page 257: Plc course presentation

The NOR rung

The NOR is a logic condition where an OR

gate is followed by a NOT gate or putting a

NOT gate on each input of an AND gate as

follows :

ORA

BNOT

NOT

NOT

AND

A

B

Page 258: Plc course presentation

Inputs

Output

A B

0 0 1

0 1 0

1 0 0

1 1 0

x400 x401Y430

Mitsubishi PLC

x000 x001Y000

Toshiba PLC notation

I0.1 I0.2Q2.0

Siemens PLC

Address Instruction Data

0 LOAD IN1

1 OR IN2

2 NOT

3 OUT OUT1

4 END

Page 259: Plc course presentation

The XOR rung

The XOR is a logic condition where an

output exists when either of the two inputs

is on but not when both are on follows :

OR

AND

NOT

NOTA

B

AND

Page 260: Plc course presentation

Inputs

Output

A B

0 0 0

0 1 1

1 0 1

1 1 0

Address Instruction Data

0 LOAD IN1

1 AND NOT IN2

2 LOAD NOT IN1

3 AND IN2

4 OR

5 OUT OUT1

x400 x401Y430

Mitsubishi PLCx400 x401

x000 x001Y000

Toshiba PLCx000 x001

I0.1 I0.2Q2.0

Siemens PLCI0.1 I0.2

Page 261: Plc course presentation

Latching

• Sometimes it is necessary to hold an

output energizes even when the input

is ended.

• An example is a motor starting and

stopping using push button, where

the latch circuit is used to keep the

motor running after the contacts of

the starting switch being opened.

Page 262: Plc course presentation

In 1

out

outIn 2

X400

Y430

Y430X401

X400

Y430

Y430

Motor output

X401

Y430

Y430

Y431

Y432

Lamp for No power

Motor On-off

with signal

lamps

Ladder circuit

Lamp for power ON

Page 263: Plc course presentation

Multiple Outputs Ladder Circuits

X400Y430

X401

Y431

X402Y432

Page 264: Plc course presentation

Ladder Programming Symbols

Several symbols are used to enter a ladder

program either using a the keypad of a

programming device with symbols or using a PC

software. The following are samples of such

symbols :

input output Start of a

junction

End of a

junction

Horizontal circuit link

Page 265: Plc course presentation

Instruction Lists

• The instruction list programming for a

PLC differs according to the type of

the used PLC.

• The following table shows the

different types of PLCs and the

corresponding instructions to be used

with them.

Page 266: Plc course presentation

Command

PLCs Types

IEC11

31-3

Mitsub

ishi

Omro

n

Sieme

ns

Telemec

anique

Sphere+

Schuh

Start a rung with

a NOC

LD LD LD A L STR

Start a rung with

a NCC

LDN LDI

LD

NOT

AN LN

STR

NOT

Series element

with a NOC

AND AND AND A A AND

Series element

with a NCC

ANDN ANI

AND

NOT

AN AN

AND

NOT

Parallel element

with a NOC

O OR OR O O OR

Parallel element

with a NCC

ORN ORI

OR

NOT

ON ON OR NOT

An Output ST OUT OUT = = OUT

Page 267: Plc course presentation

tw

o A

ND

b

lo

ck

s

Step Instruction

0 LD X400

1 OR X402

2 LD X401

3 OR X403

4 ANB

5 OUT Y430

Step Instruction

0 A(

1 A I0.0

2 O I0.1

3 )

4 A(

5 A I0.2

6 O I0.3

7 )

8 = Q2.0

Mitsubishi PLC

Siemens PLC

x400 x401Y430

x402 x403

I0.0 I0.1Q2.0

I0.2 I0.3

Page 268: Plc course presentation

Step Instruction

0 A I0.0

1 = Q2.0

2 AN I0.0

3 = Q2.1

Step Instruction

0 LD X400

1 OUT Y430

2 LDI X400

3 OUT Y431

Mitsubishi PLC

Siemens PLC

To

gg

le

c

irc

uit

x400Y430

x400Y431

I0.0Q2.0

I0.0Q2.1

Page 269: Plc course presentation

Boolean Algebra

• The instruction lists and ladder

diagrams can also been used to

represent mathematical operations

as follows :

• A . B = Q represents an AND circuit.

• A + B = Q represents an OR circuit.

• A = Q represents a NOT operation.

Page 270: Plc course presentation

Example

Consider the following expression :

A + B . C = Q

this tells that there is the term A or the

term B and C will give the output Q, the

corresponding ladder diagram is :

AQ

Siemens PLC

B C

Page 271: Plc course presentation

XOR Example

Considering the XOR gate below :

• the input to the upper AND is : A and B

and its output is : A . B

OR

AND

NOT

NOTA

B

AND

Q

Page 272: Plc course presentation

• the input to the lower AND is : A and B

and its output is : A . B

• Finally, the boolean expression for the

OR gate will be : Q = A . B + A . B

• The corresponding ladder diagram is :

A B

A BQ

Page 273: Plc course presentation

More Example

Considering the logic circuit shown below :

• the boolean expression for the circuit is :

(A . B + C) . D . E . F = Q

AND

A

B

OR

NOT

QANDNOT

C

D

E

F

Page 274: Plc course presentation

• The corresponding ladder diagram is :

C

DA B

QE F

Page 275: Plc course presentation

Programming Examples

1. A signal lamp is required to be on if :

A pump is running.

And

The pressure is satisfactory.

Or

The test lamp is closed.

Pump

X400

Presu.

X401

Lamp

Y430

Test

X402

Step Instruction

0 LD X400

1 AND X401

2 LD X402

3 ORB

4 OUT Y430

5 END

Page 276: Plc course presentation

2. A machine has 4 sensors to detect the

safety and is required to be off if :

Any of the sensors gives input.

when the machine is stop, an alarm is sound.

Step Instruction

0 LDI X400

1 ANI X401

2 ANI X402

3 ANI X403

4 OUT Y430

5 LD X400

6 OR X401

7 OR X402

8 OR X403

9 OUT Y431

10 END

X400

X401Mamchine

Y430

X400

X402

X403

X401

X402

X403

Alarm

Y431

Page 277: Plc course presentation

Chapter 7

Internal

Relays

Page 278: Plc course presentation

Definition

INTERNAL UTILITY RELAYS (contacts) : These do

not receive signals from the outside world nor do

they physically exist. They are simulated relays

and are what enables a PLC to eliminate external

relays. There are also some special relays that

are dedicated to performing only one task. Some

are always on while some are always off. Some

are on only once during power-on and are

typically used for initializing data that was stored.

They are built-in functions in the PLCs

Page 279: Plc course presentation

Input

Circuit

Output

Circuit

CPU

Memory

Input

Relays

Output

Relays

Internal

Utility

Relays

Co

unte

rs

Tim

ers

Data

Storage

Page 280: Plc course presentation

A PLC might have hundreds of internal

relays where some of them are battery

backed to ensure safe operation in case of

power failure.

Internal relays some times take different

names such as : auxiliary relays, markers,

flags, coils and bit storage .

To distinguish internal relays outputs from

physical relays outputs, they are given

different addresses such as :

Page 281: Plc course presentation

a.Markers : M100 , M101 , … etc for

Mitsubishi PLC.

b.Flags : F0.0 , F0.1 , … etc for Siemens

PLC.

c.Coils : C001 , C002 , … etc for

Sprecher+ PLC.

d.Bits : B0 , B1 , … etc for

Telemecanique PLC.

e.Internal relays : R000 , R001 , … etc

for Allen Bradley PLC.

Page 282: Plc course presentation

In ladder programming, internal relays

take the same symbols as the physical

outputs but with different addresses.

The most commonly usage of internal

relays is for latching circuits or for

checking purposes when energizing an

output under some conditions.

Page 283: Plc course presentation

Examples

1.Checking an output : Consider a system

whose output is activated when two

different sets of input conditions are

satisfied, the ladder describing such

case is : X400 X401 M100

X402

M100 X403 Y430

Step Instruction

0 LD X400

1 OR X402

2 AND X401

3 OUT M100

4 LD M100

5 AND X403

6 OUT Y430

7 END

Page 284: Plc course presentation

Step Instruction

0 LD X400

1 OR X401

2 OUT M100

3 LD X402

4 AND X403

5 OUT M101

6 LD M100

7 OR M101

8 OUT Y430

9 END

X400M100

X401

X402 X403 M101

M100

Y430

M101

Page 285: Plc course presentation

2.Latching Circuit : the second use of

internal relays is to reset a latch circuit

as shown in the next example :

X400 M100

Y430

X401

M100

Y430I0.0 F0.0

Q2.0

I0.1

F0.0

Q2.0

Page 286: Plc course presentation

3.Starting Multiple Outputs : the third

use of internal relays is to start a

circuit with multiple outputs as follows :

X400 X401

M100

M100 Y430

M100

X402 Y431

X403 Y432

Page 287: Plc course presentation

4.Battery-backed relays : for the latch

circuits, the internal battery-backed

relays are used to maintain the

operation of the output even when the

power is cut off.

X400

M300

M300

Y430

M300

Page 288: Plc course presentation

5.Setting and resting relays : the

internal relays are used also to set and

reset the operation of the output cycle

as follows :

X400

X401

Y430S

Y430R

X400

X401

Y430

LD X400

S Y430

LD X401

R Y430

Page 289: Plc course presentation

The set and reset circuit can be done in

several ways as follows :

I0.0

I0.1

S

Q2.0

R

X000

X001

S

Y020

R

Q

FF

R110

Siemens PLC Toshiba PLC

Page 290: Plc course presentation

Master Control Relay

The master control relay is used in the

ladder programming when a large number

of outputs are used or when it is needed to

divide the whole program into sections

M100

X402

X400

X401M100

Y430

Y431

M100MCR

Step Instruction

0 LD X400

1 OUT M100

2 MC M100

3 LD X401

4 OUT Y430

5 LD X402

6 OUT Y431

7 MC M100

8 END

Page 291: Plc course presentation

More than one master control relay :

Step Instruction

0 LD X400

1 AND X401

2 OUT M100

3 LD X402

4 AND X403

5 OUT M101

6 MC M100

7 LD X404

8 OUT Y430

9 MC M101

10 LD X405

11 OUT Y431

12 MCR M100

13 MCR M101

14 ..

15 ..

16 END

M100

M100X400

X404 Y430

X405 Y431

M101MCR

M101X402

X401

X403

M101

Page 292: Plc course presentation

Jump (program flow control )

The conditional jump instruction is used

to control the execution of the ladder

program such that :

1. When an input enables the jump, the

program will proceed starting from the

rung after the jump end and the rungs

that lie between the start of the jump and

its end will be ignored.

2. When there is no input to the jump, the

program will proceed in its original form

without ignoring any rungs.

Page 293: Plc course presentation

Examples

1. The following ladder shows a conditional jump

for a process such that a fan operates when

temp exceeds a some level , however, no

action takes place if temp is blow that level.

CJP 700

X402

X400

X401 Y430

Y431

EJP 700

Page 294: Plc course presentation

X401 Y430

X403 Y431

EJP 700

CJP 700

X400

CJP 701

X402

X404 Y432

EJP 701

X405 Y433

If X400If X402

Jump

within

jump

Page 295: Plc course presentation

Example (Central Heating)

Consider a central heating system with the

following features :

The boiler is thermostatically controlled and

supplies the radiator system in addition to a hot

water tank.

Pumps are used to supply hot water to either or

both the radiator and the tank according to the

desired sensors.

The whole system is controlled by a clock to

operate a certain time a day.

Page 296: Plc course presentation

Boiler Temp.

sensor

Motorized

Pump

M1

M2

Boiler

Motorized

Pump

Radiator

System

Room

Timers

Hot water tank

Temp. sensor

Hot water

tank

Page 297: Plc course presentation

The power circuit for the central heating

system is :

Stop

Run

Clock

Boiler sensor

Room sensor

Tank sensor

Power

Ou

tp

uts

Boiler

M1

M2

In

pu

ts

Page 298: Plc course presentation

The ladder & IL program for the central heating

system using Mitsubishi PLC is :

Inputs :

X400 Clock

X401 Boiler sensor

X402 Room sensor

X403 Tank sensor

Outputs :

Y430 Boiler

Y431 Pump M1

Y432 Pump M2

Page 299: Plc course presentation

X403

X402

X402 Y431

Y432

END

X400 X401

X403

Y430

Y430

Y430

Step Instruction

0 LD X402

1 OR X403

2 AND X400

3 AND X401

4 OUT Y430

5 LD Y430

6 AND X402

7 OUT Y431

8 LD Y430

9 AND X403

10 OUT Y432

11 END

Page 300: Plc course presentation

The ladder & IL program for the central heating

system using Siemens PLC is :

Inputs :

I0.0 Clock

I0.1 Boiler sensor

I0.2 Room sensor

I0.3 Tank sensor

Outputs :

Q2.0 Boiler

Q2.1 Pump M1

Q2.2 Pump M2

Page 301: Plc course presentation

I0.3

I0.2

I0.2 Q2.1

Q2.2

END

I0.0 I0.1

I0.3

Q2.0

Q2.0

Q2.0

Step Instruction

0 A I0.2

1 O I0.3

2 A I0.0

3 A I0.1

4 = Q2.0

5 A Q2.0

6 A I0.2

7 = Q2.1

8 A Q2.0

9 A I0.3

10 = Q2.2

11 END

Page 302: Plc course presentation

Chapter 8

Timers

Page 303: Plc course presentation

Simple Timers

A timer is simply a control built-in block

that takes an input and changes an output

based on time.

Timers count fractions of seconds or

seconds using internal CPU clock.

Timers act like relays with coils which when

energized result in closing or opening

contacts after some specified time interval.

Page 304: Plc course presentation

In PLC programming a timer is simply

being treated as an output for a rung

while its control is represented by

contacts in somewhere else.

There are three basic timer types :

i. On-Delay timer TON or T-O

ii. Off-Delay timer TOF or O-T

iii. Pulse timers TP

Page 305: Plc course presentation

Timer Types

• On-Delay Timer : this timer takes an

input, waits a specific amount of time,

then turns ON an output (or allows logic

to flow after the delay).

time

Output

Off

On

time

Output

Off

On

TP with

+ve going

output

Page 306: Plc course presentation

• Off-Delay Timer : this timer takes turns

ON an output (or allows logic to flow) and

keeps that output ON until the set

amount of time has passed, then turns it

OFF (hence off-delay)

time

Output

Off

On

time

Output

Off

On

TP with

-ve going

output

Page 307: Plc course presentation

Timer Memory

• EN - timer enabled bit

• TT - timer timing bit

• DN - timer done bit

• FS - timer first scan

• LS - timer last scan

• OV - timer value overflowed

• ER - timer error

• PRE - preset word

• ACC - accumulated time word

Page 308: Plc course presentation

Timer Format

• Timer : timer No. T1

• Time Base : 0.01 or 0.1 or 1.0 sec

• Preset : 100

• Accum. : 0

Txxx

Preset value

Time Base

xxxRegister where Accumulative value stored

Timer Function

Block

Page 309: Plc course presentation

10

T1.0

4003

I0.1

I0.2

Q0.3

10

T1.0

4003

10

T1.0

4003

Ten-second On

Delay Timer

Automatic

Resetting Timer

Q0.3

Q0.3

I0.1

I0.1

I0.2

Q0.3

Ten-second Off

Delay Timer

Page 310: Plc course presentation

10

T1.0

4003

Retentive Timer

Non-retentive

Timer

10

T1.0

4003

I0.1 Q0.3

I0.1

I0.2

Q0.3

Page 311: Plc course presentation

Timer Programming

The on delay timer is used to delay the

operation of the output for some time

interval as follows :

Input

Timer

Output

Timertime

time

Input

Output

Time

delay

Page 312: Plc course presentation

X400

T450 Y430

T450 K5

I0.0

KT5.2

Q2.0

T0

T 0

Step Instruction

0 A I0.0

1 LKT 5.2

2 SR T0

3 A T0

4 = Q2.0

5 END

Step Instruction

0 LD X400

1 OUT T450

2 K 5

3 LD T450

4 OUT Y430

5 END

Page 313: Plc course presentation

Sequencing

The timers can be used to energize more

than one output sequentially with a

specified time delay .

Q2.0

KT5.2

Q2.1

T0

T 0

Y430 T450 K5

X400

T450 Y431

I0.0Q2.0Y430

Page 314: Plc course presentation

T1 Motor 2

IR 1

T2 Motor 3

IR 1

IR 1

start stopIR 1

Motor 1

T2

T1

END

T1 Motor 2

IR 1

T2 Motor 3

IR 1

IR 1

start stopIR 1

Motor 1

IR 3

IR 2

END

TON T1

TON T2

Motor

Sequence

Page 315: Plc course presentation

Cascaded Timers

Timers can be linked together to give longer

time delay than that for a single timer.

I0.2

Q0.3

10

T1.0

4001

10

T2.0

4002

Cascaded Timers

I0.1

Q0.1

Q0.1

Page 316: Plc course presentation

T450 T451 K100

X400

T451 Y430

T450 K999

Step Instruction

0 LD X400

1 OUT T450

2 K 999

3 LD T450

4 OUT T451

5 K 100

6 LD T451

7 OUT Y430

8 END

Cascaded timers

Page 317: Plc course presentation

Example (Timer Application)

Automatic mixing processes of liquids and other

compounds in the chemical and food industries are very

common.

The mixing station goal is to mix two liquids for a

specified time and then output the final product to a

storage tank.

The system consists of :

1. Two level sensors to monitor the flowing of the

liquids into the tank.

2. Three solenoid valves to control the flow of liquids.

3. A motor connected to an agitator to mix the liquids

into the tank.

Page 318: Plc course presentation

Mixing

Station

LS1

LS2

Level Sensors

VA1

VA2

Input ValvesMS

1

Motor & Agitator

Mixing Tank

VA3 Output to Storage Tank

Page 319: Plc course presentation

The sequence of events for this automatic mixing process will

be as follows :

1. Open valve 1 until level 1 is reached for the first liquid .

2. Then close valve 1 .

3. Open valve 2 until level 2 is reached for the second

liquid .

4. Then close valve 2 .

5. Start the motor and agitate to mix the liquids into the

tank for a specified time .

6. Then stop the motor .

7. Open valve 3 up to a specified time to empty the mixed

product to a storage tank .

8. Then close valve 3 .

9. Repeat or end the mixing process as required .

Page 320: Plc course presentation

The automatic mixing station will require the following

components using Mitsubishi PLC :

1. Inputs to the PLC :

Start push button X400

Stop push button X401

Level sensor LS1

X402

Level sensor LS2

X403

1. Outputs from the PLC :

Valve # 1 (VA1) Y430

Valve # 2 (VA2) Y431

Motor starter (MS1) Y432

Valve # 3 (VA3) Y433

Page 321: Plc course presentation

Y432

X403

T450 K1200

M 100

Y430

M 100

M100

M100

M100

M 100

X400X401

M 100

END

X402 X403 Y432 Y433

X402 X403 Y432 Y433

Y431

T450X403

Y433

T451 K180M100 T450

M100 T451 T450Y433

Page 322: Plc course presentation

Step Instruction

12 ANI X403

13 ANI Y432

14 ANI Y433

15 OUT Y431

16 LD M100

17 AND X403

18 OUT T450

19 K 1200

20 LD M100

21 AND X403

22 LD M100

23 ANI Y433

Step Instruction

0 LD X400

1 OR M100

2 ANI X401

3 OUT M100

4 LD M100

5 ANI X402

6 ANI X403

7 ANI Y432

8 ANI Y433

9 OUT Y430

10 LD M100

11 AND X402

Step Instruction

24 ORB

25 ANI T450

26 OUT Y432

27 LD M100

28 ANI T450

29 OUT T451

30 K 180

31 LD M100

32 ANI T451

33 AND T450

34 OUT Y433

35 END

Page 323: Plc course presentation

Q2.2

I0.3

F0.2

F0.1

Q2.0

F0.1

F0.1

F0.1

F0.1

F0.1

I0.0I0.1

F0.1

END

I0.2 I0.3 Q2.2 Q2.3

I0.2 I0.3 Q2.2 Q2.3

Q2.1

F0.2I0.3

Q2.3

F0.3

F0.1 F0.2

F0.1 F0.3 F0.2Q2.3

T0

KT1200

KT180

T1

Page 324: Plc course presentation

Step Instruction

12 AN I0.3

13 AN Q2.2

14 AN Q2.3

15 = Q2.1

16 A F0.1

17 A I0.3

18 LKT 1200

19 SR T0

20 A T0

21 = F0.2

22 A(

23 A F0.1

Step Instruction

0 A I0.0

1 O F0.1

2 AN I0.1

3 = F0.1

4 A F0.1

5 AN I0.2

6 AN I0.3

7 AN Q2.2

8 AN Q2.3

9 = Q2.0

10 A F0.1

11 A I0.2

Step Instruction

36 A T1

37 = F0.3

38 A F0.1

39 AN F0.3

40 A F0.2

41 = Q2.3

46 END

Step Instruction

24 A I0.3

25 )

26 O(

27 A F0.1

28 AN Q2.3

29 )

30 AN F0.2

31 = Q2.2

32 A F0.1

33 AN F0.2

34 LKT 180

35 SR T1

Page 325: Plc course presentation

Chapter 9

Counters

Page 326: Plc course presentation

Simple Counter

A counter is simply a control built-in block that

takes counts the occurrence of an input signal.

This might happen in a conveyor system, when

counting persons passing through a door,

counting cars in a parking lot or counting the

revolutions of a shaft.

There are two basic types of counters - Up

counter and a Down counter :

• Up Counter : as its name implies, whenever a

triggering event occurs, an up counter increments

the counter.

• Down Counter : whenever a triggering event

occurs, a down counter decrements the

counter.

Page 327: Plc course presentation

Counter Memory

• CU - count up bit

• CD - count down bit

• DN - counter done bit

• OV - overflow bit

• UN - underflow bit

• PRE - preset word

• ACC - accumulated count word

Page 328: Plc course presentation

Counter Format

• Counter : counter No. CTR1

• Preset value : 5

• Accum. : 0

Preset value

CTR

Storage Register

Counter Function

Block

Page 329: Plc course presentation

5

CTR1

4003

I001 O003

5

CTR1

4003

5

CTR1

4003Automatic Resetting Counter

Down Counter

Up Counter

I001

I001

I002

I002

O003

O003

O003

Page 330: Plc course presentation

I00120

CTR1

4001

999

CTR2

4002

O001

I002

Cascaded Counters

O001

O002

Page 331: Plc course presentation

Counter Programming

The counter is used to count the events of

occurrence of an input signal and then

operates its contacts as follows :

Input

Counter

Output

Counter

CTD

counter

CV

RST

Page 332: Plc course presentation

Counter Output

In 1

In 2 Counter

Counter

RST

time

In 1

time

In 2

time

Output

Page 333: Plc course presentation

Step Instruction

0 LD X400

1 RST C460

2 LD X401

3 OUT C460

4 K 10

5 LD C460

6 OUT Y430

7 END

X400

X401

Y430

RESET

C460

K 10

Out

C460

Mitsubishi PLC counter programming

Page 334: Plc course presentation

Step Instruction

0 A I0.0

1 CU C0

2 A I0.1

3 R C0

4 = Q2.0

5 END

I0.0

I0.1Q2.0

CU

CV

R

C0

Siemens PLC counter programming

Page 335: Plc course presentation

Counter Application

Consider the following packing machine,

where it is required to pack 6 objects in a

box and then pack 12 objects in another

box in another path as shown :

6 in box

12 in box

Page 336: Plc course presentation

Step Instruction

0 LD X400

1 OR C461

2 RST C460

3 K 6

4 LD X401

5 OUT C460

6 LD C460

7 OUT Y430

8 LD X400

9 OR C461

10 RST C461

11 K 12

12 LD X401

13 AND C460

14 OUT C461

15 LD C461

16 OUT Y431

17 END

Mitsubishi PLC program

C460

C461

X400

X401

Y430

RESET

C460

K 6

Out

C460

X400

X401

Y431

RESET

C461

K 12

Out

C461

C461

Page 337: Plc course presentation

Step Instruction

0 A I0.0

1 O C1

2 CU C0

3 LCK 6

4 A I0.1

5 R C0

6 = Q2.0

7 A I0.0

8 O C1

9 CU C1

10 LCK 12

11 A I0.1

12 R C1

13 A C0

14 = Q2.1

15 END

Siemens PLC program

I0.0

I0.1 Q2.0

I0.0

I0.1 Q2.1C0

CU

CV

R

CU

CV

R

C1

6

12

C1

C1

C0

Page 338: Plc course presentation

In 3 Reset

In 1

In 2 Down-Counter

Up-Counter

Counter Output

Using up

and down

counters

Page 339: Plc course presentation

Step Instruction

0 A I0.0

1 CU C0

2 A I0.1

3 CD C0

4 AN F0.0

5 LKC 50

6 S C0

7 A I0.2

8 R C0

9 A C0

10 = Q2.0

I0.0

I0.1

Q2.0

CU

CD

S

KCV50

Up and down counters

with a Siemens PLC

F0.0

I0.2

CV

R

C0

Page 340: Plc course presentation

Chapter 10

Shift

Registers

Page 341: Plc course presentation

Definition

• The shift registers are electronic internal

devices used for storing data.

• They represent a number of internal relays

grouped together and allowing stored bits

to be shifted from one relay to another.

• Their main usage is to keep tracking of

particular items or where a sequence of

operations is required.

Page 342: Plc course presentation

Shift Registers Operation

Suppose that we have 8 internal relays

grouped together :

And each relay may store an on or off

state as follows :

1 2 3 4 5 6 7 8

1 0 1 1 0 0 1 0

Page 343: Plc course presentation

If a signal is received from an input

devices sets the 1st

internal relay to the

state 0, by then the grouped set of relays

in the register will be shifted as follows :

before the update

after the update

0 1 0 1 1 0 0 1

1 0 1 1 0 0 1 0

Page 344: Plc course presentation

Shift Registers Programming

Consider a 4-bit shift register, it can be

represented in ladder diagram by three inputs

such that :

• The 1st

input is used to reset the register

(RST).

• The 2nd

input is used to energize the first

internal relay of the register (OUT).

• The 3rd

input is used to shift the states of the

internal relays of the register along by one

(SFT).

Page 345: Plc course presentation

In 3

RST

IR 1 Out 1

In 2

SFT

In 1

OUT

IR 2 Out 2

IR 3 Out 3

IR 4 Out 4

Shift register internal relays

IR 1 , IR 2 , IR 3 , IR 4

Output controlled by 1st

relay

in the register

Output controlled by 2nd

relay

in the register

Output controlled by 3rd

relay

in the register

Output controlled by 4th

relay

in the register

Page 346: Plc course presentation

X402

RST

M140 Y430

X401

SFT

X400

OUT

M141 Y431

M142 Y432

M143 Y433

M140

Step Instruction

0 LD X400

1 OUT M140

2 LD X401

3 SFT M140

4 LD X402

5 RST M140

6 LD M140

7 OUT Y430

8 LD M141

9 OUT Y431

10 LD M142

11 OUT Y432

12 LD M143

13 OUT Y433

14 END

Mitsubishi PLC