# 2

2

PROGRAMMABLE LOGIC CONTROLLERS
INTRODUCTION
Control engineering has evolved over time. In the past humans were the main method for controlling a system. More recently electricity has been used for control and early electrical control was based on relays. These relays allow power to be switched on and off without a mechanical switch. It is common to use relays to make simple logical control decisions. The development of low cost computer has brought the most recent revolution, the Programmable Logic Controller (PLC). The advent of the PLC began in the 1970s, and has become the most common choice for manufacturing controls. PLCs have been gaining popularity on the factory floor and will probably remain predominant for some time to come. Most of this is because of the advantages they offer. • Cost effective for controlling complex systems. • Flexible and can be reapplied to control other systems quickly and easily. • Computational abilities allow more sophisticated control. • Trouble shooting aids make programming easier and reduce downtime. • Reliable components make these likely to operate for years before failure.

2

Ladder logic is the main programming method used for PLCs. As mentioned before, ladder logic has been developed to mimic relay logic. The decision to use the relay logic diagrams was a strategic one. By selecting ladder logic as the main programming method, the amount of retraining needed for engineers and tradespeople was greatly reduced. Modern control systems still include relays, but these are rarely used for logic. A relay is a simple device that uses a magnetic field to control a switch, as pictured in Simple Relay Layouts and Schematics. When a voltage is applied to the input coil, the resulting current creates a magnetic field. The magnetic field pulls a metal switch (or reed) towards it and the contacts touch, closing the switch. The contact that closes when the coil is energized is called normally open.

Relays are normally drawn in schematic form using a circle to represent the input coil. The output contacts are shown with two parallel lines.The normally closed contacts touch when the input coil is not energized. If current is flowing through the first two relays then current will flow through the coil in the third relay. input coil O R norm ally closed norm ally open O R F Simple Relay Layouts and Schematics Relays are used to let one power source close a switch for another (often high current) power source. An example of a relay in a simple control application is shown in A Simple Relay Controller. and will be open (non-conducting) when the input is not energized. Normally closed contacts are shown with two lines with a diagonal line through them. When the input coil is not energized the normally closed contacts will be closed (conducting). while keeping them isolated. and close the switch for output C. In this system the first relay on the left is used as normally closed. and will allow current to flow until a voltage is applied to the input A. This can be read logically as C will be on if A is off and B is on. Normally open contacts are shown as two lines. The second relay is normally open and will not allow current to flow until a voltage is applied to the input B. This circuit would normally be drawn in the ladder logic form. .

Many beginners will get caught trying to make the ladder logic match the input types. When we consider a PLC there are inputs. Notice that both of the input push buttons are normally open. Note. but the ladder logic inside the PLC has one normally open contact. We can imagine the inputs as activating 24V DC relay coils in the PLC. Here there are two inputs from push buttons. The ladder logic in the PLC is actually a computer program that the user can enter and change. A PLC Illustrated With Relays shows a more complete representation of the PLC.3 ladder logic The example in A Simple Relay Controller does not show the entire control system. that will turn on a light. and the logic. This in turn drives an output relay that switches 115V AC.F A Simple Relay Controller 115V C A wall plug relay logic input A (normally closed) input B (normally open) output C (normally open) A B C ladder logic Figure 2. in actual PLCs inputs are never relays. but outputs are often relays. but only the logic. outputs. and one normally closed contact. . Do not think that the ladder logic in the PLC needs to match the inputs or outputs.

push buttons power supply +24V com. After B is turned on the output B will not turn off. and A is energized. In this circuit the current can flow through either branch of the circuit. The circuit shown in A Seal-in Circuit is an example of this. If B turns on then the input B will turn on. through the contacts labelled A or B. The input B will only be on when the output B is on. If B is off. . it is called a seal in circuit. and keep output B on even if input A goes off. light F A PLC Illustrated With Relays Many relays also have multiple outputs (throws) and this allows an output relay to also be an input simultaneously. then B will turn on. PLC inputs ladder logic A B C outputs 115V c a AC power neut.

If you are involved in machining. We can do this with a simple external timer. let's assume that when a switch turns on we want to turn a solenoid on for 5 seconds and then turn it off regardless of how long the switch is on for. usually via software. Programmable Logic Controller) is a device that was invented to replace the necessary sequential relay circuits for machine control. For example. and the input B will also turn on and keep B on perma nently . But what if the process included 10 switches and solenoids? We would need 10 external timers. Almost any application that needs some type of electrical control has a need for a plc.until power is removed. f intentionally F A Seal-in Circuit What is a PLC? A PLC (i.e. packaging. Note: The line on the right is being left of and is implied in these diagrams. chances are good that there is a plc present. turning on/off its outputs. . If you are not. the output B will turn on. What if the process also needed to count how many times the switches individually turned on? We need a lot of external counters. If there is industry present. you are wasting money and time. The PLC works by looking at its inputs and depending upon their state. automated assembly or countless other industries you are probably already using them. material handling. PLCs are used in many "real world" applications. The user enters a program. that gives the desired results.A B B Note: When A is pushed.

instruction lists. down or both up and down. They physically exist and send on/off signals to solenoids. They come in many varieties and increments. Very convenient and necessary!! • • • • . they don't "physically" exist but rather they are simulated and can be considered software counters. and appropriate circuits to receive input/output data. Some are always on while some are always off. Some manufacturers also include high-speed counters that are hardware based. counters. sensors. They can also typically be used to store data when power is removed from the PLC. There are also some special relays that are dedicated to performing only one task. Others include off-delay and both retentive and non-retentive types. timers and data storage locations. DATA STORAGE-Typically there are registers assigned to simply store data. Typically these counters can count up. We now have PLCs that are programmable in function block diagrams. etc. (more on that later) What does each part do? • • INPUT RELAYS-(contacts)These are connected to the outside world. The latest standard (IEC 1131-3) has tried to merge plc programming languages under one international standard. Most times these counters can count up. memory areas. The Guts Inside The PLC mainly consists of a CPU. timers. or triacs depending upon the model chosen. Typically they are not relays but rather they are transistors. Do these counters. We can think of these as physically existing. These internal relays are simulated through bit locations in registers.The 90's have seen a gradual reduction in the introduction of new protocols. They are simulated counters and they can be programmed to count pulses. OUTPUT RELAYS-(coils)These are connected to the outside world. lights. The most common type is an on-delay type. C and structured text all at the same time! PC's are also being used to replace PLCs in some applications. etc. They can be transistors. COUNTERS-These again do not physically exist. down or up and down. They are simulated relays and are what enables a PLC to eliminate external relays. etc. TIMERS-These also do not physically exist. We can actually consider the PLC to be a box full of hundreds or thousands of separate relays. and the modernization of the physical layers of some of the more popular protocols that survived the 1980's. really exist? No. They physically exist and receive signals from switches. timers. INTERNAL UTILITY RELAYS-(contacts) These do not receive signals from the outside world nor do they physically exist. The original company who commissioned the MODICON 084 has actually switched to a PC based control system. Increments vary from 1ms through 1s. Upon power-up they will still have the same contents as before power was removed. relays. Some are on only once during power-on and are typically used for initializing data that was stored. etc. Since they are simulated they are limited in their counting speed. They are usually used as temporary storage for math or data manipulation.