Chapter 9 - Program Control Instructions

60
7/25/2019 Chapter 9 - Program Control Instructions http://slidepdf.com/reader/full/chapter-9-program-control-instructions 1/60 © 2011, The McGraw-Hill Companies, Inc. Chapter 9

Transcript of Chapter 9 - Program Control Instructions

Page 1: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 1/60

© 2011, The McGraw-Hill Companies, Inc.

Chapter 9

Page 2: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 2/60

© 2011, The McGraw-Hill Companies, Inc.

Master Control ResetInstruction

9.1

Page 3: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 3/60

© 2011, The McGraw-Hill Companies, Inc.

Program control instructions  are used to enable

or disable a block of logic program or to move

execution of a program from one place toanother place.

Program Control menu tab for the Allen-Bradley

SLC 500 PLC

Page 4: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 4/60

© 2011, The McGraw-Hill Companies, Inc.

Hardwired master control relays  

are used in relay control circuitry

to provide input/output powershutdown of an entire circuit.

Hardwired

master control 

relay circuit.

Page 5: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 5/60

© 2011, The McGraw-Hill Companies, Inc.

PLC manufacturers offer a form of a master

control relay as part of their instruction set.

Because the MCR instruction is programmed, for safety

reasons, it should not be used as a substitute for a

hardwired master control relay, which provides

emergency I/O power shutdown.

MCR (Master Control Reset) -Clears all set

nonretentive output rungs between the paired MCR

instructions.

Page 6: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 6/60

© 2011, The McGraw-Hill Companies, Inc.

Programmed Master Control Reset instruction.

Page 7: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 7/60© 2011, The McGraw-Hill Companies, Inc.

Simulated Master Control Reset instruction.

Page 8: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 8/60© 2011, The McGraw-Hill Companies, Inc.

MCR fenced zone  with the zone true .

Page 9: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 9/60© 2011, The McGraw-Hill Companies, Inc.

MCR fenced zone  with the zone false .

Page 10: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 10/60© 2011, The McGraw-Hill Companies, Inc.

Simulated MCR fenced zone.

Page 11: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 11/60© 2011, The McGraw-Hill Companies, Inc.

Jump Instruction

9.2

Page 12: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 12/60

© 2011, The McGraw-Hill Companies, Inc.

The jump (JMP) instruction is used to jump over

certain program instructions when certain

conditions exist.

The label instruction is used to identify the ladder rung

that is the target destination but does not contribute tologic continuity.

Page 13: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 13/60

© 2011, The McGraw-Hill Companies, Inc.

Jump (JMP) operation program.

Page 14: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 14/60

© 2011, The McGraw-Hill Companies, Inc.

Simulated jump (JMP) operation program.

Page 15: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 15/60

© 2011, The McGraw-Hill Companies, Inc.

Effect on

instructions

of jumped

rungs.

Page 16: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 16/60

© 2011, The McGraw-Hill Companies, Inc.

Jump-to-label from two locations.

Page 17: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 17/60

© 2011, The McGraw-Hill Companies, Inc.

Subroutine Functions

9.3

Page 18: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 18/60

© 2011, The McGraw-Hill Companies, Inc.

A subroutine  is a short program that is used by

the main program to perform a specific function.

JSR (Jump to

Subroutine) 

Jump to a

designatedsubroutine

instruction.

RET (Return from

Subroutine) 

Exits current

subroutineand returns to

previous condition.

SBR

(Subroutine) 

Identifies the

subroutineprogram.

Page 19: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 19/60

© 2011, The McGraw-Hill Companies, Inc.

When a subroutine is called from the main program,

the program is able to escape from the main program

and go to a program subroutine to perform certain

functions and then return to the main program.

Page 20: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 20/60

© 2011, The McGraw-Hill Companies, Inc.

Flashing pilot light subroutine program.

Anytime the weight on the conveyor exceeds a

preset value, the subroutine program is scanned

and pilot light changes from on to flashing.

Page 21: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 21/60

© 2011, The McGraw-Hill Companies, Inc.

Main

Program

Subroutine

Program

Page 22: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 22/60

© 2011, The McGraw-Hill Companies, Inc.

Simulated subroutine program.

Page 23: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 23/60

