E PROGRAMMABLE LOGIC CONTROLLER(PLC) BASIC PROGRAMMING OF PLC ENOTE MOHD ADIB BIN ZAKARIA RAIS RABANI ABD RAHMAN NOR SYUHADA BT AYOB PREPARED BY:
“PROGRAMMABLELOGIC CONTROLLER(PLC): BASIC PROGRAMMINGOFPLC MOHDADIBBINZAKARIA RAISRABANIABDRAHMAN NORSYUHADABTAYOB ENOTE
FIRST PUBLISHING 2022 All rights reserved. No part of this book (article, illustration and content) may be reproduced or used any form or by any means, electronic or mechanical including photocopying, recording or otherwise without the prior permission of the author and publisher . Department of Electrical Engineering POLITEKNIK SULTAN HAJI AHMAD SHAH, Semambu, 25350 Kuantan, Pahang PUBLISHING BY PROGRAMMABLE LOGIC CONTROLLER (PLC) : BASIC PROGRAMMING OF PLC EDITION 2022 MOHD ADIB BIN ZAKARIA RAIS RABANI ABD RAHMAN NOR SYUHADA BT AYOB
eNotes - Programmbale Logic Controller PLC Basic Programming of PLC
:
PROGRAMMING OF PLC is specially written as a guide note for students from the Department of Electrical Engineering, Polytechnic Malaysia who take the PLC & Automation course. PLC & Automation in polytechnics is a course offered to diploma students in electrical and electronics.This eBook was created in accordance with the syllabus provided by the Curriculum Development Division
2022 Edition
Editor : Writer : Publisher by : MOHD ADIB BIN ZAKARIA RAIS RABANI ABD RAHMAN NOR SYUHADA BT AYOB NOR SYUHADA BT AYOB Department of Electrical Engineering POLITEKNIK SULTAN HAJI AHMAD SHAH, Semambu, 25350 Kuantan, Pahang
Thanks to Allah the Lord of the world because of his grace we can complete a book entitled “PROGRAMMABLE LOGIC CONTROLLER(PLC) BASIC PROGRAMMING OF PLC”. We wish to express our deep and sincere gratitude for those who have guided and given full cooperation and commitment in completing this book.
PREFACE
PREFACE
This lecture book is structured to meet the need of BASIC PROGRAMMING OF PLC for PROGRAMMABLE LOGIC CONTROLLER(PLC) This book can be used as a guidance for all the students and lecturers who are involved in PROGRAMMABLE LOGIC CONTROLLER (PLC) AND AUTOMATION POLITEKNIK SULTAN HAJI AHMAD (POLISAS). We realize that this book is far from perfect, therefore constructive criticism and suggestions are welcomed to i ove this book.
in
SHAH
AHMAD SHAH
2004.
RAIS RABANI ABD
Sultan
in
lecturer in Department
Abidin
Electrical Engineering POLITEKNIK SULTAN HAJI AHMAD SHAH since 2022 and
Engineering POLITEKNIK SULTAN HAJI AHMAD SHAH since 2022 and Politeknik Sultan
Electrical Engineering POLITEKNIK SULTAN
is
OUR TEAM
NOR SYUHADA BT AYOB is a lecturer Department of Electrical Mizan Zainal since
Zainal Abidin since 2005. is
RAHMAN
MOHD ADIB BIN ZAKARIA a of Politeknik Mizan a lecturer in Department of HAJI since
2007
#1 #2 #3 #4 #5 #6 1.0 PLC PROGRAMMING REFERENCE 3.0 TIMER & COUNTER INSTRUCTION SET 4.0 SPECIAL INSTRUCTION SET CONTENT 2.0 BASIC LOGIC INSTRUCTION SET 5.0 MOTOR CONTROL CIRCUT
Understand PLC programming system Ladder Diagram (LD) Instruction List Structure Text Function Block Diagram (FBD) Sequential Function Chart (SFC) 1. 2. 3. 4. 5. 1.0 PLC PROGRAMMING
WHAT IS PLC PROGRAMMING?
PLC PROGRAMMING system
When designing a PLC program, as a programmer must know the type of PLC programming language to be used.
PLC programming uses a programming language that is easy to use and learn by beginner.
PLC programming is an important activity that in volves planning and developing programs to implement control applications based on the desired situation.
Graphic Languages Ladder Diagram Graphic Languages PLC PROGRAMMING system Generally,at the international level each industry will usea different PLC programming language based on the type of PLC. IEC1131-3 is a global standard forcontrol programming languages in PLCs. PLC programming languages are divided in to two categories: text languages and graphic languages. The following is a list of PLC programming languages specified by this standard. Text Languages Mnemonic Code (Instruction List) Sequential Function Chart (SFC) Graphic Languages Function Block Diagram (FBD) Text Languages Structured Text
The horizontal line that connects the bus bari scalled a Rung and i t is where the switching elements Normally Open(NO) Normally Closed(NC) and OUTPUT are placed. Basically, a ladder diagram consists of ase to frungs in which each rung represents a single line with as pecificfunction.
Figure -Ladder Diagram Power line 1.1
The ladder diagram has vertical lines on the right and left .It represents for positive(+ve) and negative( ve )power lines,as shown in Figure1.1.
Ladder diagram are at ype of programming language that uses graphic methods to write control instructions.
PLC PROGRAMMING system
Rung
It is the most used and best choice language for PLC programming. This language is very similar for all PLC manufacturers.
LADDER DIAGRAM
+ve -ve NO NC output Input Condition
LADDER DIAGRAM
PLC PROGRAMMING system +
Ladder Diagram is kind of graphical programming language that evolved from the the relay control wiring circuit diagram. Figure 1.2 (a) and Figure1.2 (b) shows the difference between wiring diagram and ladder diagram concept. Figure (a) -Wiring Diagram 0001 0002 1000 1.2 SW 1 (0000) SW 2 (0001) L1 (1000) ++ 24V Writing this program is similar to that of drawing a switching circuit.
Power
-veSW1 0000 SW2 0001 Lamp 1000
flow is from left to right (from +ve to –ve)
SW1 -ve one output 0000 SW2 000 1 Lamp 1000 At least
LADDER DIAGRAM FEATURES
There
Each
must be at least one input for each rung. SW1 0000 1000 Lamp 1000 Wrong
+ve
The
+ve
output on the right can not be connected directly to the left. +ve L a m p -ve +ve -ve
Left
rung contains at least one output.
PLC PROGRAMMING system +
rail Current flow
PLC PROGRAMMING system + LADDER DIAGRAM FEATURES Contact input cannot be placed on the right side o the output. SW1 0000 SW1 0000 SW2 0001 Lamp 1000 SW2 0001 Lamp 1000 +ve -ve +ve -ve Right rail Output must connect to a right rail. Wrong Multiple loads cannot be connected in series. 1001 +ve -ve 0000 0001 1000 Output connect in paralle Multiple loads must be connected in parallel. SW1 0000 SW2 0001 Lamp 1 Lamp 2 1000 1001 Wrong +ve -ve
PLC PROGRAMMING system + LADDER DIAGRAM FEATURES Each output in the programmed can only be used once and cannot be repeated. Multiple input can be used in the programmed +ve L a m p 1 -ve +ve -ve Output can be used onc SW1 0000 SW1 0001 SW1 0001 SW2 0002 SW1 0001 SW2 0002 1001 Lamp 2 1002 Lamp 2 Lamp 1 1001 1002 Output address can be used as input address Input address cannot be used as an output address. +ve -ve +ve -ve Lamp 1 1001 SW1 0001 SW2 0001 SW2 0002 SW3 0003 Lamp 2 1002 Wrong
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. Figure1.3 show the instruction list operations for this programming.
Instruction List
Figure 1.3
PLC PROGRAMMING system
Mnemonic code is these cond step after creating a ladder diagram.The ladder diagram cannot be read by the Programming Console.
MNEMONIC CODE
As a result,the Ladder Diagram should bec onverted to mnemonic code that contains the same in formation as the Ladder Diagram and can be typed directly in to the Programming Console.
Operations * LOAD (LD) instruction * AND instruction * OR instruction * Output (OUT) instruction * END (FUN) instruction * NOT instruction * AND LD instruction * OR LD instruction
PLC PROGRAMMING system MNEMONIC CODE A mnemonic code is an instruction keyword, abbreviation of the actual name of the instruction. 0005 ADDRESS 0000 0001 0002 0003 0004 FUN(01) INSTRUCTION LD OR AND OUT TIM DAT A 0001 0002 0003 1001 000 #050 T1.1 able -Mnemonic Code Address Consists of a four bit number sequence, referred to as the memory address. Instruction: The sequence that must be followed in order to complete the task using the instruction list. Operand/Data:Implementation of the data input and output process. In other words, the value of the data processed by the instruction.
PLC PROGRAMMING system MNEMONIC CODE EXAMPLE OF MNEMONIC CODE Figure (a) -Ladder Diagram (LD) Figure 1.4 (b) -Mnemonic Code 0003 END 1.4 + 0001 0002 1000ADDRESS 0000 0001 0002 0003 0004 INSTRUCTION LD OR NOT AND OUT FUN(01) DATA 0001 0003 0002 1000 The basic elements of a mnemonic code (instruction list) program from a ladder diagram as shown Figure (a) and Figure 1.4(b):
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.
Programs run as fast and efficient as ladder diagram.
PLC PROGRAMMING system
Programs run as fast and efficient as ladder diagram.
Structured text is an extremely flexible programming language for writing control algorithms. ST programming can be written in any text editor and are easy to programmed, debug, test, and understand. Therefore, it is ideal for complex mathematical, algorithmic or decision-making tasks.
STRUCTURED TEXT
Programmers can easily learn structured text programming.
Programs can be created in any text editor.
Benefits of Structured Text:
EXAMPLE OF STRUCTURED TEXT
Structured text makes use of statements to specify what should be executed.
PROGRAMMING system
The light will turn one of the two circuit
on when
following
PLC
Figure1.5(a) and Figure1.5(b) illustrates ho structured text and ladder diagram programming can both be used to produce the same logical output.
STRUCTURED TEXT
condition is present: •Switch 1 and Switch 2 switches are both closed. •Switch 3 is closed and Switch 4 switch is open. Figure (a) -Ladder Diagram (LD) +Switch 1 Switch 2 Lamp 1.5 Switch 3 Switch 4 IF Switch 1 AND Switch 2 THEN LAMP := 1; ELSEIF Switch 3 AND NOT Switch 4 THEN LAMP := 1; END _IF; Figure (b) -Structured Text 1(ST) .5
PLC
Function blocks are connected to forma circuit that meets a control requirement. The block function type name, such as OR is displayed in the block as shown in Figure 1.6. Function blocks can have standard functions like logic gates, counters, or timers.
FUNCTION BLOCK DIAGRAM
Figure -Ladder Diagram to Function Block Diagram
Function block diagram (FBD) is used for PLC programming that use block graphs. It is a graphical language used to describe signal and data flow with in a block.
A1 A2 A1 Q1 Q1 A1 A2 A1 A2 OR OR Q1 Q1 A2
PROGRAMMING system
The main concep to fa functional block diagram is data flow. It is most useful in applications involving high information or data flow between control components,such as process control.
1.6
PLC PROGRAMMING system
FUNCTION BLOCK DIAGRAM The main concept is the data flow, which starts with the inputs and continues through the blocks to generate the output. EXAMPLE OF FUNCTION BLOCK DIAGRAM Figure1.7 (a) and Figure 1.7 (b) shows an example between of a function block diagram and ladder diagram. Figure Ladder Diagram 1(LD) .7 (a)A2 AQ1 1 Q1 Figure Function Block Diagram 1(FBD) .7 (b)A1 A2 OR AND Q1
Transition 2 Transition xx
Start
PLC PROGRAMMING system
Stop
Transition 1 Action
StepOutput
Sequence Function Chart (SFC) is also agraphical programming language for PLC used mainly for sequential processes where by the process can be divided into many sequential steps. These are like flowcharts, but this method is different because it does not have to follow a single path through the flow chart. Figure 1.8 shows a concep to fsequential function chart (SFC).
SEQUENTIAL FUNCTION CHART
Figure -Sequential Function Chart 1(SFC) .8
SFC programming uses a graphical interface to organize program. The three main components of an SFC are steps, actions and transitions. A step is a system function, like a mechanical process and transition is the conditionneeds to be fulfilled before the process can move from one step to another step.
Sensor 1 Switch Start Red Lamp Green Lamp Figure 1.9(a) -Ladder Diagram sequential function chart and ladder diagram program. Figure 1.9(b) -Sequential Function Chart Figure (a) and Figure (b) shows an example between of a END Sensor 1 Red Lamp Green Lamp End Start Step 1 Step 2 EXAMPLE OF SEQUENTIAL FUNCTION CHART PROGRAM + S w i t c hStart Red Lamp 1.9 1.9
PROGRAMMING
PLC system CHART
SEQUENTIAL FUNCTION
In order to create the ladder diagram and mnemonic code, all external input and output devices to be connected to the PLC must be identified. In the figure below, input and output data
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
2nddigit represents channel
Output Data
values are described.
Data
input data
{ {
Input
2nddigit channel
3rd& 4th digits represent output bit on the PLC
1stdigit is ‘1’ to represents output data
INPUT / OUTPUT PORT ADDRESS
3rd& 4th digits represent input bit on the PLC
PLC PROGRAMMING system
0000 ~ 0011 1000 ~ 1007
1stdigit is ‘0’ to represents
represents 1(output). 0078
List FIVE (5) standard PLC programming languages. Based on the ladder diagram below, explain the error found in the diagram.
TUTORIAL
QUESTION 0001 0003 1000 1000 0001 0002 1001 1000 1000 1001 Explain the structure of the following PLC programming language: (a) Function Block Diagram (b)Sequential Function Chart Convert the structured text below to PLC ladder diagram. IF PB1 1 AND PB 2 THEN LAMP := 1; ELSEIF PB 3 THEN LAMP := 1; END _IF; Mnemonic code consists of three column namely and and .....................
2.0 BASIC LOGICINSTRUCTION SET Understand basic logic instruction set LOAD/LOADNOT AND/ANDNOT OR/ORNOT ANDLOAD ORLOAD OUT END Nooperation 1. 2. 3. 4. 5. 6. 7. 8.
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. Ladder Diagram Mnemonic Code Address 0000 Instruction LD Data 0001 0001 LOAD NOT (LD NOT) LD NOT is the starting instruction for the logic line of the program. LD NOT is use when a rung starts with the Normally Closed (NC) condition on the left power line. Ladder Diagram Mnemonic Code Address 0000 Instruction LD NOT Data 0001 0001 BASIC LOGIC INSTRUCTION SET
OUT instructions are used to con connected to a right power line i condition. BASIC LOGIC INSTRUCTION SET OUT +0001 1000 Ladder DiagramMnemonic Code Output 1000 will remain ON as long as Input 0001 is ON. When 0001 changes to OFF, 1000 also changes to OFF. Address 0000 0001 Instruction LD OUT Data 0001 1000 OUT NOT +0001 1000 Ladder DiagramMnemonic Code Output1000willremainONaslongasInput0001isOFF. When0001changestoON,1000changestoOFF. OUTNOTinstructionsareusedtocontrolthecoiloutput. OUTNOTisconnectedtoarightpowerlineintheNormally Closed(NC)condition. ▪ ▪ Address 0000 0001 Instruction LD OUT NOT Data 0001 1000
BASIC LOGIC INSTRUCTION SET AND Ladder Diagram When both inputs 0001and will also be turned on. Mnemonic Code are turned on,the output AND instructions is used to connect two or more input with a Normally Open (NO) condition in serial. + - 0001 0002 1000 Address 0000 0001 0002 Instruction LD AND OUT Data 0001 0002 1000 0002 1000 AND AND NOT AND NOT Whentheinputs0001isturnedONand output1000willbeturnedon. ANDNOTinstructionsisusedtoconnecttwoormoreinputwith aNormallyClosed(NC)conditioninserial. isturnedOFF,the +0001 0002 1000 0000 0001 0002 LD AND NOT OUT 0001 0002 1000 0002 Ladder Diagram Mnemonic Code Address Instruction Data
BASIC LOGIC INSTRUCTION SET OR Address 0000 0001 0002 Instruction LD OR OUT Data 0001 0002 1000 Ladder Diagram WHEN any of the inputs or Mnemonic Code OR instructions is used to connect two or more input with a Normally Open (NO) conditionin parallel. are turned on,the output +0001 1000 will also be turned 1on. 000 0001 0002 OR 0002 OR NOT Address 0000 0001 0002 Instruction LD OR NOT OUT Data 0001 0002 1000 Normally Closed(NC)condition in parallel. Mnemonic Code Ladder Diagram When the input 0001 is turned on or 0002 is turned off, the output 1000 will be turned on.The input 0002 is NC,so the output +remains on until is turned on or is turned off. OR NOT instructions is used to connect two or more in put with a 0001 0002 1000 0002 0001 OR NOT
BASIC LOGIC INSTRUCTION SET END Ladder Diagram Mnemonic Code END instruction is used to indicate the end program. It is the last instruction of a program. The program can not be executed without an END instruction. For OMRON PLCs, the END instruction is FUN (01). +Address 0000 0001 0002 Instruction LD OUT FUN(01) Data 0001 1000 0001 1000 END
BASIC LOGIC INSTRUCTION SET HOW TO WRITE MNEMONIC CODE? Next, refer to contact in parallel 1stcontact is NO, start with LD 1stcontact is NC, start with LD NOT Next, go to serial for AND instruction END of program used FUN (01) Use OUT instruction Use OUT NOT instruction 0004 0005 END 1001 STEP5 + 0001 0002 0 0 0 3 1000 Address 0000 0001 0002 0003 0004 0005 0006 0007 0008 Instruction LD NOT OR OR NOT AND AND NOT OUT LD OUT NOT FUN(01) Data 0001 0004 0005 0002 0003 1000 0006 1001 STEP 1 2 3 4 5 6 7 8 9 Convert from ladder diagram program to Mnemonic Code rung rung 1st 2nd STEP STEP STEP STEP 2 3 4 6 STEP STEP STEP STEP0006 7 9 1 8
BASIC LOGIC INSTRUCTION SET AND LOAD (AND LD) Address 0000 0001 0002 0003 0004 0005 Instruction LD OR LD OR AND LD OUT Data 0001 0003 0002 00041000 Parallelblock The AND LD instruction is used to connect instruction blocks that are connected in series. be simplified into series connections. twoparallel +LadderdiagramscanLD 1 1000 LD 2 LD 2 LD 1 0003 0004 0001 0002 1000
BASIC LOGIC INSTRUCTION SET AND LOAD (AND LD) AND LD EXAMPLE 2 EXAMPLE 1 AND LD instruction must be used if the serial block before the A parallel block infron to fa serial block can be connected using AND connection. 0000 0001 0002 0003 0004 0000 0001 0002 0003 0004 0005 LD LD OR OU T LD LD OR AND LD AND OUT 0001 0002 0003 1000 0001 0002 00030004 1000 +0001 +0001 Connect two block using AND LD Connect two block using AND LD Next, connect using AND instruction only 0003 0002 1000 0002 0004 1000 0003 parallel block. Address Address Instruction Instruction Data Data
BASIC LOGIC INSTRUCTION SET OR LOAD (OR LD) ++LD 01001 0002 1000 series 0003 0004 block LD 2 Address Instruction Data Ladder diagrams can be simplified into series connections. LD1 LD2 1000 LD 2 0000 0001 0002 0003 0004 0005 LD AND LD AND OR LD OUT 0001 0003 0002 0004 1000 LD 1
BASIC LOGIC INSTRUCTION SET OR LOAD (OR LD) 0001 0003 0003 0004 0002 1000 0004 0 005 Address Address Instruction Instruction Data Data 0000 0001 0002 0003 0004 0005 0000 0001 0002 0003 0004 0005 0006 0007 LD LD AND OR LD AND OUT LD OR LD LD AND OR LD AND LD OUT 0001 0003 0004 0002 1000 0001 0003 0002 0004 00051000 + 0001 0002 1000 +Connect using OR instruction only Connect two block Connect two block using OR LD Connect two block using OR LD serial block in parallel The example programming using AND LD and OR LD instruction EXAMPLE COMBINATION AND LD & OR LD OR LD instruction is used if a single contact is connect using AND LD
TR instruction can only be used with the OUT and LD instructions. The OUT TR instruction should be used at the first branch point. The LD TR instruction is used after the second row of the branch point. The firsti nstruction after OUT TR or LD TR instruction must be connected with the AND instruction.
TR instructions contain 8 bits of data and have addresses ranging from TR0 to TR07.TR can be used as many times as required and the number address must be the same at the same branch point.
BASIC LOGIC INSTRUCTION SET –Special branch point for the
Figure
TEMPORARY RELAYS (TR)
+ U s e A N D instruction 0002 1000
use of TR LD TR0 OUT TR00001 0003 0004 Branch Point 0005 1001 2.1
Temporary Relays (TR) are used for temporary storage of a program instructions. The program instruction foundin a ladder diagram that has a special branch point as shown in Figure 2.1. The TR instruction are used for mnemonics code only.
BASIC LOGIC INSTRUCTION SET
This is a simple example of using the TR instruction: EXAMPLE 1: When a branch point with a separate input is connected to an output. When a branch point without a separate input is connected to an output. TR instruction is not required when there are no contact input after the branch point in the first row of the instruction block. 0000 0001 0002 0003 0004 0005 0006 0000 0001 0002 0003 0004 0006 ADDRESS 0000 0001 0002 0003 LD OUT AND OUT LD AND OUT LD OUT AND OUT LD OUT INSTRUCTION LD OUT AND OUT DATA 0001 1000 0002 1001 0001 TR0 0002 1000 TR0 0003 1001 0001 TR0 0002 1000 TR0 1001 TR0 TR is not required 0003 0002 1001 1001 1001 Address Address Instruction Instruction Data Data EXAMPLE 2 EXAMPLE 3 OUT + OUT TR 0 0001 0002 1000 +0001 1000 LD 32 0001 0002 1000 LD TR0 OUT TR0
BASIC LOGIC INSTRUCTION SET DESIGN OF CONTROL SYSTEMS USING PLC By drawing flowchart to show the sequence of operation sequence of operation Determine the machine STEP1: STEP2: Assignment of inputs and outputs Identify the input and output device in the STEP3: Writing of the program Write the ladder diagram program by following the control system sequence of operation as determined by step one. STEP4: Programming into PLC memory Through console or computer by using CX programmer software STEP5: Running the system Test run the system thoroughly until it is safe to operate by anyone.
BASIC LOGIC INSTRUCTION SET EXAMPLE OF CONTROL SYSTEMS DESIGN USING PLC Writing of the STEP 1: Determine the process sequence Can also use the flow chart as Ladder Diagram can be programmed by using CX programmer software (OMRON) STEP2:Assignmentof inputsandoutputs STEP 4 : Write Mnemonic Code if Programming into PLC by using Console ADC motor should operate continuously when the Start button, S1,is pressed and only turn off when the Stop button,S2,is END + - 0001 0002 1001 S1 ;ON S2 ; ON DC Motor, M1 ; ON DC Motor, M1; OFF 000 1 000 2 1001 S1 S2 M1 0000 0001 0002 0003 0004 LD OR AND NOT OUT FUN(01) 0001 1001 0002 1001 pressed. program a reference STEP 3: The activity The sequence Address Input Devices OutputDevices Instruction Data Description Description Design the following sequences: 1001 34
Explain operation
the
the steps to design control system using PLC Programming.
of the ladder diagram below. Explain the function of AND LD and OR LD. Convert the ladder diagram below to mnemonic code. 0001 0002 1001 0003 0004 0002 1002 END 0001 0002 0005 1001 0003 0 004 0006 1002
LOGIC INSTRUCTION LSET OGIC INSTRUCTION SET
Explain
ist
TUTORIAL QUESTION
BASIC BASIC
the difference between the instruction AND and AND NOT instruction with the a idofa ladder diagram.
UnderstandTIMER&COUNTER InstructionSet Timer Instruction Set Counter Instruction Set 3.0 TIMER & COUNTER INSTRUCTION SET
This contact turns on TIM000
is
TIM operates a timer with 1 pulses can time is 0.1s. For example, if timer be set to 5 seconds,then these t value (SV) is #0050.
A timer (TIM) an internal PLC instruction
3.1. N:
This value will decrease until zero
TIM 000 is used
TIM(N) and the set value (SV) as shown in Figure
TIM 000 #100 isOFF.
TIMERINSTUCTIONSET Timer Number
used to delay time for input and output signals. The instructions that require numbers
TIM N SV
3.1 SV: Set Value 0000 Input Condition
Figure –Timer Instruction Set
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.
Timer is activated when the input condition is turns ON, and itwill be reset to the set value (SV) when the input condition
Set value is #100 0.1s→1pulse 10s→100pulse
TIMERINSTUCTIONSET APPLICATIONOFTIMERPROGRAM(ONDELAY) Lamp 1 will turn ON after 5 second when switch Draw a ladder diagram and mnemonic code. When switch 1 is turned ON, the TIM 000 timer is triggered after 10 seconds. Then, lamp1 will be turned ON and lamp2 will be turned OFF. Draw a ladder diagram and timing diagram. is turned ON. After seconds contact TIM 2 will change to NO and lamp will turn OFF. After 5 seconds contact TIM 000 will change to NC and the lamp will turn ON. TIM 000 1001 + SW1 0001 TIM 000 #050 Lamp 1 TIM 000 1000 + S w i t c h 10001 TIM 000 #100 Lamp 1 TIM 000 1000 T000 1000 1001 Address Instruction Data Lamp 2 10 000 0000 0001 0002 0003 LD TIM LD OUT 0001 000 #050 TIM000 1000 Example2 Example 1 10s sec 0001
ON delay timer is a timer that is triggered when the inputs witch isturned ON. While OFF delay timer is a timer that is triggered when the input switch is turned OFF.There is a delay before the output is turned ON or OFF.
OFF. The
using
0000 0001 0002 0003 0004 0005 0006 0007 LD OR AND NOT OUT LD AND NOT TIM FUN (01) 0001 1001 TIM000 1001 1001 0001 000 #050 The
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. timer will start to trigger if the switch is turned lamp will only turn
APPLICATIONOFTIMERPROGRAM(OFFDELAY)
TIMERINSTUCTIONSET
OFF after a delay of time. Example 0001 1000 1001 END 0001 TIM 000 #05 0 + S w i t c h L a m p0001 TIM000 1001 1001 T000 5s Switch Address Instruction Data sec
The OFF delay timer circuit can be implemented ON delay timer circuit.
TIMERINSTUCTIONSET LIGHTFLICKERCIRCUITUSINGTIMERPROGRAM Address Instruction Data willstopflickeringthelamp. TIM000begin to count for 20s after 0001turns ON (Lamp ON). TIM001begin to count for 10s after T000is activated (Lamp turns OFF) . ToallowthelamptoturnON andturnsOFFafter20s ToallowtheT001tostart countingthetimeafter20s. To reset both timers after 30s and repeat itself. LamptoturnONfor20sand turnsOFFfor10salternately. Timing diagram illustrates a system's input/output status. and OFF alternately. In this program, two timers are required. One is used to determine the ON time, while the other one is for the OFF time. When turnsOFFthecircuit A light flicker circuit is a circuit that causes the lights to turn ON TIM000 END TIM001 TIM 000 #200 TIM 001 #100 S w i t c h L a m p 0001 TIM 000 1001 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 LD OUT AND NOT OUT LD AND NOT TIM LD TIM FUN (01) 0001 TR0 TIM000 1001 TR0 TIM001 000 #200 TIM000 001 #100 NO NC NC SW 0001 1001 20s 30s TIM000 TIM001 TIM000 TIM000 TIM001 reset timer LAMP SWITCH OFF OFF 0001
Figure 3.2–Counter Instruction Set
Each time input CP(
To reset SV of counter
A counter(CNT) of numbers(N )in aprogram.
Set a value to count This value will decrease by 1. OFF to ON CNT000 is used
COUNTERINSTUCTIONSET
ON.The counter cannot count the transition conditionat CP when R is ON. The counter can start to count the input at CP after R is turned OFF.
) counter's set value decreases by one.Once it reaches zero, the counter will operate.The counter will reset if input R(0001) is is an internal PLC instruction used to count
R 0000 0001
is switched from OFF to ON, the pulses. The instructions that require numbers CNT(N) and theset value(SV). The counter have two input condition with a clock pulse (CP) and reset input(R) as shown in Figure3.2.
CP need to switch from
CP 0000 N: Timer Number SV: Set Value CNT N SV CN T 000 #010 COUNTERINSTUCTIONSET
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
Input Condition
APPLICATIONOFCOUNTER PROGRAM
Contact CNT 000 will change to NC and the pilot lamp will turn ON after the counter has been counted 3 times.
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 de activate after switch reset is pressed.
Example 1
TimingDiagram
triggered,
Atthesametime,TIM001begins tocountfor5seconds,andafter TIM001isactivated,Lamp2turn s ON. Lamp1andlamp2willremainO untilPB2ispressed.
Example
will remain ON
END TIM
Lamp
Lamp
push
AfterPB1hasbeenactivatedfou r times,CNT000willbetriggered, andLamp1willbeturnON.
APPLICATIONOFCOUNTER PROGRAM
is pressed.
After PB1 has been activated four times, CNT 000 will be and Lamp1 will be turn
times,the
2 (PB2) is used to reset the counter.Draw a ladder diagram and timing diagram for the system. TIM00 1 Lamp 2 1002 PB2 0002 PB1 0001 Lamp 1 1001 5s sec Lamp
When button1 1 Lamp Button 1 2
1will 5 be ON.When Lamp is ON, TIM001 will be activated and,after seconds,Lamp2 will be ON.Push
activated,
At the same time,TIM001 begins to count for 5seconds,and after TIM001 is Lamp2 turns lamp2 until PB2
END TIM
TIM001 CNT000 001 #050
Whenpushbutton1 1 2
(PB1)ispressedfor 1 times,theLamp1will 5 4 beON.WhenLampisON,TIM001willbeactivatedand,after seconds,Lamp2willbeON.PushButton2(PB2)isusedtoreset thecounter.Drawaladderdiagramandtimingdiagramforthe system. TIM 1 L 2 10 PB 00 00 La 10 Lamp
ON. Lamp1and
(PB1)is pressed for
1002 + P B 10001 CNT PB2 0002 000 #004 CNT000 1001
1002 + P B 10001 CNT PB2 0002 000 #004 CNT000 1001
N
ON.
TIM 001 CNT000 001 #050
Explain the counter instruction set in PLC programming using appropriate diagrams.
What is the difference between a ON delay and a OFF elay timer circuit?
raw a ladder diagram that will turn ON a motor after toggle switch is closed. The motor should stop utomatically after two minutes, while the toggle switch is still closed.
TUTORIAL QUESTION
tate the range of numbers that can be used to dentify a timer (TIM) and counter (CNT).
aw a ladder diagram that a pilot lamp will turn ON ter 10 seconds when switch 1 is turned ON.
HOLDINGCIRCUIT SET/RESET KEEP DIFU/DIFD INTERLOCK/INTERLOCKCLEAR JUMP/JUMPEND 4.0 SPECIAL INSTRUCTION SET UnderstandSpecialPLC InstructionSet
IR is an imaginary programmed relay that has coils and contacts but is not connected to are al output (relay). So, internal relay cannot have addresses that start with the data ‘10’. the OMRON PLC CPM 2A, the bit data for IR addresses are: instruction sets KEEP, to Figure 4.1 understand the special instructions of the PLC program, firstly
such as
For
contact coil 4.1 + 000 1 2 0 0 . 00IR200isusedin theholdingcircuit 0000 200.00 INTERNAL RELAY (IR) 20000 to 23115 (928 bits) SPECIALINSTRUCTION SET SET RESET
we must know about the internal relay (IR).
InternalRelay(IR) is one bit memory device. If the program is used with IR, this bit stores the data and maintains an ON or OFF status regardless of whether the input set is ON or OFF.
SET and RSET, DIFU, DIFD. These instructions are used
control ON and OFF state output bits in the IR.
shows the ladder diagram using holding circuit with internal relay (IR). All PLCs have IR, however the internal number ing schemework bit for them depends on the PLC model. Figure –Internal Relay (IR) To
IR can be used in other special
When push button 1 (0000) is momentarily pressed (ON then OFF), output IR 200 is energized. Because of IR 200 output is held by a latching, it will remain ON even if 0000 is turned OFF. This condition will also cause the output Lamp (1000) to remain turned ON.
APPLICATION OF HOLDING CIRCUIT HOLDING CIRCUIT (LATCH) 0000 1000 200.00 2 0001 SET SET RESET BIT BIT COIL PB1 0000 PB1 0001 IR 200.00
When push button 2 (0001) is pressed, the internal relay of the IR 200 is de energized and the IR 200 is turned OFF. As a result, the lamp (1000) will also be turned OFF. relay (IR)
SPECIALINSTRUCTION SET –Holding Circuit Bit can use output bit or
Figure
Operand
Holding Circuit is used as a latch. It is used to keep the status of the specified bit based on two input conditions. These two input conditions are indicated by the symbols S and R as shownin Figure.4.2 is the set input and R is there set input.
200.00 200.00 contact LAMP 4.2 1000 internal
from
SPECIALINSTRUCTION SET Figure Figure Design PLC ladder diagram by using Holding Circuit to implement the timing diagram shown in Figure: 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 shownin Figure 4.3. Then, the motor will be stopped the process. END Start Motor 4.4 4.3 +Start Stop IR +END Lamp 1 Lamp 2 TIM000 0000 200 200 1000 CNT000 0000 0001 CNT000 200 TIM 000 #150 1000 1001 CNT 000 1000 1000 Sensor 0001 #012 EXAMPLE 2 EXAMPLE 1
SPECIALINSTRUCTION SET 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 LD OR AND NOT OUT LD TIM AND NOT OUT LD AND LD CNT LD TIM OUT FUN(01) 0000 200.00 TIM002 200.00 200.00 000 #100 TIM000 1000 0002 TIM000 TIM002 001 #002 CNT001 002 #200 1001 Figure Design PLC ladder diagram by using Holding Circuit to implement the timing diagram as shown in Figure4.5: 0002 0000 200.00 200.00 CNT001 TIM002 TIM002 TIM 000 #100 TIM000 1000 TIM000 CNT 001 #002 TIM 002 #200 1001 200.00 Lamp Sensor END Motor +Start IR 4.5 Address Instruction Data EXAMPLE 3
also
SPECIALINSTRUCTION SET
When PB1 (0001) is momentarily pressed, SET IR 200. 00 is energized and it will remain ON even if PB 1 is turned OFF. This condition keeps the output Lamp1 (1001) is turned ON. When PB2 (0002) is pressed,the RSET IR 200.00 is turned OFF. As a
+1001 200.00 200.00 200.00 Lamp 1 1001 + P B 10001 1001 0002 SET/RESET 0001 0002 SET RSET 200.00
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. result, lamp( )will be turned
APPLICATION OF SET/RESET
OFF. PB2 SET SET B RESET RESET B INPUT CONDITION Bit operand (B) may consist of data output or internal relay (IR) Set and Reset must used a same data
the
SPECIALINSTRUCTION SET Figure Design PLC ladder diagram by using SET and RESET instruction to implement the timing diagram as shown in Figure 4.7: By using the SET/RESET instruction, create a ladder diagram that will light up a pilot lamp after 5 second the pushbutton start (PB1) is pressed. Then, after pushing a push button stop (PB2), the lights will be turned off. + P B _ 14.7 + P B _ 10001 0002 200.00 TIM000 200.00 200.00 TIM000 0001 SET 200.00 RSET 200.00 TIM 000 #50 1001 SET 200.00 RSET TIM 000 #80 1001 1002 Example2 PB _ 1 END Pilot Lamp Lamp 1 Lamp 2 Example1 200.00 END
KEEP functions in almost the same way as a holding circuitand the SET/RSET instruction.
Set
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).
200.00 1001 + P B 10001 PB2 KEEP 0002 200.00 APPLICATION OF KEEP INSTRUCTION Lamp 1 KEEP B KEEP B:DataOutput/IR Input Condition Reset 200.00 0001 1001 0002
SPECIALINSTRUCTION SET
Figure 4.8 –KEEP instruction
When S is in the ON state, the operation of the KEEP instruction will be ON and remain ON until reset,regardless of whether Set is ON or OFF.When Reset is in the ON state,the operation of KEEP instruction is OFF.
SPECIALINSTRUCTION SET 0002 200.00 TIM000 0001 200.00 200.00 TIM000 0001 200.00 TIM 000 #100 1001 KEEP 200.0 0 TIM 000 #100 1001 1002 Figure Design a ladder diagram by using the KEEP instruction. The DC motor will run automatically after second the push button start (PB1) is pressed. Then, after pushing a push button stop (PB2), the DC motor will stop. Design PLC ladder diagram by using KEEP instruction to implement : 4.9 + P B _ 1Example1 Example2 PB _ 1 END END DC Motor Lamp 2 Lamp 1 the timing diagram as shown in Figure 4.9 KEEP
SPECIALINSTRUCTION SET TIM000 0001 200.00 200.00 0001 200.00 KEEP 200.0 0 TIM 000 #100 1001 1002 Figure 4.9 10 + P B _ 1+ P B _ 1Example1 Example2 PB _ 1 END END Lamp 2 Lamp 1 4.9 KEEP Figure 4.10 +Start Stop IR +TIM000 200.00 10 sec TIM000 0000 0001 200.00 200.00 TIM 001 TIM000 TIM 000 #50 TIM 001 #100 Red 1000 1001 200.00 5 sec TIM000 TIM000 0000 0001 200.00 TIM000 200.00 TIM001 TIM001 TIM 001 #10 0 KEEP 200.0 0 1000 TIM 000 #050 Green 1000 The ladder diagram below shows two types of programming design that can be used in this situation. Refer to the figure 4.10 ,it shows the system connection to control the traffic light. When start push button (PB1) is pressed, red light will turn ON for 5 seconds. After that, green light will turn ON for 10 second sand red light will turn OFF. The operation will repeat simultaneously until stop push button (PB2) is pressed to stop the operation. Construct this sequence using PLC ladder diagram. PB1 PB2 EXAMPLE PROGRAM : HOLDING CIRCUIT AND KEEP END Green Start END Red or
SPECIALINSTRUCTION SET 0001 200.00 200.00 0001 200 00 KEEP 200.0 0 TIM 000 #100 1001 1002 Figure 4.9 10 + P B _ 1+ P B _ 1Example1 Example2 PB _ 1 END END Lamp 2 Lamp 1 4.9 KEEP Figure 4.10 +Start Stop IR +TIM000 200.00 10 sec TIM000 TIM000 TIM 000 #50 TIM 001 #100 Red 1000 1001 200.00 TIM000 TIM000 0000 0001 200.00 TIM000 200.00 TIM001 TIM001 TIM 001 #10 0 KEEP 200.0 0 1000 TIM 000 #050 Green 1000 END Green Start END Red or KEEP instruction Figure In the final round of the polytechnic quiz competition, two students from the different polytechnics will compete agains teach other as shown in figure 4.11. If one of them presses the button faster, the desk light will remain on for 10 seconds until turning off. Those who press the button too late, their lights will not turn on. Draw the ladder diagram by using KEEP and SET/RSET instruction. +PB Player 1 4.11 SET/RESET instruction +Player 1 Player 2 PB Player 2 END Lamp Player 1 Lamp Player 2 PB _Player 1 PB _Player 2 END 1000 1001 0000 TIM000 0001 TIM000 1001 1000 TIM 000 #100 KEEP 1000 KEEP 1001 1000 1001 0000 TIM 000 0001 TIM 000 1001 1000 SET 1001 RSET 1001 TIM 000 #100 SET 1000 RSET 1000 EXAMPLE PROGRAM : KEEP ANDSET/RSET Lamp Player 1 Lamp Player 2 or
SPECIALINSTRUCTION SET 0001 200.00 200.00 0001 200.00 KEEP 200.0 0 TIM 000 #100 1001 1002 Figure 4.9 10 + P B _ 1+ P B _ 1Example1 Example2 PB _ 1 END END Lamp 2 Lamp 1 4.9 KEEP Figure 4.10 +Start Stop IR +TIM000 200.00 10 sec TIM000 TIM000 TIM 000 #50 TIM 001 #100 Red 1000 1001 200.00 5 sec TIM000 TIM000 0000 0001 200.00 TIM000 200.00 TIM001 TIM001 TIM 001 #10 0 KEEP 200.0 0 1000 TIM 000 #050 Green 1000 END Green Start END Red or KEEP instruction Figure +PB Player 1 4.11 SET/RESET instruction +Player 1 Player 2 PB Player 2 END Lamp Player 1 Lamp Player 2 PB _Player 1 PB _Player 2 END 1000 1001 0000 TIM000 0001 TIM000 1001 1000 TIM 000 #10 0 KEE P 100 0 KEE P 100 1 1000 1001 0001 TIM000 1001 1000 SET 100 1 RSE T 100 1 TIM 000 #10 0 SET 100 0 RSE T 100 0 Lamp Player 1 Lamp Player 2 or Figure DIFD instruction DIFU instructions will turn ON the bit when the input condition changes from OFF to ON (risingedge). When the input is turned ON, it is used to perform operations that require only ones can cycle.Figure 4.12 shows the ladder diagram and timing diagram for DIFU instruction. Figure 4.12 -DIFU instruction 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 ones can cycle. Figure 4.13 shows the ladder diagram and timing diagram for DIFD instruction. The Differentiate UP(DIFU) and Differentiate Down (DIFD) instruction area special instruction that will turn ON the output DIFFERENTIATE UP (DIFU) AND DIFFERENTIATE DOWN (DIFD) +In put DIFU B Input Condition B : Operand bit IR +Input DIFD B Input Condition B : Operand bit IR 1 scan 1 scan DIF U bit Input DIFD bit in a very short time. 4.13 –Input
SPECIALINSTRUCTION SET 0001 200.00 200.00 0001 200.00 KEEP 200.0 0 TIM 000 #100 1001 1002 Figure 4.9 10 + P B _ 1+ P B _ 1Example1 Example2 PB _ 1 END END Lamp 2 Lamp 1 4.9 KEEP Figure 4.10 +Start Stop IR +TIM000 200.00 10 sec TIM000 TIM000 TIM 000 #50 TIM 001 #100 Red 1000 1001 200.00 5 sec TIM000 TIM000 0000 0001 200.00 TIM000 200.00 TIM001 TIM001 TIM 001 #10 0 KEEP 200.0 0 1000 TIM 000 #050 Green 1000 END Green Start END Red or KEEP instruction Figure +PB Player 1 4.11 SET/RESET instruction +Player 1 Player 2 PB Player 2 END Lamp Player 1 Lamp Player 2 PB _Player 1 PB _Player 2 END 1000 1001 0000 TIM000 0001 TIM000 1001 1000 TIM 000 #10 0 KEE P 100 0 KEE P 100 1 1000 1001 0001 TIM000 1001 1000 SET 100 1 RSE T 100 1 TIM 000 #10 0 SET 100 0 RSE T 100 0 Lamp Player 1 Lamp Player 2 or 0001 0001 201.00 201.00 1002 1001 END END DIFD 201.00 1002 DIFD 201.00 Lamp 2 1002 +Switch 1 0000 DIFU 200.00 200.00 1001 +Switch 1 0000 DIFU 200.00 Lamp 1 200.00 1001 SW 2 DIFD SW 1 DIFU OFF OFF OFF OFF Based on the timing a bove,it shows the process output cannot be seen because the lamp will be ON within a very short time and thenOFF. To solve the above problem, use the holding circuit concept to en sure that both lamps are always turned ON. 0000 0001 0002 0003 0004 0005 0006 0007 0008 LD DIFU LD OR OUT LD DIFD LD OR 0000 200.00 200.00 1001 1001 0001 201.00 201.00 1002 APPLICATION EXAMPLE OF DIFU & DIFD 0001 201.00 LAMP 2 1002 0000 200.00 LAMP 1 1001 Switch 2 Switch 2 Lamp 1 Lamp 2 1 scan 1 scan Address Instruction Data 0009 OUT 1002
SPECIALINSTRUCTION SET 0001 200.00 200.00 0001 200.00 KEEP 200.0 0 TIM 000 #100 1001 1002 Figure 4.9 10 + P B _ 1+ P B _ 1Example1 Example2 ND END Lamp 2 Lamp 1 4.9 KEEP +Start Stop IR +TIM000 TIM 000 #50 1001 200.00 ec TIM000 TIM000 0000 0001 200.00 TIM000 200.00 TIM001 TIM001 TIM 001 #10 0 KEEP 200.0 0 1000 TIM 000 #050 Green 1000 END Green Start END Red or KEEP instruction +PB Player 1 4.11 SET/RESET instruction +Player 1 Player 2 END Lamp Player 1 PB _Player 1 PB _Player 2 END 1001 0000 TIM000 1001 000 #10 0 KEE P 100 1000 1001 0001 TIM000 1001 1000 SET 100 1 RSE T 100 1 TIM 000 #10 0 SET 100 0 RSE T 100 0 Lamp Player 1 Lamp Player 2 or 201.00 1002 END 1002 +Switch 1 0000 DIFU 200.00 200.001001 +Switch 1 0000 DIFU 200.00 Lamp 1 200.001001 SW 2 DIFD SW 1 DIFU OFF OFF OFF OFF Basedonthetimingabove,itshowstheprocessoutputcannotbeseen becausethelampwillbeONwithinaveryshorttimeandthenOFF. Tosolvetheaboveproblem,use theholdingcircuitconceptto ensurethatbothlampsarealways turnedON. 0000 0001 0002 0003 0004 0005 0006 0007 0008 LD DIFU LD OR OUT LD DIFD LD OR 0000 200.00 200.00 1001 1001 0001 201.00 201.00 1002 001 01.00 AMP 2 002 0000 200.00 LAMP 1 1001 Lamp 1 Lamp 2 1 scan 1 scan Address Instruction Data 0009 OUT 1002 Figure Figure When the push button is pressed and released, motor will turn ON.Then, conveyor will move to carry out the box and stop after a limit switch detects the next box as shown in Figure 4.14.This process will be repeated by an operator inverify the quality of the product in the box.Draw a ladder diagram for the system. Design PLC ladder diagram by using DIFD to implement the timing diagram shown in Figure 4.15: SwReset Limit Switch 200.00 0002 0001 CNT000 END END DIFU 200.0 0 CNT 000 #003 Motor 1001 +Sensor 0001 DIFD 200.00 + P u s h Button Motor 0001 200.00 1001 1001 APPLICATION EXAMPLE OF DIFU APPLICATION EXAMPLE OF DIFD 4.14 4.15
SPECIALINSTRUCTION SET 0001 200.00 200.00 0001 KEEP 200.0 0 TIM 000 #100 1001 1002 Figure 4.9 10 + P B _ 1+ P B _ 1Example1 Example2 END Lamp 2 Lamp 1 4.9 +Start Stop IR TIM000 TIM 000 #50 1001 200.00 TIM000 TIM000 0000 0001 200.00 TIM000 200.00 TIM001 TIM001 TIM 001 #10 0 KEEP 200.0 0 1000 TIM 000 #050 Green 1000 END Green Start END Red or KEEP instruction +PB Player 1 SET/RESET instruction +END Lamp Player 1 PB _Player 1 PB _Player 2 END 1001 0000 TIM000 1001 000 #10 0 KEE P 100 1000 1001 0001 TIM000 1001 1000 SET 100 1 RSE T 100 1 TIM 000 #10 0 SET 100 0 RSE T 100 0 Lamp Player 1 Lamp Player 2 or 201.00 1002 END 1002 +Switch 1 0000 DIFU 200.00 200.001001 +Switch 1 0000 DIFU 200.00 Lamp 1 200.001001 SW 1 DIFU OFF OFF Basedonthetimingabove,itshowstheprocessoutputcannotbeseen becausethelampwillbeONwithinaveryshorttimeandthenOFF. Tosolvetheaboveproblem,use theholdingcircuitconceptto ensurethatbothlampsarealways turnedON. 0000 0001 0002 0003 0004 0005 0006 0007 0008 LD DIFU LD OR OUT LD DIFD LD OR 0000 200.00 200.00 1001 1001 0001 201.00 201.00 1002 0000 200.00 LAMP 1 1001 Lamp 1 Lamp 2 1 scan Address Instruction Data 0009 OUT 1002 Figure Figure DesignPLCladderdiagrambyusingDIFDtoimplementthetiming diagramshowninFigure4.15: SwReset Limit Switch 200.00 0002 0001 CNT000 END END DIFU 200.0 0 CNT 000 #003 Motor 1001 +Sensor 0001 DIFD 200.00 APPLICATION EXAMPLE OF DIFD 4.14 4.15 Figure Interlock & Interlock Clear Instruction The interlock(IL) and interlock clear(ILC) instructions are used to lock or skipall out put conditions between IL and ILC when the input condition for IL isturned OFF. If IL is turned ON,no lock and skipping occur. IL and ILC must be used together as shownin Figure 4.16. When input 0000 is turned OFF,output 1001 that is between IL and ILC will be skipped and will not function.Then, when input 0001 is turned ON only output 1002 it will be turned ON because it is outside the interlock range. Now,when input 0000 is turned ON,all outputs that are between IL and ILC can execute normally, so output 1001 will be turned ON when switch 0001 is turned ON. Next, when input 0000 is turned OFF again, output 1001 will be turned OFF or reset. 1002 is out of range of IL and it will be controlled by 0001 0001 0001 0000 IL 1001 ILC 1002 IL (02) 4.16 –+IL / ILC APPLICATION OF IL AND ILC Input Condition 000 0 000 1 100 1 100 INTERLOCK / INTERLOCK CLEAR Input ILC (03)
SPECIALINSTRUCTION SET 0001 200.00 200.00 0001 KEEP 200.0 0 TIM 000 #100 1001 1002 Figure 4.9 10 + P B _ 1+ P B _ 1Example1 Example2 END Lamp 2 Lamp 1 4.9 +Start Stop IR TIM000 TIM 000 #50 1001 200.00 TIM000 TIM000 0000 0001 200.00 TIM000 200.00 TIM001 TIM001 TIM 001 #10 0 KEEP 200.0 0 1000 TIM 000 #050 Green 1000 END Green Start END Red or KEEP instruction +PB Player 1 SET/RESET instruction +END Lamp Player 1 PB _Player 1 PB _Player 2 END 1001 0000 TIM000 1001 000 #10 0 KEE P 100 1000 1001 0001 TIM000 1001 1000 SET 100 1 RSE T 100 1 TIM 000 #10 0 SET 100 0 RSE T 100 0 Lamp Player 1 Lamp Player 2 or 201.00 1002 END 1002 +Switch 1 0000 DIFU 200.00 200.001001 +Switch 1 0000 DIFU 200.00 Lamp 1 200.001001 SW 1 DIFU OFF OFF Basedonthetimingabove,itshowstheprocessoutputcannotbeseen becausethelampwillbeONwithinaveryshorttimeandthenOFF. Tosolvetheaboveproblem,use theholdingcircuitconceptto ensurethatbothlampsarealways turnedON. 0000 0001 0002 0003 0004 0005 0006 0007 0008 LD DIFU LD OR OUT LD DIFD LD OR 0000 200.00 200.00 1001 1001 0001 201.00 201.00 1002 0000 200.00 LAMP 1 1001 Lamp 1 Lamp 2 1 scan Address Instruction Data 0009 OUT 1002 Figure Figure DesignPLCladderdiagrambyusingDIFDtoimplementthetiming diagramshowninFigure4.15: SwReset Limit Switch 200.00 0002 0001 CNT000 END END DIFU 200.0 0 CNT 000 #003 Motor 1001 +Sensor 0001 DIFD 200.00 APPLICATION EXAMPLE OF DIFD 4.14 4.15 0001 TIM000 0002 0003 0004 0005 1002 TIM 000 #050 1001 CNT 001 #005 IL may be used many times in a row in the programme and should be ended by ILC .ILCs should not be used unless at least one IL is provided. The ladder diagram and mnemonic code in Figure 4.17 represents IL being used twice with one ILC. 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 1000 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, TIM 000 will be reset and outputs 1001 and 1002 will be turned OFF but CNT 001 will not change. CNT 001 will not reset when input 0005 is turned ON. Figure Application of IL being used twice with one ILC. + 0 0 0 00000 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 LD IL LD TIM LD OUT LD IL LD OUT LD LD CNT ILC 0000 0001 000 #050 TIM 000 1001 0002 0003 1002 0004 0005 001 #005 4.17 –INTERLOCK / INTERLOCK CLEAR IL IL ILC Address Instruction Data
The Jump (JMP) and Jump End (JME) instructions can be used to skip all output conditions between JMP and JME when the input condition for JMP is turned OFF. If JMP is turned ON all program can execute normally. Although this instruction is very similar to Interlock(IL), but the JMP instruction will retain or not changed the status of all its outputs after JMP is turned OFF. Figure 4.18 shows the JMP and JME instruction. input 0000 is turned OFF, output 1001 that is between JMP and JME will be skipped. Then, when input 0001 is turned ON only output 1002 it will be turned ON because it is outside the JMP range.Now, when input 0000 is turned ON, all outputs that are between JMP and JME can execute normally, so output 1001 will beturned ON when switch 0001 is turned ON. Next, when input 0000 is turned OFF again, it will move to the JME instruction without changing the status of output 1001.
SPECIALINSTRUCTION SET
0000 0001 0001 JMP #1 1001 JME #1 1002 JMP #1 JME #1 #Jump Number can be from 0 99 (depend type of PLC) APPLICATION OF JMP AND JME 4.18 –Input Condition 000 0 000 1 100 1002isoutofrangeofJMP JUMP / JUMP END IL / ILC Input
When
Figure Jump and Jump End Instruction
SPECIALINSTRUCTION SET 1002isoutofrangeofJMP The following ladder diagram is similar to the Interlock(IL) example, except that it uses JUMP instruction. The ladder diagram and mnemonic code in Figurer 4.19 epresents JMP being used twice with one JME. Figure 4.19 –Application of JMPbeing used twice with one JME. When input 0000 for 1st JMP is turned ON and 0002 for 2nd JMP is turned OFF, TIM 000 will be activated for 5 seconds and output 1001 will be turned ON but CNT 001 will not be changed and output 1002 will remainas 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 un changed. 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 LD JMP LD TIM LD OUT LD JMP LD OUT LD LD CNT JME 0000 #1 0001 000 #050 TIM000 1001 0002 #1 0003 1002 0004 0005 001 #005 #1 0 0 0 0 0001 0004 0005 TIM000 0002 JMP #1 JMP #1 TIM 000 #050 1001 CNT 001 #005 JME #1 JUMP / JUMP END 0003 1002 Address Instruction Data
based
0001 1 0 0 1 By using
Based on the Figure 4.20, what happen to a circuit when push button 1 (0000) is turned ON and then, the push button 1 is turned OFF. 4.21.
+ P B 10000 1001 0001 Figure 4.21 0002 Figure 4.22 1000 1000
1002isoutofrangeofJMP Data
Explain the function of internal relay (IR) instruction using a ladder diagram and mnemonic code.
Explain the operation of SET and RESET by referring to Figure 4.22.
TUTORIAL QUESTION on the timing diagram shown in Figure KEEP instruction set, draw the PLC ladder diagram
SET RSET PB2
Understand MOTORCONTROLcircuit 5.0 MOTOR CONTROL CIRCUIT
5.0 MOTOR CONTROL CIRCUIT
When the "Forward" pushbutton is actuated, M1 will energize, closing the normally-open auxiliary contact in parallel with that switch. When the pushbutton is released: the closed M1 auxiliary contact will maintain current to the coil of M1, thus latching the "Forward" circuit in the "on" state
Since the circuit exists at this time, the motor will run forward or backward once the corresponding button is pressed and will continue to run as long as there is power. To stop any of the circuits (forward or backward), we require some means for the operator to interrupt the power supply to the motor contactors. We will call this new switch stop.
5.0 MOTOR CONTROL CIRCUIT
TostoptheMotors:
ForwardandReversing Problem:
If we press the reverse button, while the motor running in the forward direction, the motor would struggle to overcome that inertia of the large fan when it tried to start turning in reverse, and it cause a reduction in motor’s lifetime and mechanical damages etc.
To overcome this problem we have to use time relay coils. What we want each time delay contact to do is open the starter switch section of the opposite rotation circuit for several seconds, while the fan stops.
5.0 MOTOR CONTROL CIRCUIT
1 and TD2 are two timer relay added to the circuit, both 1 and TD1 will have been activated.
5.0 MOTOR CONTROL CIRCUIT
hen the stop button is pressed, the TD1 contact waits for e specified amount of time before returning to its rmally closed state, thus keeping the back button circuit open for the time necessary for M2 not to be activated.
is being the case, the normally closed and timed contact TD1 between cables 8 and 5 will have been opened mediately at the time TD1 was activated.
When TD1 times out, the contact will close and the circuit will allow M2 to energize, if the backspace button is ressed. Similarly, TD2 will prevent the “Forward” button from energizing M1 until the prescribed time delay has been deactivated after M2 (and TD2).
ForwardandReversing
Problem:
ForwardandReversing Problem:
5.0 MOTOR CONTROL CIRCUIT
We can simplify the logic program by avoiding the auxiliary contacts M1 and M2. Note that the time interlock functions of TD1 and TD2 make the interlocking contacts M1 and M2 redundant.
Each time the delay relay will have a double purpose: to prevent the other contactor from being energized while the motor is running, and to prevent the same contactor from being energized until a prescribed time after the motor has been turned off. The resulting circuit has the advantage of being simpler than the previous example:
5.0 MOTOR CONTROL CIRCUIT
BasicPLCprogramforcontrol ofthree-phaseAC
motor In this example, a motor stater coil (M)is wired in series with a normally open, momentary Start pushbutton, a normally closed, momentary Stop pushbutton, and normally closed overload relay (OL)contact . Momentarily pressing the Start pushbutton completes the path for current flow and energizes the motor starter (M). This closes the associated M and Ma (auxiliary contact located in the motor starter) contacts.
REFERENCES 1) Frank D.Petruzella (2005). Programmable Logic Controllers (4 edition) McGraw Hill (ISBN 978-0-07-122135-1) 2)Nor Syuhada binti Ayob, Mohd Adib bin Zakaria (2018). Practical Work Assessment DEJ5153 PLC & AUTOMATION (ISBN 978-967-209926-0 3)Petruzella,F.D.(2017).ProgrammableLogic Controllers.NewYork.McGraw-HillCompanie
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.