You are on page 1of 55

By:

Normah Sapuan
Department of Electrical Engineering
4.1. PLC PROGRAMMING
SYSTEM
4.1.1 EXPLAIN PLC
PROGRAMMING METHOD
The following is list of programming languages specified
by this standard:
1. Laddar Diagram (LD)
2. Mnemonic Code
3. Instruction List/Set (IL)
4. Sequential Function Chart/Flow Chart(SFC)
5. Function Block Diagram(FBD)
6. Human Machine Interface (HMI)
7. Window based Program/Structure Text(ST)
a. Laddar Diagram (LD)
Rung 1

Rung 2

Rung 3

END END Rung

Figure 4: The Rung Ladder

 A ladder diagram is read from left to right and from top to bottom,
Figure 4 shows the scanning motion employed by the PLC. The top
rung is read from left to right. Then the second rung down is read
from left to right and so on. When the PLC is in its run mode, it goes
through the entire ladder program to the end, the end rung of
program being clearly denoted, and then promptly resumes at the
start. This procedure of going through all the rungs of the program
is termed a cycle.
Five rules that need to be considered when
drawing the ladder Diagram:

1) A vertical line represents the path of where the circuit is connected


2) Each rung on the diagram represents the first step in the process control
operations
3) Ladder diagram read from left to right and from top to bottom
4) Each rung of ladder diagram started with one or more input and end with at
least one output.
5) Electrical device is shown in the beginning of ladder
6) A device can be used many times in one rung of ladder
7) Input and output is known by its own address
b. Mnemonic Code
c. Instruction List/Set(IL)
d. Sequential Funtion Chart(SFC)
 SFC – developed to accommodate the programming
of advance system.
 3 main component of SFC are steps, actions and
transitions
e. Function Block Diagram(FBD)
f. Window Based
Program/Structured Text(ST)
g. Human machine
Interface(HMI)
HMI is short for Human Machine Interface. We use HMIs in industry
to control and monitor machines. A very common HMI that you all
encounter on a regular basis would be an ATM machine. The screen
and pushbuttons allow you to operate the machine to dispense a
certain amount of money, or to deposit money.
4.2 BASIC LOGIC INSTRUCTION
SET
4.2.1 Basic Logic Instruction

Mnemonic Code Symbol Description


LOAD Creates a normally
(LD) open condition as the
first condition off the
bus bar. All instruction
lines begin with either
LOAD or LOAD NOT.

LOAD NOT Creates a normally


(LD NOT) closed condition as the
first condition off the
bus bar. All instruction
lines begin with either
LOAD or LOAD NOT.
Mnemonic Code Symbol Description
AND Combines a normally
(AND) open condition in series
with a previous condition

AND NOT Combines a normally


(AND NOT) closed condition in series
with a previous condition.

OR Combines a normally
(OR) open condition in parallel
with a previous condition.

OR NOT Combines a normally


(OR NOT) closed condition in
parallel with a previous
condition.
AND LOAD Combines two group of
(AND LOAD) conditions in series.
These groups are called
blocks.
Mnemonic Code Symbol Description
OUTPUT Specifies an output bit
(OUT) that is to be turned ON for
an ON execution
condition and OFF for an
OFF condition

TIMER Creates a 0-1 s


(TIM) decrementing timer that
TIM
starts from the set value
(SV) when the execution
condition turns ON.

COUNTER Counts down the number


(CNT)
CP
of times the input
CNT conditions turns ON.
R
TIMER - TIM
 The function of timer is to delay time :
 delay ON or delay OFF
TIMER number : 000 – 511 and set value 0000 - 9999
 Example :

00000
TIM 000
Address Instruction Data
#0025

TIM 000 00000 LD 00000


0101
01000
00001 TIM 000
#0025
00002 LD TIM 000
END(01)
00003 OUT 01000
00004 END(01)
#0025 (interval)
 0025 X 0.1S
= 2.5 S
COUNTER - CNT
Counts down the number of times the input conditions turns ON. Each
time the input condition turns ON, the present value (PV) is reduced by 1
and when the count reaches 0, the Completion Flag (accessed through the
counter number) turns ON.

COUNTER number : 000 – 511 and set value 0000 - 9999

00000
Address Instruction Data
CP CNT 001
00002
#0010 00000 LD 00000
R
00001 LD 00002
CNT 001
00002 CNT 001
01002
#0010
00003 LD CNT 001
END(01)
00004 OUT 01002
00005 END(01)
DESIGN AND WRITE PROGRAM LADDER