© 2011, The McGraw-Hill Companies, Inc.

Setting up a

subroutine file.

Page 24: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 24/60

© 2011, The McGraw-Hill Companies, Inc.

Passing

subroutine

parameters

Page 25: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 25/60

© 2011, The McGraw-Hill Companies, Inc.

Nested subroutines.

Page 26: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 26/60

© 2011, The McGraw-Hill Companies, Inc.

Immediate Input and

Immediate OutputInstructions

9.4

Page 27: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 27/60

© 2011, The McGraw-Hill Companies, Inc.

The immediate input  and immediate output  

instructions interrupt the normal program scan

to update the input and output image table fileswith current data.

Immediate input

(IIN) 

PLC-5 instructionis used to read an

input condition

before the I/O

update is performed.

Immediate output

(IOT) 

PLC-5 instructionis used to update the

status of an output

device before the I/O

update is performed.

Page 28: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 28/60

© 2011, The McGraw-Hill Companies, Inc.

Immediate input

instruction operation.

Page 29: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 29/60

© 2011, The McGraw-Hill Companies, Inc.

Immediate output

instruction operation.

Page 30: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 30/60

© 2011, The McGraw-Hill Companies, Inc.

SLC 500 Immediate I nput with Mask (I IM )  

instruction.

When the rung is true,

the program scan is

interrupted, and data

from a specific inputslot are transferred

through the mask  to

the input data file.

Page 31: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 31/60

© 2011, The McGraw-Hill Companies, Inc.

SLC 500 Immediate Output with Mask (I OM)  

instruction.

When the rung is

true, the program

scan is interrupted to

update output data tothe module located in

the slot specified in

the instruction.

9 5

Page 32: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 32/60

© 2011, The McGraw-Hill Companies, Inc.

Forcing External I/O

Addresses

9.5

C

Page 33: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 33/60

© 2011, The McGraw-Hill Companies, Inc.

Forcing  allows the PLC

user to turn an external

input or output on or off  

from the keyboard of the

programming device.

Forcing is accomplished

regardless of the actual

state of the field device.

Page 34: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 34/60

© 2011, The McGraw-Hill Companies, Inc.

Forcing an

input on.

Page 35: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 35/60

© 2011, The McGraw-Hill Companies, Inc.

Simulating forcing an input on.

Page 36: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 36/60

© 2011, The McGraw-Hill Companies, Inc.

Forcing an

output on.

Page 37: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 37/60

© 2011, The McGraw-Hill Companies, Inc.

Simulating forcing an output on.

Page 38: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 38/60

© 2011, The McGraw-Hill Companies, Inc.

By forcing outputs off , you can prevent the

controller from energizing those outputs even

though the ladder logic, which normallycontrols them, may be true.

Page 39: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 39/60

© 2011, The McGraw-Hill Companies, Inc.

You can enter and enable or disable forces while

you are monitoring your file offline, or in any

processor mode while monitoring your file online.

Forces version of the data table with bit

I:1/3 forced on.

Page 40: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 40/60

© 2011, The McGraw-Hill Companies, Inc.

If used incorrectly , force functions can cause

injuries to persons working around a system,

and/or equipment damage.You must

understand the

potential effect that

forcing given inputs

or outputs will have

on machine

operation in order toavoid possible

personal injury and

equipment damage.

9 6

Page 41: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 41/60

© 2011, The McGraw-Hill Companies, Inc.

Safety Circuitry

9.6

Page 42: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 42/60

© 2011, The McGraw-Hill Companies, Inc.

Sufficient emergency

circuits must be

provided to stopeither partially or

totally  the operation of

the controller or the

controlled machine or

process.

These circuits should

be hardwired outside

the controller.

Page 43: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 43/60

© 2011, The McGraw-Hill Companies, Inc.

Safety wiring

requirements for aPLC installation.

Page 44: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 44/60

© 2011, The McGraw-Hill Companies, Inc.

The master

control relay 

must be able

to inhibit all

machine

motion byremoving

power to the

machine I/O

devices whenthe relay is

deenergized.

Page 45: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 45/60

© 2011, The McGraw-Hill Companies, Inc.

Safety PLCs are now available for applications

that require more advanced safety functionality.

Page 46: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 46/60

© 2011, The McGraw-Hill Companies, Inc.

