PLC Programming
PLC Programming
PLC Programming
PLC PROGRAMMING
2
Criteria for PLCs
• Easy to program
• Easy to maintain
• Highly reliable in an industrial environment
• Expandable
• Cost competitive
• Compact
• Communicate
• Accept 120 VAC input signals
• Operate 120 VAC devices
• Over 4k memory
3
Signals in PLCs
4
Ladder and functional block programming
5
Ladder and functional block programming
• PLC are intended to be used by engineers without any great
knowledge of programming as compare to C or other high
level language.
• Standards for PLC programming was done by IEC 1131-3
( International Electro technical Commission).
• IEC 1131-3 programming language are
– Ladder Diagram (LAD).
– Instruction List(IL).
– Sequential Function Chart (SFC).
– Structured Text (ST).
– Functional Block Diagram (FBD).
6
Introduction To Ladder Diagram
7
Motor Control Ladder Diagram
+ RAIL VOLTAGE
RAIL NEUTRAL
output
EQUIVALENT DIAGRAMS
START STOP
output
Normally Normally
9
Open Contact Closed Contact
Convention of Ladder Diagram
• The vertical lines of the diagram
represent the power rails between
which circuits are connected. The
power flow is taken to be from the
left-hand vertical across a rung.
• Each rung on the ladder defines one
operation in the control process.
• A ladder diagram is read from left to
right and from top to bottom.
• The end rung might be indicated by a
block with the word END or RET for
return, since the program promptly
returns to its beginning.
10
Convention of Ladder Diagram
• Each rung must start with an input or inputs and must
end with at least one output.
• Electrical devices are shown in their normal condition.
• A particular device can appear in more than one rung of
a ladder.
• The inputs and outputs are all identified by their
addresses.
11
Standard IEC 1131-3
Basic symbols Of Ladder Diagram
12
Addresses Of Element In Ladder Diagram
13
Addresses Of Element In Ladder Diagram
Input
Output
MS1 R1
01 11
C1 02 12 R2
C2 R3
03 13
C3 R4
04 14
C4 Programmable
05 Controller 15
PLC
01 14 11
02 14
14 04 03 12
05 03 13
Logic Function
• AND Gate
15
Logic Function
cont…………
• OR Gate
16
Logic Function
cont…………
• NOT Gate
17
Logic Function
cont…………
• NAND Gate
18
Logic Function
cont…………
• NOR gate
19
Logic Function
cont…………
• Exclusive OR (XOR)
20
Latching
21
Motor on-off, with signal lamps
example of latching
• X401 is closed when the program is
started.
• When X400 is momentarily closed,
Y430 is energised and its contacts
close.
• This results in latching and also the
switching off of Y431.
• Y432 will be switched on.
• To switch the motor off, X401 is
pressed and opens.
22
Multiple outputs
23
Entering programs
• To enter an INPUT
• To enter an OUTPUT
24
Function blocks
25
Few more Function blocks
26
Ladder diagram and equivalent functional
block diagram
27
Boolean algebra
• A+B.C=Q
• A+B=Q
28
Boolean algebra
29
PROGRAMMING EXAMPLE 1
30
PROGRAMMING Bar code reader
EXAMPLE 2
microswitch Stopper
Part Conveyor
Robot
Machine
01
N Output
11 R1
C1 02 12 R2
C2 R3
03 13
C3 R4
04 14
C4 Programmable
05 Controller 15
PLC
Rung 1. If part arrives and no
part is stopped, trigger the
bar code reader.
01 14 11 Rung 2. If it is a right part,
activate the stopper.
14
Rung 3. If the stopper is up, the
02
machine is not busy and the
robot is not busy, load the
14 04 03 12
part onto the machine.
Rung 4. If the task is completed
05 03 13
and the robot is not busy,
unload the machine.
Internal relays
To distinguish internal relay outputs from external relay outputs, they
33
Control Relay
normally open relay
contact contacts
relay
coil
normally closed relay
contact core
relay coil
34
Control Relay
normally open relay
contact contacts
relay
coil
normally closed relay
contact core
1) Control relays are the
basic component of
relay coil ladder diagram logic
(control relay logic)
2) Control relays are35
simulated by PLCs
Control Relay
relay
contacts
relay
relay
not coil
activated relay
core
36
Control Relay
relay
contacts
relay
relay coil
activated
relay
core
37
Motor Control Ladder Diagram
relay
contacts
relay
control coil
circuit
relay
core
motor
power
circuit
38
Motor Control Ladder Diagram
relay not relay
activated contacts
relay
motor not control coil
activated circuit
relay
control circuit voltage core
48
positive transition-sensing and negative
transition-sensing coils.
49
Set and reset/Latch unlatch
• example
51
Set and reset/Latch unlatch
52
Master control relay
• With no input to input 1, the
output internal relay MC 1 is not
energised and so its contacts are
open, so rungs 2 and 3 are off.
• When input 1 contacts close, the
master relay MC 1 is energised.
• Then all the rungs between it and
the rung with its reset MCR 1 are
switched on.
53