You are on page 1of 112



Now used in many industrial designs .Developed to replace relays in the late 1960s •.Costs dropped and became popular by 1980s •.PLC Origin •.

• The control system needed the capability to pass data collection to a central system. • The controller had to be designed in modular form. so that sub-assemblies could be removed easily for replacement or repair. Historical Background The Hydromantic Division of the General Motors Corporation specified the design criteria for the first programmable controller in 1968 Primary goal was To eliminate the high costs associated with inflexible. • The method used to program the controller had to be simple. . so that it could be easily understood by plant personnel. • The system had to be reusable. relay-controlled systems.

Festo 4. Toshiba 2. General Electric 5. Telemechanique JAPANESE 1. Fanuc 4. Leading Brands Of PLC AMERICAN 1. Gould Modicon 3. Texas Instruments 4. Allen Bradley 2. Westinghouse 6. Cutter Hammer 7. Omron 3. Square D EUROPEAN 1. Mitsubishi . Klockner & Mouller 3. Siemens 2.

Areas of Application Annunciators Injection Molding Cranes Slitting Auto Insertion Assembly Crushing Sorting Bagging Motor Winding Cutting Stackers Baking Oil Fields Digesters Stitching Blending Painting Drilling Stack Precipitators Boring Palletizers Electronic Testing Threading Brewing Pipelines Elevators Tire Building Calendaring Polishing Engine Test Stands Traffic Control Casting Reactors Extrusion Textile Machine Chemical Drilling Robots Forging Turbines Color Mixing Rolling Generators Turning Compressors Security Systems Gluing Weaving Conveyors Stretch Wrap Grinding Web Handling Heat Treating Welding .

PLC’s • Widely Applied in Every Industry • Were Developed to Simplify the Implementation of Control Automation Systems in Plants and Assembly Lines • Designed to Minimize the Number of Control Relays in a Process and Maximize the Ways Relays can be Used • First Applied to Automobile Industry in the Late 1960’s • Flexible. Reliable and Low Cost .

• 2) sequential control. . and • 4) motion control. • 3) feedback control. • Similar to a Microcontroller: – Microprocessor Based – Onboard Memory for Storing Programs – Special Programming Language: Ladder Logic – Input/Output Ports • 1) on-off control. PLC’s Are ...

. • Dissimilar to Microcontrollers: – Intended for Industrial Applications – I/O Designed to interface with Control Relays – Emphasis on Maximum Reliability . PLC’s Are..

Large Quantity of Contact v Large number of' Soft Contact' available. Lower Cost v Advancement in technology and open architecture of PLC will reduce the market price. Flexibility v Universal Controller . B. D.can replace various independent/ standalone controller. E. . Implementing Changes and Correcting Errors v Do not have to rewiring relay panel. v Change program using keyboard. Advantages of PLC A. Pilot Running (Simulation Capability) v A program can be simulated or run without actual input connection. C.

Security  Software lock on a program (Password) M. G.  Asynchronous operation. Simplicity of Ordering Control Sys. K. Reliability  In general -very reliable J. Documentation  Printout of ladder logic can be printed easily L. Advantages of PLC F. Visual Observation. Speed of Operation  Depends on scan time -millisecond. Components  One package with Relay. Ease of Changes by Programming  Ability to program and reprogram.  Operator message can be programmed for each possible malfunction. Ladder or Boolean Programming Method.  Easy for 'Electrician . I. Timers.  Can observe the opening and closing of contact switch on CRT . Control Block. loading and down loading . H. etc.

Environment Consideration  Not adapted for very high temperature. New Technology  Change from ladder and relay to PLC concept B. Fixed-circuit operation  Fixed control system -less costly . Fixed program Application  Not cost effective for single. etc.function application C. Fail-safe operation  Does not start automatically when power failure ( can be programmed into )  Not "Fail-safe" -Fail-shorted rather than OPEN E. high humidity level. D. Disadvantages of PLC A. high vibration.

the most sophisticated units of the PLC covers units with up to 128 I/O’s and memories up to 2 Kbytes. They have up to 8192 I/O’s and memories up to 750 Kbytes.these PLC’s are capable of providing simple to advance levels or machine controls. MEDIUM . . . PLC Size 1. SMALL . .can control individual production processes or entire plant. 3. LARGE . 2.have up to 2048 I/O’s and memories up to 32 Kbytes.

