31
1 PROGRAMMABLE LOGIC CONTROLLER (PLC) 1 EJ501 CONTROLLER (PLC) AND AUTOMATION SBO/ PMM/ EJ501/ Jun2011

PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

Embed Size (px)

Citation preview

Page 1: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

1

PROGRAMMABLE LOGICCONTROLLER (PLC)AND AUTOMATION

1

EJ501

PROGRAMMABLE LOGICCONTROLLER (PLC)AND AUTOMATION

SBO/ PMM/ EJ501/ Jun2011

Page 2: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

2

UNIT 4PLC PROGRAMMING

2

Objective

1. Language of PLC and PLC programming method.2. Basic Logic Instruction Set3. Special Sequential Function4. Timer & Counter

SBO/ PMM/ EJ501/ Jun2011

Objective

1. Language of PLC and PLC programming method.2. Basic Logic Instruction Set3. Special Sequential Function4. Timer & Counter

Page 3: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

3

UNIT 4PLC PROGRAMMING

3

PLC Programming Languages

IEC 1131-3 is the international standard for programmable controllerprogramming languages. The following is a list of programming languagesspecified by this standard:

Ladder diagram (LD)Sequential Function Charts (SFC)Function Block Diagram (FBD)Structured Text (ST)Instruction List (IL)

One of the primary benefits of the standard is that it allows multiplelanguages to be used within the same programmable controller. This allowsthe program developer to select the language best suited to each particulartask.

SBO/ PMM/ EJ501/ Jun2011

PLC Programming Languages

IEC 1131-3 is the international standard for programmable controllerprogramming languages. The following is a list of programming languagesspecified by this standard:

Ladder diagram (LD)Sequential Function Charts (SFC)Function Block Diagram (FBD)Structured Text (ST)Instruction List (IL)

One of the primary benefits of the standard is that it allows multiplelanguages to be used within the same programmable controller. This allowsthe program developer to select the language best suited to each particulartask.

Page 4: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

4

UNIT 4PLC PROGRAMMING

4

Ladder Diagram

Ladder diagram is the main programming method used for PLC's. As mentioned before,ladder logic has been developed to mimic relay logic. The decision to use the relaylogic diagrams was a strategic one. By selecting ladder logic as the main programmingmethod, the amount of retraining needed for engineers and trades people was greatlyreduced.

The first PLC was programmed with a technique that was based on relay logic wiringschematics. This eliminated the need to teach the electricians, technicians andengineers how to program - so this programming method has stuck and it is the mostcommon technique for programming in today's PLC.

Mnemonic Instruction

There are other methods to program PLCs. One of the earliest techniques involvedmnemonic instructions. These instructions can be derived directly from the ladder logicdiagrams and entered into the PLC through a simple programming terminal.

SBO/ PMM/ EJ501/ Jun2011

Ladder Diagram

Ladder diagram is the main programming method used for PLC's. As mentioned before,ladder logic has been developed to mimic relay logic. The decision to use the relaylogic diagrams was a strategic one. By selecting ladder logic as the main programmingmethod, the amount of retraining needed for engineers and trades people was greatlyreduced.

The first PLC was programmed with a technique that was based on relay logic wiringschematics. This eliminated the need to teach the electricians, technicians andengineers how to program - so this programming method has stuck and it is the mostcommon technique for programming in today's PLC.

Mnemonic Instruction

There are other methods to program PLCs. One of the earliest techniques involvedmnemonic instructions. These instructions can be derived directly from the ladder logicdiagrams and entered into the PLC through a simple programming terminal.

Page 5: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

5

UNIT 4PLC PROGRAMMING

5

Sequential Function Charts (SFC)

SFC have been developed to accommodate the programming of more advancedsystems. These are similar to flowcharts, but much more powerful. This method ismuch different from flowcharts because it does not have to follow a single path throughthe flowchart.

Structured Text (ST)

Programming has been developed as a more modern programming language. It is quitesimilar to languages such as BASIC and Pascal.Structured Text (ST) is a high level textual language that is a Pascal like language. It isvery flexible and intuitive for writing control algorithms.

Function Block Diagram (FBD)

FBD is another graphical programming language. The main concept is the data flowthat start from inputs and passes in block(s) and generate the output.

SBO/ PMM/ EJ501/ Jun2011