1. AND function ADDRESS INSTRUCTIONS DATA  

00000 LD 00000

00000 00001 00002 00001 AND 00001


01000 00002 AND 00002
00003 OUT 01000

2. OR
function

00001 ADDRESS INSTRUCTIONS DATA


01001
00000 LD 00001
00002 00001 OR 00002
00002 OR 00003
00003 00003 OUT 01001
3. LOAD and LOAD NOT function

00000 ADDRESS INSTRUCTIONS DATA

01000 00000 LD 00000


00001 OUT 01000
00001
00002 LD NOT 00001
01001
00003 OUT 01001

4. AND and AND NOT function

ADDRESS INSTRUCTIONS DATA


00000 00001 00002 00000 LD 00000
01002
00001 AND NOT 00001
00002 AND 00002
00003 OUT 01002
5. OR and OR NOT function

00000 ADDRESS INSTRUCTIONS DATA


01003
00000 LD NOT 00000
00001 00001 OR NOT 00001
00002 OR 00002
00002 00003 OUT 01003

6. AND and OR
function

00000 00001 00003


ADDRESS INSTRUCTIONS DATA
01004
00000 LD 00000
00002 00001 AND 00001
00002 OR 00002
00003 AND 00003
00004 OUT 01004
7. END function

00000 00001
ADDRESS INSTRUCTIONS DATA
01005
00000 LD 00000
00001 AND NOT 00001

END
00002 OUT 01005
00003 END (01)
EXAMPLE OF DESIGN AND WRITE PROGRAMME

00001 00002 00004 00005 01007


ADDRESS INSTRUCTIONS DATA

00000 LD 00001
00001 AND 00002
00003 00002 OR 00003
00003 AND 00004
00004 AND NOT 00005
00005 OUT 01007
00006 END(01)

END
AND LD
2

00000 00002 01001 ADDRESS INSTRUCTIONS DATA

00000 LD 00000
00001 OR 00001
00001 00003 00002 LD 00002
00003 OR NOT 00003
00004 AND LD
00005 OUT 01001
00006 END(01)

END
OR LD
3

00001 00002 01001 ADDRESS INSTRUCTIONS DATA

00000 LD 00001
00001 AND NOT 00002
00002 LD 00003
00003 00004
00003 AND 00004
00004 OR LD
00005 OUT 01001
END 00006 END(01)
4 AND LD

A B C
00000 00002 00004 01007

00001 00003 00005

END
TWO TYPES OF SOLUTION

ADDRESS INSTRUCTIONS DATA ADDRESS INSTRUCTIONS DATA

00000 LD 00000 00000 LD 00000


00001 OR NOT 00001 00001 OR NOT 00001
00002 LD NOT 00002 00002 LD NOT 00002
00003 OR 00003 00003 OR 00003
00004 LD 00004 00004 AND LD ---
00005 OR 00005 @ (A+B)
00005 LD 00004
00006 AND LD
00006 OR
00007 AND LD
00007 AND LD ----
00008 OUT 01007 (A+B) +C
00008 OUT 01007
00009 END(01)
00009 END(01)
5

ADDRESS INSTRUCTIONS DATA


00000 00001 00002 00003 01001
00000 LD 00000
00001 AND 00001
00004 00002 LD 00002
00003 AND NOT 00003
00004 OR 00004
00005
00005 OR 00005
00006 AND LD
00008 OUT 01001
END
00009 END(01)
Exercise
4.3 SPECIAL SEQUENTIAL INSTRUCTION SET

A SEQUENCE OF INSTRUCTIONS WHICH USUALLY


ACTS AS THE LAST INSTRUCTION LINE

1. KEEP
2. SET / RESET
3. JUMP
4. INTERLOCK
5. DIFFERENTIATE UP / DOWN
KEEP – KEEP (11)

 Suruhan KEEP di gunakan untuk mengekalkan status bit


operasi berdasarkan kepada dua keadaan perlaksanaan
( execution condition ).
 KEEP (11) beroperasi seperti geganti selak ( Latching Relay )
yang di set oleh S dan reset oleh R.
 Apabila S berada dalam keadaan ON, operasi arahan keluaran
tertentu akan ON dan kekal dalam keadaan ON sehingga reset
tanpa mengira samaada S adalah ON ataupun OFF.
 Apabila R berada dalam keadaan ON, operasi arahan keluaran