counting. PROGRAMMABLE LOGIC CONTROLLER Invented in 1968 as a substitute for hardwired relay panels." . The digital computer which is used to perform the functions of a programmable controller is considered to be within this scope. "A digitally operating electronic apparatus which uses a programmable memory for the internal storage of instructions by implementing specific functions such as logic sequencing. and arithmetic to control. various types of machines or processes. Excluded are drum and other similar mechanical sequencing controllers. timing. through digital or analog input/output modules.


Major Components of a Common PLC POWER SUPPLY I M O M N O P D U O U U PROCESSOR T D T L P U From E U L To SENSORS T E OUTPUT Pushbuttons. alarms etc. contactors. Solenoids. etc. limit switches. contacts. PROGRAMMING DEVICE .

Programming Device Types:  Hand held unit with LED / LCD display  Desktop type with a CRT display  Compatible computer terminal .

• Input modules converts signals from discrete or analog input devices to logic levels acceptable to PLC’s processor. • Output modules converts signal from the processor to levels capable of driving the connected discrete or analog output devices. • The main purpose of the I/O interface is to condition the various signals received from or sent to the external input and output devices. .I/O Module • The I/O interface section of a PLC connects it to external field devices.

LEVEL Helps reduce the effects of electrical noise Current Buffer.I/O Module DC INPUT MODULE IS NEEDED TO: USE TO  Prevent voltage DROP THE transients from VOLTAGE damaging the TO LOGIC processor. FROM Limiting Filter. OPTO. TO INPUT Resistor ISOLATOR hysteresis PROCESSOR DEVICE Circuits .

OPTO. TO INPUT Network ISOLATOR Hysteresis PROCESSOR DEVICE Circuits . Buffer. LEVEL Helps reduce the effects of electrical noise Rectifier.I/O Module AC INPUT MODULE IS NEEDED TO: CONVERTS THE AC  Prevent voltage INPUT TO DC AND transients from DROPS THE damaging the VOLTAGE TO LOGIC processor. FROM Resistor Filter.

24 .

25 .


27 .




B SWITCH Module Terminal # Address I:2.0/0 LADDER PROGRAM INPUT MODULE WIRING DIAGRAM . Allen-Bradley 1746-1A16 L2 I= Input L1 Module I:2 slot # in rack 0 P.


In the ON condition it is referred to as logic 1 or a logic high and in the OFF condition maybe referred to as logic o or logic low. Normally Open Pushbutton Normally Closed Pushbutton Normally Open switch Normally Closed switch Normally Open contact Normally closed contact . Discrete Input A discrete input also referred as digital input is an input that is either ON or OFF are connected to the PLC digital input.

IN OFF PLC Logic 0 Input Module 24 V dc IN OFF PLC Logic 1 Input Module 24 V dc .

Analog Input An analog input is an input signal that has a continuous signal. 4 to 20mA or 0 to10V. a level transmitter monitors the level of liquid in the tank. Below. Depending on the level Tx. Typical inputs may vary from 0 to 20mA. Level Transmitter IN PLC Analog Tank Input Module 35 . the signal to the PLC can either increase or decrease as the level increases or decreases.

the lamp can be turned ON or OFF by the PLC output it is connected to. contactors coils. Below. lamps are example of devices connected to the Discrete or digital outputs. OUT PLC Lamp Digital Output Module 36 . Digital Output A discrete output is either in an ON or OFF condition. Solenoids.

Typical outputs may vary from 0 to 20mA. Analog Output An analog output is an output signal that has a continuous signal. Electric to pneumatic transducer OUT E Supply air PLC 0 to 10V P Analog Output Module Pneumatic control valve 37 . 4 to 20mA or 0 to10V.

communication with peripheral devices. which is composed of specific control functions such as logic. and any stored constants. . sequencing. composed of permanently-stored programs that direct all system activities.Memory Map Organization •System memory includes an area called the EXECUTIVE. The data table is where data is monitored. counting. such as execution of the users control program. timing. and arithmetic. •System memory is generally built from read-only memory devices. •The user program area is where the programmed instructions entered by the user are stored as an application control program. APPLICATION •The application memory is divided into the data table area •Data Table and user program area. manipulated. or preset values. •The data table stores any data associated with the user’s •User Program control program. and changed for control purposes. •The system memory also contains the routines that implement the PLC’s instruction set. and other SYSTEM system activities. such as system input and output status data. variables.