Sequential Function Charts (SFC)

SFC have been developed to accommodate the programming of more advancedsystems. These are similar to flowcharts, but much more powerful. This method ismuch different from flowcharts because it does not have to follow a single path throughthe flowchart.

Structured Text (ST)

Programming has been developed as a more modern programming language. It is quitesimilar to languages such as BASIC and Pascal.Structured Text (ST) is a high level textual language that is a Pascal like language. It isvery flexible and intuitive for writing control algorithms.

Function Block Diagram (FBD)

FBD is another graphical programming language. The main concept is the data flowthat start from inputs and passes in block(s) and generate the output.

Page 6: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

6

UNIT 4PLC PROGRAMMING

6

Ladder Diagram

SBO/ PMM/ EJ501/ Jun2011

Page 7: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

7

UNIT 4PLC PROGRAMMING

7

Ladder Diagram Format

SBO/ PMM/ EJ501/ Jun2011

Page 8: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

8

UNIT 4PLC PROGRAMMING

8

Ladder Diagram Format

SBO/ PMM/ EJ501/ Jun2011

Page 9: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

9

UNIT 4PLC PROGRAMMING

9

Boolean

SBO/ PMM/ EJ501/ Jun2011

Page 10: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

10

The form of programming commonly used with PLCs is ladder programming. This involves each program task being specified as though a rung of a ladder Thus such a rung could specify that the state of switches A and B, the inputs be

examined and if A and B are both closed then a solenoid, the output is energized.

Ladder Programming

UNIT 4PLC PROGRAMMING

The form of programming commonly used with PLCs is ladder programming. This involves each program task being specified as though a rung of a ladder Thus such a rung could specify that the state of switches A and B, the inputs be

examined and if A and B are both closed then a solenoid, the output is energized.

(a)&(b) Alternative ways of drawing an electric circuit, (c) comparable rung in a ladder program

Page 11: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

11

UNIT 4PLC PROGRAMMING

Page 12: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

12

Logic instruction can be obtained by combinations of switches

Logic Instruction

1. LOAD (LD) and LOAD NOT (LD NOT)

UNIT 4PLC PROGRAMMING

A prefix contacts at the bus bar. If at the prefix of the bus bar is theNO(normaly open) contacts, then the instruction is LOAD or LD. For theNC(normaly closed) contacts, then the instruction is LOAD NOT or LD NOT.

A prefix contacts at the bus bar. If at the prefix of the bus bar is theNO(normaly open) contacts, then the instruction is LOAD or LD. For theNC(normaly closed) contacts, then the instruction is LOAD NOT or LD NOT.

Page 13: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

13

2. AND and AND NOT

UNIT 4PLC PROGRAMMING

The instruction for series connection in the ladder. For NO(normaly open)contacts, then the instruction is AND. For NC(normaly closed) contacts, then theinstruction is AND NOT.

Page 14: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

14

3. OR and OR NOT

UNIT 4PLC PROGRAMMING

The instruction for parallel connection in the ladder. For NO(normaly open)contacts, then the instruction is OR. For NC(normaly closed) contacts, thenthe instruction is OR NOT

Page 15: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

15

4. OR LD and AND LD

UNIT 4PLC PROGRAMMING

The union between a parallelconnection which is connected intoone, so if there are two parallelcircuits are combined into one, thenthe instruction is AND LOAD.

The union between a series connectionwhich is connected into one, so if thereare two series circuits are combined intoone, then the instruction is OR LOAD.

The union between a parallelconnection which is connected intoone, so if there are two parallelcircuits are combined into one, thenthe instruction is AND LOAD.

Page 16: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

16

5. OUT and OUT NOT

UNIT 4PLC PROGRAMMING

The instruction for output or load, such as Relay, Contactor, Light, Buzzer, andothers. If the output is NO(normaly open), then the instruction is OUT, but if theoutput is NC(normaly closed), then the instruction is OUT NOT.

6. ENDThe instruction for the end of the program, if a program does not end with theEND instruction code, the program will not be able to do (error).

Page 17: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

17

UNIT 4PLC PROGRAMMING

Table : Instruction code mnemonics

Page 18: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

18

Logic Solution and Ladder Diagram Representation

UNIT 4PLC PROGRAMMING