tertentu akan OFF dan kekal dalam keadaan OFF sehingga
reset tanpa mengira samaada R adalah ON ataupun OFF.
 Untuk set PLC jenis OMRON – SYSMAC CQM1H, suruhan FUN
11 adalah suruhan KEEP
Laddar Diagram shows KEEP instruction
SET/RESET
JUMP
JMP(FUN(04) & JME(FUN(05)

 Arahan JMP (04) biasanya di gunakan berpasangan dengan arahan JME


(05) untuk menghasilkan lompatan.
 JMP (04) adalah arahan untuk menentukan titik permulaan lompatan
manakala JME (05) adalah arahan yang menjadi halatuju lompatan.
 Apabila arahan JMP (04) adalah ON, tiada sebarang lompatan akan
berlaku dan aturcara akan di laksanakan seperti yang tertulis.
 Apabila arahan JMP (04) adalah OFF, lompatan ke arahan JME (05) yang
mempunyai nombor yang sama akan di lakukan. Seterusnya arahan-
arahan yang berada selepas arahan JME (05) akan di laksanakan.
 Arahan-arahan JMP dan JME boleh menggunakan nombor-nombor dari
julat 00 hingga 99.
 Untuk set PLC jenis OMRON – SYSMAC CQM1H, suruhan FUN 04
adalah suruhan JUMP dan suruhan FUN 05 adalah suruhan JUMP END.
INTERLOCK [ IL ( 02 ) ] DAN
INTERLOCK CLEAR [ ILC
( 03 ) ]
 IL ( 02 ) dan ILC ( 03 ) mesti di gunakan bersama-sama.

 Suruhan ini di gunakan untuk menyelesaikan masalah penyimpanan


keadaan pelaksanaan ( Execution Condition ) pada titik cabang.

 Apabila arahan INTERLOCK adalah ON seperti di Rajah Tangga


bawah, keadaan perlaksanaan bagi arahan INTERLOCK akan
mengawal kesemua perlaksanaan arahan sehinggalah suruhan
INTERLOCK CLEAR. Apabila suruhan INTERLOCK adalah OFF,
suruhan INTERLOCK CLEAR akan reset operasi aturcara.

 Untuk set PLC jenis OMRON – SYSMAC CQM1H, suruhan FUN 02


adalah suruhan INTERLOCK dan suruhan FUN 03 adalah suruhan
INTERLOCK CLEAR
DIFFERENTIATE UP [ DIFU (13) ]
DAN DIFFERENTIATE DOWN
[ DIFD (14) ]

 Suruhan-suruhan DIFU (13) dan DIFD (14) akan ON kan keluaran


dalam tempoh masa yang terlalu singkat.
 Suruhan DIFU (13) akan menukarkan keadaan keluaran kepada
ON apabila isyarat masukan berubah daripada OFF ke ON .
 Suruhan DIFD (14) akan menukarkan keadaan keluaran kepada
ON apabila isyarat masukan berubah daripada ON ke OFF .
 Untuk set PLC jenis OMRON – SYSMAC CQM1H, suruhan FUN
13 adalah suruhan DIFFERENTIATE UP dan suruhan FUN 14
adalah suruhan DIFFERENTIATE DOWN
 Apabila suruhan masukan LD 00000 ON (telah berlaku
perubahan dari OFF ke ON ), bit operasi 01000 akan
ON ,keluaran OUT 10000 akan ON dalam tempoh yang
terlalu singkat dan kemudian OFF .Kita tidak dapat melihat
keadaan tersebut pada keluaran.

 Selepas itu bit operasi 01000 akan OFF tanpa mengambil


kira status suruhan masukan LD 00000.
 
 Apabila suruhan masukan LD 00000 OFF (telah berlaku
perubahan dari ON ke OFF ), bit operasi 01000 akan ON
,keluaran OUT 10000 akan ON dalam tempeh yang terlalu
singkat dan kemudian OFF . Kita tidak dapat melihat keadaan
tersebut pada keluaran.

 Selepas itu bit operasi 01000 akan OFF tanpa mengambil kira
status suruhan masukan LD 00000.
4 STEP PLC PROGRAMMING
AND WIRING

There are 4 steps that usually been used in designing using


PLC :
i. List of Input/output assignment
ii. Input/output wiring drawing
iii. Ladder diagrams’ explanation
iv. Logic instructions (mnemonic code/statement list)

You might also like