While the PLC is running. the scanning process includes the following four phases. which are repeated continuously as individual cycles of operation: PHASE 1 Read Inputs Scan PHASE 2 Program Execution PHASE 3 Diagnostics/ Comm PHASE 4 Output Scan .

PHASE 2– Logic Solve/Program Execution  The application program is executed using the status of the inputs PHASE 3– Logic Solve/Program Execution  Once the program is executed. the CPU performs diagnostics and communication tasks .PHASE 1 – Input Status scan  A PLC scan cycle begins with the CPU reading the status of its inputs.

Output Status Scan • An output status scan is then performed. whereby the stored output values are sent to actuators and other field output devices. .PHASE 4 . The cycle ends by updating the outputs.

The scan time composed of the program scan time.As soon as Phase 4 are completed. The time to make a single scan can vary from 1 ms to 100 ms. the entire cycle begins again with Phase 1 input scan. The time it takes to implement a scan cycle is called SCAN TIME. The program scan time generally depends on the amount of memory taken by the control program and type of instructions used in the program. . and the I/O update time. which is the time required for solving the control program. or time required to read inputs and update outputs.

etc. .PLC Communications Common Uses of PLC Communications Ports Changing resident PLC programs . Linking a PLC into a control hierarchy containing several sizes of PLC and computer.  Forcing I/O points and memory elements from a remote terminal. Monitoring data and alarms. via printers or Operator Interface Units (OIUs).uploading/downloading from a supervisory controller (Laptop or desktop computer).

Common Standards RS 232  Used in short-distance computer communications. 30 m at 9600 baud.  Has a maximum effective distance of approx.PLC Communications Serial Communications PLC communications facilities normally provides serial transmission of information. . with the majority of computer hardware and peripherals.

LANs provide the common. LANs are commonly used in business applications to allow several users to share costly software packages and peripheral equipment such as printers and hard disk storage. . ensuring that each device can “talk” to other machines and understand data received from them.PLC Communications Local Area Network (LAN) Local Area Network provides a physical link between all devices plus providing overall data exchange management or protocol. high-speed data communications bus which interconnects any or all devices within the local area.

RS 485 can have a maximum distance of about 1000 meters.PLC Communications RS 422 / RS 485 Used for longer-distance links. . often between several PCs in a distributed system.

PLC Communications
Programmable Controllers and Networks

Dedicated Network System of Different Manufacturers

Manufacturer Network
Allen-Bradley Data Highway
Gould Modicon Modbus
General Electric GE Net Factory LAN
Mitsubishi Melsec-NET
Square D SY/NET
Texas Instruments TIWAY


Each output port should be capable of supplying sufficient voltage and
current to drive the output peripheral connected to it.


This is the speed at which the controller executes the relay-ladder logic
program. This variable is usually specified as the scan time per 1000 logic
nodes and typically ranges from 1 to 200 milliseconds.


The amount of memory required for a particular application is related to the
length of the program and the complexity of the control system. Simple
applications having just a few relays do not require significant amount of
memory. Program length tend to expand after the system have been used
for a while. It is advantageous to a acquire a controller that has more
memory than is presently needed.

PLC Status Indicators •Power On •Run Mode •Programming Mode •Fault .

Consult the manuals.a physical problem has occurred with the PLC 3. Troubleshooting 1. Indicator lights on I/O cards and sensors 4.something has stopped the CPU RUN . 5. . Use programming terminal / laptop. PLC status lights HALT . or use software if available. Look at the process 2.the PLC thinks it is OK (and probably is) ERROR .