Page 19: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

19

Special Sequential Function

UNIT 4PLC PROGRAMMING

KEEP

KEEP instruction is used to store thestatus of a bit operand based on twoexecution conditions. For this purpose,KEEP instruction is connected to twolines of instructions. The firstinstruction line is used to enable aoperand bit, while the secondinstruction line is used to disable aoperand bit , it will happen ifconditions on the execution ofinstruction line associated is ON. Toactivate KEEP press FUN 11.

KEEP

KEEP instruction is used to store thestatus of a bit operand based on twoexecution conditions. For this purpose,KEEP instruction is connected to twolines of instructions. The firstinstruction line is used to enable aoperand bit, while the secondinstruction line is used to disable aoperand bit , it will happen ifconditions on the execution ofinstruction line associated is ON. Toactivate KEEP press FUN 11.

Page 20: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

20

UNIT 4PLC PROGRAMMING

SET

Turns ON B for an ON executioncondition; does not affect B foran OFF execution condition

RESET

Turns OFF B for an ONexecution condition; does notaffect B for an OFF execution

condition.

Page 21: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

21

UNIT 4PLC PROGRAMMING

JUMP (JMP) and JUMP END (JME)

JUMP instruction (JMP), same as the interlock instructions, coupled with the JUMP END (JME). Ifthe execution condition and a JUMP instruction is ON, the program worked normally as if nothingJUMP instruction. However, if the condition executed and a JUMP instruction is OFF, thenexecution of the program directly to the JUMP END instruction without making any changes instatus between JUMP and JUMP END instruction. All JUMP and JUMP END instruction was giventhe number 01 to 99. This number is only used once, meaning that, in the ladder diagram can notexist JUMP numbers double or more and one, except for number 00. JUMP instruction is done witha certain number, then the execution will go directly to JUMP END with the same number. Toactivate JUMP press FUN 04 and JUMP END press FUN 05.

JUMP (JMP) and JUMP END (JME)

JUMP instruction (JMP), same as the interlock instructions, coupled with the JUMP END (JME). Ifthe execution condition and a JUMP instruction is ON, the program worked normally as if nothingJUMP instruction. However, if the condition executed and a JUMP instruction is OFF, thenexecution of the program directly to the JUMP END instruction without making any changes instatus between JUMP and JUMP END instruction. All JUMP and JUMP END instruction was giventhe number 01 to 99. This number is only used once, meaning that, in the ladder diagram can notexist JUMP numbers double or more and one, except for number 00. JUMP instruction is done witha certain number, then the execution will go directly to JUMP END with the same number. Toactivate JUMP press FUN 04 and JUMP END press FUN 05.

Page 22: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

22

UNIT 4PLC PROGRAMMING

INTERLOCK (IL) and INTERLOCK CLEAR (ILC)

These instructions can also be used to overcome the branching points encountered on the ladderdiagrams. Instruction IL - ILC is always used together. Instruction interlock if the executioncondition is OFF (all instructions between interlock and interlock clear will not be done). Toactivate IL press FUN 02 and ILC press FUN 03.

Page 23: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

23

UNIT 4PLC PROGRAMMING

DIFFERENTIATE UP (DIFU) and DIFFERENTIATE DOWN (DIFD)

DIFU instruction used to enable bit operand instantaneous (only one cycle) during transition of theexecution condition from OFF to ON. While DIFD instruction used for the same purpose withDIFU, only when there is a transition state of the execution from ON to OFF (reverse transitionDIFU). To activate press DIFU FUN 13 and DIFD press FUN 14.

Page 24: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

24

UNIT 4PLC PROGRAMMING

SHIFT REGISTER (SFT)

Function of Shift Registers (SFT) is to shift the data by using the clock pulse. Data which can be shifted are IR,AR, HR, LR. Shift Registers has three inputs; data input (I), clock input (P) and reset (R). Data Input is used toenter data into location of data channel. Clock input is used to enter the clock to shift the data that has beenincorporated into the input data through location of data channel . Reset input have function to create the initialconditions (0) all bits in the locations of data channel. The other is the initial of data lines (St) occupied bits startbit is shifted and the final of the data channel (E) which serves as the final borders of the bits are bits that areshifted. St must be greater or equal than E and must be on the same data area. To operate SFT press FUN 10.