Both standard and safety PLCs have the ability

to perform control functions but a standard

PLC was not initially designed to be faulttolerant and fail-safe.

Safety PLCs have redundant (dual) microprocessors.

Safety PLCs have an internal output circuit

associated with each input for the purpose of testing

the input circuitry.

Safety PLCs use power supplies designed specifically

for use in safety control systems and redundant

backplane circuitry between the controller and I/O

modules.

Th f th fi ld

Page 47: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 47/60

© 2011, The McGraw-Hill Companies, Inc.

The use of the field-

generated starter auxiliary

contact is safer because it

provides positive feedback

to the processor about the

exact status of the motor.

All b h ld b i d i

Page 48: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 48/60

© 2011, The McGraw-Hill Companies, Inc.

All stop buttons should be wired using a

normally closed  contact programmed to examine

for an on condition .

Using a normally open contactprogrammed to examine for an off

condition will produce the same logic but

is not considered to be as safe.

9 7

Page 49: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 49/60

© 2011, The McGraw-Hill Companies, Inc.

Selectable TimedInterrupt

9.7

Page 50: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 50/60

© 2011, The McGraw-Hill Companies, Inc.

The selectable timed interrupt (STI ) instruction is

used to interrupt  the scan of the main program

file automatically, on a time basis , to scan aspecif ied subroutine f i le .

The selectable timed disable

(STD)  instruction is generally

paired with the selectable timed

enable (STE)  instruction tocreate zones in which STI

interrupts cannot occur.

Page 51: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 51/60

© 2011, The McGraw-Hill Companies, Inc.

The selectable timed

disable (STD)instruction

is generally paired

with the selectabletimed enable

(STE) instruction to

create zones in which

STI interrupts

cannot occur.

9 8

Page 52: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 52/60

© 2011, The McGraw-Hill Companies, Inc.

Fault Routine

9.8

A f l t b ti f i l if d d t i h

Page 53: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 53/60

© 2011, The McGraw-Hill Companies, Inc.

A faul t subroutine f i le , if used, determines how

the processor responds to a programming error.

When the processor detects a major fault, it looks for a

fault routine. If a fault routine exists, it is executed; if one

does not exist, the processor shuts down.

When there is a fault routine, and the fault is

recoverable, the fault routine is executed.

If the fault is non-recoverable, the fault routine

is scanned once and shuts down.

9 9

Page 54: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 54/60

© 2011, The McGraw-Hill Companies, Inc.

Temporary EndInstruction

9.9

Th t d (TND) i t ti i d t

Page 55: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 55/60

© 2011, The McGraw-Hill Companies, Inc.

The temporary end (TND) instruction is used to

progressively debug a program or conditionally

omit the balance of your current program file orsubroutines.

When rung conditions are true,

this instruction stops the

program scan, updates the I/O,

and resumes scanning at rung

0 of the main program file.

Page 56: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 56/60

© 2011, The McGraw-Hill Companies, Inc.

The TND instruction

lets your program run

only up to this

instruction.

You can move it progressively 

through your program as youdebug each new section.

You can program the TND

instruction unconditionally, or

you can condition its rung

according to your debugging

needs.

Si l t d t d i t ti

Page 57: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 57/60

© 2011, The McGraw-Hill Companies, Inc.

Simulated temporary end instruction program.

9 10

Page 58: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 58/60

© 2011, The McGraw-Hill Companies, Inc.

Suspend Instruction

9.10

Page 59: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 59/60

© 2011, The McGraw-Hill Companies, Inc.

The suspend (SUS) instruction is used to trap

and identify specific conditions during system

troubleshooting and program debugging.

When the rung is true the SUS

Page 60: Chapter 9 - Program Control Instructions

7/25/2019 Chapter 9 - Program Control Instructions

http://slidepdf.com/reader/full/chapter-9-program-control-instructions 60/60

When the rung is true, the SUS

output instruction places the

controller in the suspend mode

and the PLC immediatelyterminates scan cycling.

All ladder logic outputs are de-energized, but other

status files have the data present when the suspendinstruction is executed.

The SUS instruction writes the suspend ID number

(100) to S:7 as it executes.

You can include several SUS instructions in a

program, each with a different suspend ID.