flash memory). Programming Terminal . upload it from the PLC. Backup copy of the ladder program (on diskette. PLC manufacturers have their own specific software and license key. Documentation. 5. drawings. 3. and Seq.laptop or desktop PC.) . of Operations manual. ladder program printout. hard disk. Software manual. 2. CDROM. Communication cable for connection from Laptop to PLC.List of items required when working with PLCs: 1.(PLC manual. If none. PLC Software. 4.

Texas Instruments – Simatic 6. Modicon . Allen-Bradley – Rockwell Software RSLogix500 2. Omron . GE-Fanuc Series 6 – LogicMaster6 5.PowerLogic 6.Syswin 4.Examples of PLC Programming Software: 1. Telemecanique – Modicon TSX Micro . Square D.Modsoft 3.

. The normally open (NO) is true when the input or output status bit controlling the contact is 1. PROGRAMMING Normally Open Normally Closed (NO) (NC) Power flows through these contacts when they are closed. The normally closed (NC) is true when the input or output status bit controlling the contact is 0.

When a coil is energized it causes a corresponding output to turn on by changing the state of the status bit controlling the output to 1. That same output status bit maybe used to control normally open or normally closed contact anywhere in the program. . Coils Coils represent relays that are energized when power flows to them.

In the rung above. . AND OPERATION A B C Rung Each rung or network on a ladder program represents a logic operation. both inputs A and B must be true (1) in order for the output C to be true (1).

. it can be seen that either input A or B is be true (1). or both are true. OR OPERATION A C Rung B In the rung above. then the output C is true (1).

output C is 1. it can be seen that if input A is be true (1). NOT OPERATION A C Rung In the rung above. then the output C is true (0) or when A is (0). .

turn the field output devices on or off. This process of sequentially reading the inputs. executing the program in memory.PLC Operation Basic Function of a Typical PLC Read all field input devices via the input interfaces. execute the user program stored in application memory. or perform whatever control is necessary for the process application. then. based on whatever control scheme has been programmed by the user. and updating the outputs is known as scanning. .

Examples of I/O Signals • Inputs: – Pushbutton (Energizing or Grounding an Input) – Relay Contact Output – DC Voltage Level – Digital Logic Signal (+5V or 0 V. etc) • Outputs: – 24 V ac – 120 V ac – 120 Vdc – etcetera .

etc) and have the facility for extensive input/output (I/O) arrangements Advantages Continued: •Cost effective for controlling complex systems. cold. operators could read instruments only by plugging in  temporary batteries… [IEEE Spectrum Nov 2011 about Fukushima]  The main difference from other computers is that PLCs are armored for severe conditions (dust. heat. moisture. •Flexible and can be reapplied to control other systems quickly and easily. •Reliable components make these likely to operate for years before failure . •Computational abilities allow more sophisticated control. Why 24V / 48 V supply ? … After the plant lost electric power. •Trouble shooting aids make programming easier and reduce downtime.


Control. dedicated to automation tasks in an industrial environme Formerly: cabled relay control (hence 'logic'). AP = Automates Programmables industriels PLC = Programmable Logic Controller: Definition SPS = Speicherprogrammierbare Steuerungen Definition: “small computers. Protect Distinguish Instrumentation flow meter. …) Control programmable logic controllers with digital peripherals & field bus Visualization Human Machine Interface (HMI) in PLCs (when it exists) is limited to service help and control of operator displays . but also actors (pump. position. hydraulic) “governo Today: real-time (embedded) computer with extensive input/output Function: Measure. analog (pneumatic.…. temperature.

PLC in a cabinet CPU1 CPU2 serial connections redundant field bus connection inputs/outputs .




example: turbine control (in the test lab) .

Global players .

Types of PLC (1) Compact Monolithic construction Monoprocessor Fieldbus connection (2) Modular PLC Modular construction (backplane) One.or multiprocessor system Fieldbus and LAN connection Small Micro Memory Card (MMC) function possible (3) Soft-PLC Linux or Windows NT or CE-based automation products Direct use of CPU or co-processors .

Compact PLC courtesy ABB courtesy ABB courtesy ABB Monolithic (one-piece) construction Fixed casing Fixed number of I/O (most of them binary) No process computer capabilities (no MMC) Can be extended and networked by an extension (field) bus Sometimes LAN connection (Ethernet. ABB AC31. Arcnet) Monoprocessor Typical product: Mitsubishi MELSEC F. SIMATIC S7 costs: € 2000 .

24V= or 48V= (redundant) • cost ~ €10’000 for a filled crate Typical products: SIMATIC S5-115. Modular PLC • can be tailored to needs of application developme RS232 nt • housed in a 19" (42 cm) rack environmen t (height 6U ( = 233 mm) or 3U (=100mm) • high processing power (several CPUs) LAN • large choice of I/O boards backplane • concentration of a large number of I/O parallel bus courtesy ABB • interface boards to field busses fieldbus • requires marshalling of signals Power Supply • primitive or no HMI CPU CPU Analog Binary I/O • cost effective if the rack can be filled I/O fieldbus • supply 115-230V~ . ABB AC110 . Hitachi H-Serie.

Small modular PLC courtesy ABB courtesy Backmann mounted on DIN-rail. 24V supply cheaper (€5000) not water-proof. no ventilator extensible by a parallel bus (flat cable or rail) .

external Digital controller digital analog Digital Output I/Os Input converters converters signal power signal relays conditioni amplifiers conditioning ng field bus direct Inputs and Outputs . General PLC architecture RS 232 Ethernet Real-Time flash serial port ethernet CPU ROM Clock EPROM controller controller extension bus parallel bus buffers fieldbus analog. digital.

Wait for clock interrupt 2. Distillation Plan . Compute control signal 4. Implementation • PLC operates periodically • Samples signals from sensors and converts them to digital form with A/D converter • Computes control signal and converts it to analog form for the actuators. 1. Send output to the actuator 5. Communication 6. Read input from sensor 3. Update controller variables 7. Repeat Waiwera Organic Winery.

based on relay intuition of electricians.widely in use outside Europe. . Ladder Diagrams (1) Ladder Diagrams is the oldest programming language for PLC .not recommended for large new projects. Output (actions) Input instructions (conditions) Rung 0 Rung 1 Rung 2 . .

It is well suited to express combinational logic It is not suited for process control programming (there are no analog elements). Ladder Diagrams (2) he contact plan or "ladder diagram" language allows an easy transition from the aditional relay logic diagrams to the programming of binary functions. The main Ladder Diagrams symbols represent the elements: make contact contact travailArbeitskontakt break contact contact repos Ruhekontakt relay coil bobine Spule .

Ladder Diagrams Example (3) make contact origin: (contact travail) 02 electrical 01 relay coil circuit (bobine) 03 50 break contact (contact repos) 01 02 corresponding 50 rung 03 ladder diagram 50 05 "coil" 50 is used to move 44 other contact(s) .

Parallel + 01 40 01 02 40 02 Coil 40 is active (current flows) when 01 is active or 02 is not. . Ladder Diagrams (4) Binary combinations are expressed by series and parallel relay contact: Ladder Diagrams representation “logic" equivalent Series + 01 02 01 50 50 02 Coil 50 is active (current flows) when 01 is active and 02 is not.

Ladder Diagrams (5) The Ladder Diagrams is more intuitive for complex binary expressions than literal Languages 1 2 3 4 50 textual expression 5 6 !1&2&(3&!4 |!5&6)= 50 Or N1 & 2 STR 3 & N4 STR N5 & 6 / STR & STR = 50 0 1 4 5 12 50 2 3 6 7 N0 & 1 STR 2 & 3 / STR STR 4 10 11 & 5 STR N 6 & 7 / STR & STR STR 10 & 11 / STR & 12 = 50 .

mathematically . is problematic. The introduction of «functions» that influence the control flow itself. The contact plan is . The introduction of a more or less hidden control of the flow destroys the freedom of side effects and makes programs difficult to read. . Ladder Diagrams (6) Ladder Diagrams stems from the time of the relay technology. The contact plan language was extended to express functions: 00 01 literal expression: FUN 02 200 !00 & 01 FUN 02 = 200 The intuition of contacts and coil gets lost. As PLCs replaced relays.a functional representation. their new possibilities could not be expressed any more in relay terms.

nstruction List (IL) Z := X .isagraf. B:=“Z is OK”). B:=“ERR”). B:=‘OK’).8 . IF Z>57. A: LD %IX1 (* PUSH BUTTON *) END_IF ANDN %MX5 (* NOT INHIBITED *) ST %QX2 (* FAN ON *) . bFB : unction Block Diagram (FBD)graphical languages Sequential Flow Chart (SF CALC1 CALC PUMP START STEP AUTO IN1 OUT >=1 DO T1 MAN_ON V N ACTION D1 D1_READY IN2 STEP A ACT D ACTION D2D2_READY T2 N ACTION D3 D3_READY Ladder Diagram (LD) STEP B D ACTION D4D4_READY CALC1 T3 AUTO CALC PUMP IN1 OUT OUT ACT textual languages Structured Text (ST) IN2 MAN_ON VAR CONSTANT X : REAL := 53.0 THEN aFB(A:=0.OUT1). END_VAR VAR aFB.INT_TO_REAL (bFB. Z : REAL. The five IEC 61131-3 Programming languages http://www. ELSE aFB(A:=1. END_VAR bFB(A:=1.

• The modular nature is possibly the greatest strength of PLC’s and several common modules will be described below. which can be obtained for a personal computer. instillation and maintenance of the first level of control much simpler. . there are literally thousands of interface modules supported by PLC’s. • While these modules may be numerous they all have the same function. obtaining or delivering control signals and information between the measurement level and the operator interface level. • Similar to the peripheral devices. PLC Modules • The modular nature of PLC components makes the design.

but the most common industrial signals are 24Volt DC and 120V AC. • Referred to as Digital I/O (Digital input/output). Digital Inputs/Outputs (I/O) • By far the most common industrial signals used in PLC’s are simple digital control signals. 240 Volt AC. . • Most digital modules have electrical protection usually in the form of optocoupling to prevent damage to the PLC from standard electrical faults. A switch is nothing more than an electrical switch used to indicate some • physical Digital I/O signals come in many forms from 12 Volt DC to position. • There are Digital I/O modules to measure all of these signals. they can be measured in there thousands for substantial industrial plants. • They are used to measure an amazing verity of events. • The most common digital signal encountered is a simple switch. an extra variation is the number of signals per module ranging from 8. 16 and 32 etc.

i.0mA equatessignals to zero. The resolution of most analogue signals is between 11 and 16 bits. • The reason for the 4. Analogue Inputs/Outputs (I/O) • Analogue signals enter and leave the PLC in voltage and current form.0mA starting point is a fail-safe feature. • While voltage is commonly used in practice it can be sensitive to noise (induced voltages in electrical equipment rooms can be substantial) This makes current control the superior choice. • This fail-safe feature is not possible for voltage signals which pass through zero volts.e. • The – Amost common analogue signal of 4. if the instrument fails or the signal cable is damaged the current falls to zero and the PLC can alarm the operating system of the failure immediately.appear in the form of a 4-20mA current signal. – A signal of 20mA equates to 2048 for an 11 bit input. .

RS485. Ethernet etc. Other interface modules • Digital I/O and Analogue I/O signals comprise the vast majority of PLC signals. • Some examples include RS232. not all devices can be controlled by these simple signals and it is often required that PLC’s communicate to foreign instruments using many different communications protocols. DH+. • However. DH485. . Modbus. • Again in most instances there is simply a module predesigned to make this interface possible.

similar to defining variables in standard programming. . • The memory is divided into data files. we have. Memory (Addressing . each data file has a unique number and a character prefix which refers to the type of data. • For example. in the Allen Bradley PLC-5 system. Internal Registers) • The memory in PLC’s needs to be predefined by the programmer.

• Physically this is the 3rd input on the 2nd slot in the 1st Rack. . data areas of status communication Integers and and Floating time processor pointand addresses simply point to a linear memory region. • This input is show below in figure. this is because these files are not programmable. dates etc) • However the Input and Output address actually correspond to a physical address. For example I:12/03 has the format. (Status bits include such information as arithmetic overflow • The internal warnings. I: {Rack address}{slot number}/{Input number}. • Status file 2 (S2:##) is also fixed within Allen Bradley PLC’s.• The ASCII character (or characters) denotes the data area type. • Note that the Output and Input numbers are dropped from file 0 and 1 respectively. Other types of defined words include T-timers. C- counters and S-status registers etc.

slots and input numbers. ie an eight slot rack will have slots numbered from 0 to 7. CPU) . slot 1 input 0 (Slot 0 in Rack 0 is not available for inputs since it is always reserved for the Central Processing Unit. • This is the case for racks. Physical I/O Addressing • Note: PLC’s usually start counting from zero and use the octal counting system. • So the first possible input would be Rack 0.

• For example. if in the Start /Stop logic of figure (6) the Start PB = I:13/04 and Stop PB = I:13/05 and the output Coil = O:12/03 then the ladder logic would look more like figure below . Addressing Format • The addressing format has been demonstrated here because in writing a PLC program the address is used by the PLC in the ladder logic.

– Subroutine U:22 – Pump No. It is always beneficial to group segments • For example a program may be divided in the following way: of code which serve similar purposes. . • The nature of subroutines makes a modular programming structure possible. • Each subroutine is executed from top to bottom in a predetermined order.23 – Pump No. – Subroutine U. – Subroutine U:21 – Pump No.2 alarming and drive file. • Once all the subroutines have been scanned it simply begins again with the first subroutine. – Subroutine U:20 – Pumps sequencing logic file.3 alarming and drive file. In this respect PLC’s replace function and procedures with subroutines. PLC Programming Architecture • A PLC program can be divided into many small subroutines.1 alarming and drive file.

• The second advantage is that for anyone not involved in the code production only needs to learn one standard to have a good understanding of the program structure of all the plants PLC’s. essential step in automating a large control system.22 and 23 while the drive files are virtually identical for each pump by starting and stopping the pump while reporting alarms and the healthy status to file 20. if the programming standard is well understood many code developers can work on the code producing a uniform control system. . • Fault finding problems in the code is greatly simplified when all the code for a faulty device is listed in a single • The development of a plant wide PLC standard is an subroutine. • The benefits are twofold.• Here subroutine 20 controls the sequencing of 21.

a global leading Automation giant. Allen-Bradley PLC’s • Below are AB Plcs • Note that AB is part of the Rockwell Automation. .


Siemens Simatic PLC’s .

Siemens Simatic PLC’s .

Modicon TSX PLC’s .


Other PLC Terminology • On-line: Refers to the program code currently in the PLC memory. • Note: It is important to realize that changing the On-line program will not change the Off-line program on the • Runprogramming Mode: The computer. • Program Mode: The PLC is not being scanned (All outputs disabled) • Remote Mode: programming computer can change the PLC between Run and Program. (note the previous PLC code is lost during this transfer). • Up-Load: Refers to the act of copying the current On-line code from the PLC to the programming computer . • Note: There is a physical key on the front of each PLC . Invariably PLC actively scanningatthe thecode end of any and edit there driving must follow an Up-load or Down-Load to make the Online and outputs. • Off-line: Refers to the copy of the program code stored on the programming computer. (Note the previous code on the programming computer is lost during this transfer if a copy is not made) • Down-Load: Refers to the act of copying the code from the programming computer into the PLC’s memory. Off-line programs the same.

The process is terminated automatically when the finished part touches a second limit switch. L1 LS1 PB1 LS2 R1 R1 TIMER R1 R2 PB1 LS1 LS2 PR=5 TIMER 5 Motor R2 R1 . An emergency switch will stop the process any time when it is pushed.AN EXAMPLE OF RELAY LOGIC For process control. it is desired to have the process start (by turning on a motor) five seconds after a part touches a limit switch.

Bar code reader microswitch Stopper Part Conveyor Robot Machine id description state explanation MSI microswitch 1 part arrive R1 output to bar code reader 1 scan the part C1 input from bar code reader 1 right part R2 output robot 1 loading cycle R3 output robot 1 unloading cycle C2 input from robot 1 robot busy R4 output to stopper 1 stopper up C3 input from machine 1 machine busy C4 input from machine 1 task complete .

load the part onto the machine. activate the stopper. Rung 2. If the task is completed and the . Input Output MS1 R1 01 11 C1 R2 02 12 C2 R3 03 13 C3 R4 04 14 Programmable C4 05 15 Controller PLC 14 11 01 Rung 1. Rung 4. If part arrives 02 14 and no part is stopped. trigger the bar code 14 04 03 12 reader. If it is a right 05 03 13 part. If the stopper is up. Rung 3. the machine is not busy and the robot is not busy.

EXAMPLE 2 TRAFFIC LIGHTS Main street VIT street Cycle time Street Red Yellow Green Main 3 1 4 VIT 5 1 2 .

input output

64 VIT Red

65 VIT Yellow
66 VIT Green

67 Main Red

70 Main Yellow

71 Main Green

901 901
901 902
RUNG3 67 M. Red

RUNG4 67
RUNG5 901 902
901 903
RUNG6 66 V. Green

RUNG7 66
901 903 20
902 904 M. Green
RUNG9 71

901 904 40
904 905
RUNG12 70 M. Yellow

901 905 10
903 906
RUNG15 65 V. Yellow

901 906 10
902 907
RUNG18 64 V. Red

RUNG19 64
901 907 50