PLC Programming & Applications
PLC Programming & Applications
(PLC) :
PROGRAMMING & APPLICATIONS”
AUTHORS:
NORAZILA BINTI MD POSDZI
TAN EE CHIN
i
DISCLAIMER
e ISBN 978-967-2421-35-1
Published by
ii
PREFACE
Alhamdulillah
iii
SYNOPSIS
The PROGRAMMABLE LOGIC CONTROLLER (PLC) :
PROGRAMMING & APPLICATIONS is specially written for a
course in PLC & Automation. The main objective in writing is
to guide student understand about PLC System and how to
design PLC Programming based on OMRON PLC such as
CPM2A or CPM1A type.
iv
ABOUT THE AUTHORS
v
CONTENT
1.0 PLC PROGRAMMING
1 Ladder Diagram (LD)
Instruction List
Structure Text
Function Block Diagram (FBD)
Sequential Function Chart (SFC)
Reflection Question
83 REFERENCE
vi
1.0 PLC
PROGRAMMING
1
PLC PROGRAMMING SYSTEM
WHAT IS
PLC PROGRAMMING?
2
PLC PROGRAMMING SYSTEM
Programming Languages
Graphic
Languages
Sequential
Function Chart
(SFC)
3
PLC PROGRAMMING SYSTEM
LADDER DIAGRAM
Ladder diagram are a type of programming language that uses
graphic methods to write control instructions.
It is the most used and best choice language for PLC programming.
This language is very similar for all PLC manufacturers.
+ve -ve
NO NC output
Rung
Input Condition
Power line
The ladder diagram has vertical lines on the right and left. It
represents for positive (+ve) and negative (-ve) power lines, as
shown in Figure 1.1.
The horizontal line that connects the bus bar is called a Rung, and
it is where the switching elements Normally Open (NO), Normally
Closed (NC) and OUTPUT are placed. Basically, a ladder diagram
consists of a set of rungs in which each rung represents a single
line with a specific function.
4
PLC PROGRAMMING SYSTEM
LADDER DIAGRAM
Ladder Diagram is kind of graphical programming language that
evolved from the the relay control wiring circuit diagram. Figure
1.2(a) and Figure 1.2(b) shows the difference between wiring
diagram and ladder diagram concept.
SW 1 (0000) SW 2 (0001)
+ L1 (1000)
24V
+ -
0001 0002 1000
5
PLC PROGRAMMING SYSTEM
Current flow
Left rail
Wrong
At least
one output
6
PLC PROGRAMMING SYSTEM
Right rail
Output
connect
1001
in parallel
7
PLC PROGRAMMING SYSTEM
Output
Lamp 2
1002
can be
used once
8
PLC PROGRAMMING SYSTEM
MNEMONIC CODE
Mnemonic Code (Instruction List) is a PLC programming language
that uses statement lists. It is used to programmed the PLC by
entering data and instructions through the Programming Console.
Figure 1.3 show the instruction list operations for this
programming.
Figure 1.3
9
PLC PROGRAMMING SYSTEM
MNEMONIC CODE
A mnemonic code is an instruction keyword, usually an
abbreviation of the actual name of the instruction.
10
PLC PROGRAMMING SYSTEM
MNEMONIC CODE
EXAMPLE OF MNEMONIC CODE
+ -
0001 0002 1000
0003
END
The steps to write the mnemonic code could be found on page 25.
11
PLC PROGRAMMING SYSTEM
STRUCTURED TEXT
Structured text (ST) is a high-level text language, such as BASIC, C,
or PASCAL, that has been specifically developed for industrial
control applications such as process automation. It is used to
implement complex procedures that are difficult to express in
graphical languages.
12
PLC PROGRAMMING SYSTEM
STRUCTURED TEXT
Structured text makes use of statements to specify what should
be executed.
Figure 1.5 (a) and Figure 1.5 (b) illustrates how structured text and
ladder diagram programming can both be used to produce the
same logical output.
+ -
Switch 1 Switch 2 Lamp
Switch 3 Switch 4
13
PLC PROGRAMMING SYSTEM
A1 Q1
A1 OR
A2 Q1
A2
A1 Q1
A1 OR
Q1
A2 A2
14
PLC PROGRAMMING SYSTEM
+ -
A1 A2 Q1
Q1
OR
A1 AND
Q1
A2
15
PLC PROGRAMMING SYSTEM
Start
Transition 1
Action
Step Output
Transition 2
Transition xx
Stop
16
PLC PROGRAMMING SYSTEM
+ Switch -
Start Red Lamp Start
Switch Start
Sensor 1 Red Lamp Green Lamp
Step 1 Red Lamp
Sensor 1
END
Step 2 Green Lamp
17
PLC PROGRAMMING SYSTEM
Output Data
Input Data
0000 ~ 0011 1000 ~ 1007
{
{
For example, for the Omron PLC CPM2A shown in the Figure
1.10, the input terminals are numbered from 0000 to 0011 (12
inputs), and the output terminals are numbered from 1000 to
1007 (8 output).
18
PLC PROGRAMMING SYSTEM
REFLECTION QUESTION
1. List FIVE (5) standard PLC programming languages.
2. Based on the ladder diagram below, explain the error found in the
diagram.
+ -
0001 0002 1001 1000
1000
1001
19
2.0 BASIC LOGIC
INSTRUCTION SET
20
BASIC LOGIC INSTRUCTION SET
LOAD (LD)
▪ LD is the starting instruction for the logic line of the program.
▪ LD is use when a rung starts with the Normally Open (NO)
condition on the left power line.
0001
Address Instruction Data
0000 LD 0001
0001
Address Instruction Data
0000 LD NOT 0001
21
BASIC LOGIC INSTRUCTION SET
OUT
▪ OUT instructions are used to control the coil output.
▪ OUT is connected to a right power line in the Normally Open
(NO) condition.
+ -
0001 1000 Address Instruction Data
0000 LD 0001
0001 OUT 1000
OUT NOT
▪ OUT NOT instructions are used to control the coil output.
▪ OUT NOT is connected to a right power line in the Normally
Closed (NC) condition.
+ 0001
-
1000 Address Instruction Data
0000 LD 0001
0001 OUT NOT 1000
Ladder Diagram Mnemonic Code
22
BASIC LOGIC INSTRUCTION SET
AND
AND instructions is used to connect two or more input with a
Normally Open (NO) condition in serial.
+ -
0001 0002 1000 Address Instruction Data
0000 LD 0001
0001 AND 0002
0002 OUT 1000
AND
Mnemonic Code
Ladder Diagram
When both inputs 0001 and 0002 are turned on, the output 1000
will also be turned on.
AND NOT
AND NOT instructions is used to connect two or more input with
a Normally Closed (NC) condition in serial.
+ -
0001 0002 1000 Address Instruction Data
0000 LD 0001
0001 AND NOT 0002
0002 OUT 1000
AND NOT
Ladder Diagram Mnemonic Code
When the inputs 0001 is turned ON and 0002 is turned OFF, the
output 1000 will be turned on.
23
BASIC LOGIC INSTRUCTION SET
OR
OR instructions is used to connect two or more input with a
Normally Open (NO) condition in parallel.
+ -
0001 1000 Address Instruction Data
0000 LD 0001
0002 0001 OR 0002
0002 OUT 1000
OR Mnemonic Code
Ladder Diagram
When any of the inputs 0001 or 0002 are turned on, the output
1000 will also be turned on.
OR NOT
OR NOT instructions is used to connect two or more input with a
Normally Closed (NC) condition in parallel.
+ -
0001 1000 Address Instruction Data
0000 LD 0001
0002 0001 OR NOT 0002
0002 OUT 1000
OR NOT
Mnemonic Code
Ladder Diagram
24
BASIC LOGIC INSTRUCTION SET
END
END instruction is used to indicate the end program.
It is the last instruction of a program. The program cannot be
executed without an END instruction. For OMRON PLCs, the
END instruction is FUN (01).
+ -
0001 1000
Address Instruction Data
0000 LD 0001
END
0001 OUT 1000
0002 FUN (01)
NO OPERATION (NOP)
NOP instruction will display on the PLC programming console
screen when the PLC programming is deleted from the PLC's
memory.
25
BASIC LOGIC INSTRUCTION SET
26
BASIC LOGIC INSTRUCTION SET
LD 1 LD 2
+ -
0001 0002 1000
0003 0004
Parallel block
+ -
LD 1 LD 2 1000 Ladder diagrams can
be simplified into
series connections.
27
BASIC LOGIC INSTRUCTION SET
EXAMPLE 1
EXAMPLE 2
28
BASIC LOGIC INSTRUCTION SET
+ -
LD 1
0001 0002 1000
series
0003 0004 block
LD 2
+ -
LD1 1000
Ladder diagrams can
LD2 be simplified into
series connections.
29
BASIC LOGIC INSTRUCTION SET
EXAMPLE
+ - Address Instruction Data
0001 0002 1000
0000 LD 0001
0001 LD 0003
0003 0004 Connect two
block using 0002 AND 0004
OR LD 0003 OR LD -
0004 AND 0002
0005 OUT 1000
30
BASIC LOGIC INSTRUCTION SET
Use AND
+ OUT instruction -
0001 0002 1000
TR0
LD
TR0 Branch Point
31
BASIC LOGIC INSTRUCTION SET
EXAMPLE 3
TR instruction is not required when there are no contact input
after the branch point in the first row of the instruction block.
+ -
0001 1000
ADDRESS INSTRUCTION DATA
0000 LD 0001
0002 1001 0001 OUT 1000
TR is not 0002 AND 0002
required
0003 OUT 1001
32
BASIC LOGIC INSTRUCTION SET
STEP 1:
Determine the machine
sequence of operation
By drawing flowchart to
show the sequence of STEP 2:
operation Assignment of
inputs and outputs
Identify the input and
STEP 3:
output device in the
Writing of the program system
Write the ladder diagram
program by following the
control system sequence of
operation as determined by STEP 4:
step one. Programming into
PLC memory
Through console or
STEP 5: computer by using CX
Running the system programmer software
Test run the system thoroughly
until it is safe to operate by
anyone.
33
BASIC LOGIC INSTRUCTION SET
S1 ; ON DC Motor, M1 ; 0001 S1
ON 0002 S2
S2 ; ON DC Motor, M1 ;
OFF Output Devices Description
REFLECTION QUESTION
1. Explain the difference between the instruction AND and AND NOT
instruction with the aid of a ladder diagram.
+ -
0001 0002 1001
0003
0003 0004
0006 1002
END
6. Explain temporary relays (TR) and give one example of using the
instruction?
35
3.0 TIMER & COUNTER
INSTRUCTION SET
36
TIMER INSTRUCTION SET
TIM
N N: Timer Number
Input Condition
SV SV: Set Value
The range of numbers (N) for TIM is from 000 to 255, while the
setting range of set values (SV) for the TIM is the BCD between
#0000 to #9999.
TIM operates a timer with 1 pulse scan time is 0.1s. For example,
if timer be set to 5 seconds, then the set value (SV) is #0050.
0000
TIM TIM 000 is used
37
TIMER INSTRUCTION SET
Example
Lamp 1 will turn ON after 5 second when switch 1 is turned ON.
Draw a ladder diagram and mnemonic code.
+ Switch 1 -
0001 TIM Address Instruction Data
000
#050 0000 LD 0001
0001 TIM 000
Lamp 1
TIM 000 1000 #050
0002 LD TIM000
0003 OUT 1000
Example 2
When switch 1 is turned ON, the TIM000 timer is triggered after
10 seconds. Then, lamp 1 will be turned ON and lamp 2 will be
turned OFF. Draw a ladder diagram and timing diagram.
+ Switch 1 -
0001 TIM
000 0001
#100
sec
Lamp 1 T000
TIM 000 1000 10s
1000
Lamp 2
TIM 000 1001
1001
38
TIMER INSTRUCTION SET
Example
When switch is turned ON, the lamp will turn ON. As long as
switch is ON, the timer will not be active. When switch is turned
OFF, the timer will start to trigger. After 5 seconds, the lamp will
turn OFF.
39
TIMER INSTRUCTION SET
40
COUNTER INSTRUCTION SET
CP
CNT
Input N: Timer Number
R
N
Condition
SV SV: Set Value
The range of numbers (N) for CNT is from 000 to 255, while the
setting range of set values (SV) for the CNT is the BCD between
#0000 to #9999. Counter and timer cannot use the same range
of numbers (N) in a program.
0000
CP need to
switch from CNT CNT 000 is used
OFF to ON 000
0001 Set a value to count
#010 This value will
To reset SV
of counter decrease by 1.
41
COUNTER INSTRUCTION SET
Example 2
Draw a timing diagram and ladder diagram that will activate a
pilot lamp after a sensor detects the presence of 3 products. The
pilot lamp will deactivate after switch reset is pressed.
+ Sensor - Sensor
0001 0001
CNT
Switch 000
0002 CNT000
#003
Lamp
Pilot lamp 1001
CNT000 1001
Reset
0002
42
COUNTER INSTRUCTION SET
Example
When push button 1 (PB1) is pressed for 4 times, the Lamp 1 will
be ON. When Lamp 1 is ON, TIM001 will be activated and, after 5
seconds, Lamp 2 will be ON. Push Button 2 (PB2) is used to reset
the counter. Draw a ladder diagram and timing diagram for the
system.
+ PB1 -
0001
CNT
PB2 000
0002
#004
CNT000 1001
Lamp 1
CNT000 TIM
001
#050
TIM001 1002
Lamp 2
END
PB1
0001 After PB1 has been activated four
sec times, CNT000 will be triggered,
Lamp 1 and Lamp 1 will be turn ON.
1001
43
TIMER & COUNTER INSTRUCTION SET
REFLECTION QUESTION
1. State the range of numbers that can be used to identify a
timer (TIM) and counter (CNT).
44
4.0 SPECIAL
INSTRUCTION SET
1. HOLDING CIRCUIT
2. SET/RESET
3. KEEP
4. DIFU / DIFD
5. INTERLOCK / INTERLOCK CLEAR
6. JUMP / JUMP END
45
SPECIAL INSTRUCTION SET
For the OMRON PLC CPM2A, the bit data for IR addresses are:
contact
All PLCs have IR, however the internal numbering scheme work
bit for them depends on the PLC model.
46
SPECIAL INSTRUCTION SET
EXAMPLE 1
When the start button is pressed and released, a motor will rotate,
and the conveyor will move to bring out the product. The sensor
will count 12 products and inserting it into the box as shown in
Figure 4.3. Then, the motor will be stopped the process.
+ -
Start Motor
0000 CNT000 1000
1000
Sensor
1000 0001
Figure 4.3 CNT
CNT000 000
#012
END
EXAMPLE 2
Design PLC ladder diagram by using Holding Circuit to implement
the timing diagram shown in Figure 4.4:
+ Start Stop IR
-
0000 0001 200
200
200 TIM
000
#150
TIM000 1000
Lamp 1
Figure 4.4 1001
Lamp 2
END
48
SPECIAL INSTRUCTION SET
EXAMPLE 3
Design PLC ladder diagram by using Holding Circuit to implement
the timing diagram as shown in Figure 4.5:
Figure 4.5
+ Start IR
-
0000 TIM002 200.00
Address Instruction Data
0000 LD 0000
200.00 0001 OR 200.00
0002 AND NOT TIM002
200.00 TIM 0003 OUT 200.00
000 0004 LD 200.00
#100 0005 TIM 000
TIM000 1000 #100
Lamp 0006 AND NOT TIM000
Sensor
0002 0007 OUT 1000
TIM000
0008 LD 0002
CNT 0009 AND TIM000
TIM002 001 0010 LD TIM002
#002
0011 CNT 001
CNT001 #002
TIM
0012 LD CNT001
002
#200 0013 TIM 002
#200
1001
0014 OUT 1001
Motor
0015 FUN(01)
END
49
SPECIAL INSTRUCTION SET
SET/RESET
SET and RESET are optional instructions that can be used to keep
the output. The SET instruction will turn ON the operand bit (B)
when the input condition is ON, and it stays ON even when the
input condition is OFF. RSET will turn OFF the operand bit when
the input condition is ON. Figure 4.6 shows the Set and Reset
instruction using ladder diagram program.
+ -
Set Bit operand (B) may
SET
consist of data output
B
or internal relay (IR)
Reset RSET Set and Reset must
B used a same data
Input Condition
APPLICATION OF SET/RESET
When PB1 (0001) is momentarily pressed, SET IR 200.00 is
energized and it will remain ON even if PB1 is turned OFF. This
condition keeps the output Lamp 1 (1001) is turned ON. When
PB2 (0002) is pressed, the RSET IR 200.00 is turned OFF. As a
result, the lamp (1001) will also be turned OFF.
+ PB1 -
0001
SET 0001
200.00
PB2
200.00
0002 RSET
200.00
1001
Lamp 1
200.00 1001
0002
50
SPECIAL INSTRUCTION SET
Example 1
By using the SET/RESET instruction, create a ladder diagram that will
light up a pilot lamp after 5 second the push button start (PB1) is
pressed. Then, after pushing a push button stop (PB2), the lights will
be turned off.
+ PB_1 -
0001
SET
200.00
PB_1
0002
RSET
200.00
200.00 TIM
000
#50
TIM000 1001
Pilot Lamp
END
Example 2
Design PLC ladder diagram by using SET and RESET instruction to
implement the timing diagram as shown in Figure 4.7:
+ PB_1 -
0001
SET
200.00
TIM000
RSET
200.00
200.00 TIM
000
#80
Figure 4.7
200.00 1001
Lamp 1
1002
Lamp 2
END
51
SPECIAL INSTRUCTION SET
KEEP
The KEEP instruction is another optional instruction that can also
be used to maintain the output. KEEP instruction is used to keep
a status bit operation based on two input conditions.
These two input conditions are indicated by set (S) and reset (R)
as shown in Figure 4.8. Bit operand (B) may consist of data output
or internal relay (IR).
Set
Input KEEP
Condition Reset
B B : Data Output / IR
52
SPECIAL INSTRUCTION SET
Example 1
Design a ladder diagram by using the KEEP instruction. The DC
motor will run automatically after 10 second the push button start
(PB1) is pressed. Then, after pushing a push button stop (PB2), the
DC motor will stop.
+ PB_1 -
0001
PB_1 KEEP
0002 200.00
200.00 TIM
000
#100
TIM000 1001
DC Motor
END
Example 2
Design PLC ladder diagram by using KEEP instruction to implement
the timing diagram as shown in Figure 4.9:
+ PB_1 -
0001
KEEP
TIM000 200.00
200.00 TIM
000
#100
Figure 4.9 200.00 1001
Lamp 1
1002
Lamp 2
END
53
SPECIAL INSTRUCTION SET
PB1 PB2
The ladder diagram below
5 sec
shows two types of
10 sec programming design that
can be used in this
situation.
Figure 4.10
+ -
+ Start Stop IR
- Start
0000 0001 200.00 0000
or
KEEP
200.00 0001 200.00
Green TIM000
TIM000 1001 TIM
001
#100
END END
54
SPECIAL INSTRUCTION SET
Player 1
Player 2
Figure 4.11
KEEP instruction SET/RESET instruction
+ - + Lamp
-
PB_Player 1 Lamp PB_Player 1
0000 1001 Player 1 Player 1
0000 1001
SET
KEEP 1000
TIM000 1000 or TIM000
RSET
1000
PB_Player 2 Lamp Lamp
0001 1000 Player 2 PB_Player 2
Player 2
0001 1000
SET
KEEP
TIM000 1001
1001 TIM000
RSET
1001
1000 TIM 1000
000 TIM
#100 000
1001
1001 #100
END END
55
SPECIAL INSTRUCTION SET
DIFU instructions will turn ON the bit when the input condition
changes from OFF to ON (rising edge). When the input is turned
ON, it is used to perform operations that require only one scan
cycle. Figure 4.12 shows the ladder diagram and timing diagram
for DIFU instruction.
+ -
Input Input
DIFU
B DIFU
bit
Input Condition
B : Operand bit IR 1 scan
DIFD instructions will turn ON the bit when the input condition
changes from ON to OFF (falling edge). When the signal is
turned OFF, it is used to perform operations that require only
one scan cycle. Figure 4.13 shows the ladder diagram and timing
diagram for DIFD instruction.
+ -
Input Input
DIFD
B DIFD
bit
Input Condition
B : Operand bit IR 1 scan
56
SPECIAL INSTRUCTION SET
Based on the timing above, it shows the process output cannot be seen
because the lamp will be ON within a very short time and then OFF.
+ -
Switch 1 Address Instruction Data
0000
DIFU 0000 LD 0000
200.00
0001 DIFU 200.00
200.00 1001 0002 LD 200.00
Lamp 1 0003 OR 1001
0004 OUT 1001
1001
0005 LD 0001
0006 DIFD 201.00
Switch 2 0007 LD 201.00
0001
DIFD 0008 OR 1002
201.00 0009 OUT 1002
201.00 1002
Lamp 2 To solve the above problem, use
1002 the holding circuit concept to
ensure that both lamps are always
turned ON.
END
57
SPECIAL INSTRUCTION SET
1001
Limit
Switch
0001
DIFU
200.00
END
Figure 4.14
END
58
SPECIAL INSTRUCTION SET
ILC (03)
0001 1001
0001
1001
ILC
1002
0001 1002
1002 is out of range of IL and
it will be controlled by 0001
59
SPECIAL INSTRUCTION SET
When input 0000 for 1st IL is turned ON and 0002 for 2nd IL is
turned OFF, TIM000 will be activated for 5 seconds and output
1001 will be turned ON but CNT001 will not be changed and
output 1002 will be turned OFF.
When 0000 and 0002 for both ILs are ON, the program between
the 1st IL and the ILC will execute normally.
Next, when both of ILs are turned OFF again, TIM000 will be reset
and outputs 1001 and 1002 will be turned OFF but CNT001 will
not change. CNT001 will not reset when input 0005 is turned ON.
60
SPECIAL INSTRUCTION SET
JME 1001
#1
0001 1002 1002
1002 is out of range of JMP
61
SPECIAL INSTRUCTION SET
Figure 4.19 – Application of JMP being used twice with one JME.
When input 0000 for 1st JMP is turned ON and 0002 for 2nd JMP is
turned OFF, TIM000 will be activated for 5 seconds and output
1001 will be turned ON but CNT001 will not be changed and
output 1002 will remain as current value.
When 0000 and 0002 for both JMP are ON, the program between
the 1st JMP and the JME will execute normally.
Next, when both of JMP are turned OFF again. All the output
relay, timer or counter remain unchanged.
62
SPECIAL INSTRUCTION SET
REFLECTION QUESTION
1. Explain the function of internal relay (IR) instruction using a
ladder diagram and mnemonic code.
1001
Figure 4.21
63
SPECIAL INSTRUCTION SET
REFLECTION QUESTION
5. Design PLC ladder diagram by using KEEP and DIFD
instruction to implement the timing diagram as shown in
Figure 4.23.
Figure 4.23
64
5.0 APPLICATION
PLC PROGRAMMING
65
APPLICATION 1 : PLC PROGRAMMING
START
To K1
STOP PLC coil
66
APPLICATION 1 : PLC PROGRAMMING
+ Start
0000
Stop
0001
IR
200.00 -
1
Used NO contact
200.00
if using NC Switch
Contactor
200.00 1000
2
1000
STOP
To K1
FWD coil
PLC
REV To K2
coil
68
APPLICATION 2 : PLC PROGRAMMING
1000
Reverse K2 Coil
0003 1000 1001
1001
END
69
APPLICATION 3 : PLC PROGRAMMING
Push
Button
Table 5.4 shows the input and output devices for the system
and the assignment of PLC terminals to the devices.
71
APPLICATION 3 : PLC PROGRAMMING
Figure 5.7 and Figure 5.8 shows the ladder diagram control program
for the system.
In the initial condition, the Green light for the car traffic light is
turned ON by TIM000 contact (NC contact) at rung 5 and the Red
light for the pedestrian is turned ON by TM001 contact (NC contact)
at rung 6.
72
APPLICATION 3 : PLC PROGRAMMING
73
APPLICATION 4 : PLC PROGRAMMING
74
APPLICATION 4 : PLC PROGRAMMING
75
APPLICATION 4 : PLC PROGRAMMING
+ start stop IR - + -
0001 0002 CNT001 200.00 200.02
0 5
CNT
200.00 001
TIM002
motor #010
200.00 200.01 1001
stop
1 0002
sensor latch sensor
0000 TIM000 200.01 lamp
2 CNT001 1002
200.01
6
TIM
sensor 002
0000
DIFD #600
3
200.02
END
latch DIFD
200.02 TIM000 200.03
4
200.03 Figure 5.10 – Ladder Diagram
TIM
000
#050
76
APPLICATION 4 : PLC PROGRAMMING
https://youtu.be/G4l
-frzBzCU
77
APPLICATION 5 : PLC PROGRAMMING
78
APPLICATION 5 : PLC PROGRAMMING
Motor : This motor is used to drive the conveyor belt in order to carry
component from the left side to the right side of the conveyor system.
Plunger : The plunger is activated by the solenoid. Once the solenoid is
energized, it will extend to eject what ever object in front of it.
• 3 sensors are used to detect the part move along the belt. If
the part is not assembled, one or two of the sensor will not be
activated.
80
APPLICATION 5 : PLC PROGRAMMING
The function KEEP used in ladder diagram is to start and stop the
system process. When the start button is pressed the system is
latched until the stop button is pressed.
+ -
Start
0000 The condition of the sensor is
0 used to latch a temporary bit
Stop KEEP
0001 200.00 as shown in rung 1. Inductive
sensor will latch bit 200.01 if it
Motor_Cvr
200.00 1004 sensed a metal piece.
1 Capacitive sensor will latch bit
Latch Inductive
Inductive Proximity
Sensor Sensor Sensor 200.02 if it sensed a assembled
0002 0005 200.01
plastic and through beam
sensor will latch 200.03 if there
200.01
is an interruption on its’ light
Capacitive Proximity
Sensor Sensor
Latch Capacitive
Sensor
beam path.
0003 0005 200.02
200.02
Rung 3 shows how the plunger
work. If a part is detected by
Through Proximity
Beam Sensor Sensor
Latch Through
Beam proximity sensor at the end of
0004 0005 200.03
the conveyor (contact 0005
will close), the activation of
200.03
Plunger
the plunger will depend on the
200.01 200.02 200.03 200.04 condition at rung 2. All
2 conditions will activate the
plunger to eject the part into
0005 200.04 1003 the bad tray except condition 1
3
(refer table 5.7), the
END
assembled part will go into
good tray.
81
APPLICATION: PLC PROGRAMMING
REFLECTION QUESTION
Figure 5.14 shows a filling and draining system. Based on the sequence
operation below, design PLC ladder diagram by using KEEP and DIFD
instruction.
Figure 5.14
i. If the start button (PB1) is pressed, motor valve 1 (MV1) is opens
and the water begins to fill the tank. At the same time, the
stirring motor (M) starts operation.
ii. When the water level passed to sensor LS2 and reaches sensor
LS1, MV1 closes and the stirring motor stop. Next, motor valve 2
(MV2) is opens and starts draining the water.
iii. When the water level drops below LS2, MV2 closes. After the
cycle of operation has repeated four times, the indicator lamp is
illuminated, and the buzzer operates for 5 seconds. The operation
can be restarted after the stop button (PB2) is pressed.
82
REFERENCE
83
The Programming Logic Controllers (PLC)
Programming and Applications eBook is
aimed to equip students with the knowledge
and skills related to basic PLC programming
and it’s application in industry.