SHIFT REGISTER (SFT)

Function of Shift Registers (SFT) is to shift the data by using the clock pulse. Data which can be shifted are IR,AR, HR, LR. Shift Registers has three inputs; data input (I), clock input (P) and reset (R). Data Input is used toenter data into location of data channel. Clock input is used to enter the clock to shift the data that has beenincorporated into the input data through location of data channel . Reset input have function to create the initialconditions (0) all bits in the locations of data channel. The other is the initial of data lines (St) occupied bits startbit is shifted and the final of the data channel (E) which serves as the final borders of the bits are bits that areshifted. St must be greater or equal than E and must be on the same data area. To operate SFT press FUN 10.

Page 25: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

25

UNIT 4PLC PROGRAMMING

MOVE (MOV)

Move instruction is a function to move or transfer or to copy data from source (S) to destination(D). To operate MOV press FUN 21.

Page 26: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

26

UNIT 4PLC PROGRAMMING

ADD (30)

Have function to add threepieces of parameters: data 1(Au), data 2 (Ad) and carry(CY), then the results areplaced on data 3 (R). carrywill be set to 1 if the sum isgreater than 9999.

ADD (30)

Have function to add threepieces of parameters: data 1(Au), data 2 (Ad) and carry(CY), then the results areplaced on data 3 (R). carrywill be set to 1 if the sum isgreater than 9999.

Page 27: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

27

UNIT 4PLC PROGRAMMING

SUB (31)

Have function to subtractthree pieces ofparameters: data 1 (Mi),data 2 (Su) and carry(CY), then the results areplaced on data 3 (R). Ifthe result is negative thencarry will be set to 1.

SUB (31)

Have function to subtractthree pieces ofparameters: data 1 (Mi),data 2 (Su) and carry(CY), then the results areplaced on data 3 (R). Ifthe result is negative thencarry will be set to 1.

Page 28: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

28

UNIT 4PLC PROGRAMMING

TIMER (TIM)

A timer is activated when its execution condition goes ON and is reset (to SV) whenthe execution condition goes OFF. Once activated, TIM measures in units of 0.1second from the SV.

If the execution condition remains ON long enough for TIM to time down to zero, theCompletion Flag for the TC number used will turn ON and will remain ON until TIMis reset (that is, until its execution condition goes OFF).

N : Timer Number --> 000 - 511SV : Set value (#0050) – 5 sec (50 x 0.1sec)

TIMER (TIM)

A timer is activated when its execution condition goes ON and is reset (to SV) whenthe execution condition goes OFF. Once activated, TIM measures in units of 0.1second from the SV.

If the execution condition remains ON long enough for TIM to time down to zero, theCompletion Flag for the TC number used will turn ON and will remain ON until TIMis reset (that is, until its execution condition goes OFF).

N : Timer Number --> 000 - 511SV : Set value (#0050) – 5 sec (50 x 0.1sec)

Page 29: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

29

UNIT 4PLC PROGRAMMING

Page 30: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

30

UNIT 4PLC PROGRAMMING

COUNTER (CNT)

Counter is used for count the setting value (SV) towards 0 when the pulse counter (CP) changesfrom OFF to ON. After the counter value changes to 0 then the counter output status will changefrom OFF to ON and will persist as long as the reset button (R) has not been pressed. When thereset button is pressed, status of the output counter will be OFF and the counter value back to theoriginal setting value. The number of counter that can be used up to 511. Do not give the samenumber on counter Timer.

COUNTER (CNT)

Counter is used for count the setting value (SV) towards 0 when the pulse counter (CP) changesfrom OFF to ON. After the counter value changes to 0 then the counter output status will changefrom OFF to ON and will persist as long as the reset button (R) has not been pressed. When thereset button is pressed, status of the output counter will be OFF and the counter value back to theoriginal setting value. The number of counter that can be used up to 511. Do not give the samenumber on counter Timer.

N : Counter Number --> 000 - 511SV : Set value (#0010) – 10 counter

Page 31: PROGRAMMABLE LOGIC CONTROLLER (PLC) … UNIT 4 PLC PROGRAMMING Ladder Diagram Ladder diagram is the main programming method used for PLC's. As mentioned before, ladder logic has been

31

UNIT 4PLC PROGRAMMING