Electrical, Electronics Engineering Department Develop structured programs for control systems (Allen Bradley) UEUNEED027B Version 1 2 3 4 5 Date 01/09 05/10 06/10 Contact DK DK DK Chisholm Institute Berwick Tel: 9212 4526 ALLEN BRADLEY VOL1 UEUNEED027A Duration 60hrs Required Skills and Knowledge E2.3.19 Control programming fundamentals Evidence shall show an understanding of control programming fundamentals to an extent indicated by the following aspects: a) Control applications of software b) Software terminology c) Programming languages currently used by industry d) Control system development encompassing: • flowcharts • pseudocode • Nassi-Schneidemann charts • algorithms e) Programming styles encompassing: • programming structure • documentation • installing a language compiler • using a text editor • compiling source code • generating executable files • scalar and structured data types • constants and variables • reading from keyboard and writing to screen • arithmetic, relational and logical operations • making decisions using if/then, if/then/else, nested if/then and case • looping operations using while/do, repeat/until and for/do • programming to access external devices via I/O boards • functions Note: Examples are macros; global and local variables, auto and static variables; Intrinsic functions used in control; Writing functions; Linking in external functions to control hardware • numerical and character arrays - 2 - ALLEN BRADLEY VOL1 UEUNEED027A Table of contents Table of contents .......................................................................................................................... 3 Introduction to PLCs ...................................................................................................................... 5 Individual PLC sections ................................................................................................................. 7 Inside The PLC ........................................................................................................................... 12 PLC Operation ............................................................................................................................ 13 Basic PLC instructions ................................................................................................................ 19 Getting Started ............................................................................................................................ 28 Latching Instructions ................................................................................................................... 34 Timers ......................................................................................................................................... 36 Allen Bradley Timers ................................................................................................................... 39 Counters ..................................................................................................................................... 44 Allen Bradley Counters ............................................................................................................... 47 Exercises and Assessment items ................................................................................................ 52 Assessment Item 1 – Door Simulation ................................................................................. 58 Assessment Item 2 – Level application ................................................................................ 60 Assessment Item 3 - Timer .................................................................................................. 61 Assessment Item 4 - Counter ............................................................................................... 62 Personal Safety and Safe Work Practices ................................................................................... 63 PLC Installation ........................................................................................................................... 66 Program Storage Methods .......................................................................................................... 68 PLC Hardware ............................................................................................................................ 75 Peripheral Devices ...................................................................................................................... 81 Basic diagnostics ........................................................................................................................ 92 Derived Timers ............................................................................................................................ 95 Derived timer Exercises .............................................................................................................. 99 Assessment item 5 – derived timers ................................................................................... 101 Reversible Counters .................................................................................................................. 102 Comparison Instructions............................................................................................................ 106 Process control ......................................................................................................................... 111 Assessment Item 6– Traffic light sequence ........................................................................ 114 Program Flow Instructions ......................................................................................................... 115 Assessment Item 7 – Program Flow ................................................................................... 122 Shift Registers ........................................................................................................................... 123 Assessment Item 8 – Shift Register ................................................................................... 132 - 3 - ALLEN BRADLEY VOL1 UEUNEED027A This page intentionally left blank - 4 - ALLEN BRADLEY VOL1 UEUNEED027A Introduction to PLCs The PLC A PLC ( Programmable Logic Controller) is a device that was invented to replace the necessary sequential relay circuits for machine control. The PLC works by looking at its inputs and depending upon their state, turning on/off its outputs. The user enters a program, usually via software, that gives the desired results. PLCs are used in many "real world" applications. If there is industry present, chances are good that there is a PLC present. If you are involved in machining, packaging, material handling, automated assembly or countless other industries you are probably already using them. If you are not, you are wasting money and time. Almost any application that needs some type of electrical control has a need for a PLC. For example, 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. We can do this with a simple external timer. But what if the process included 10 switches and solenoids? We would need 10 external timers. What if the process also needed to count how many times the switches individually turned on? We need a lot of external counters. As you can see the bigger the process the more of a need we have for a PLC. We can simply program the PLC to count its inputs and turn the solenoids on for the specified time. History In the late 1960's PLCs were first introduced. The primary reason for designing such a device was eliminating the large cost involved in replacing the complicated relay based machine control systems. Bedford Associates (Bedford, MA) proposed something called a Modular Digital Controller (MODICON) to a major US car manufacturer. Other companies at the time proposed computer based schemes, one of which was based upon the PDP-8. The MODICON 084 brought the world's first PLC into commercial production. When production requirements changed so did the control system. This becomes very expensive when the change is frequent. Since relays are mechanical devices they also have a limited lifetime which required strict adhesion to maintenance schedules. Troubleshooting was also quite tedious when so many relays are involved. Now picture a machine control panel that included many, possibly hundreds or thousands, of individual relays. The size could be mind boggling. How about the complicated initial wiring of so many individual devices! These relays would be individually wired together in a manner that would yield the desired outcome. These "new controllers" also had to be easily programmed by maintenance and plant engineers. The lifetime had to be long and programming changes easily performed. They also had to survive the harsh industrial environment. That's a lot to ask! The answers were to use a programming technique most people were already familiar with and replace mechanical parts with solid-state ones. - 5 - ALLEN BRADLEY VOL1 UEUNEED027A In the mid1970's the dominant PLC technologies were sequencer state-machines and the bit-slice based CPU. The AMD 2901 and 2903 processors were quite popular in Modicon and Allen- Bradley PLCs. Conventional microprocessors lacked the power to quickly solve PLC logic in all but the smallest PLCs. As conventional microprocessors evolved, larger and larger PLCs were being based upon them. However, even today some are still based upon the 2903.(ref A-B's PLC-3) Modicon has yet to build a faster PLC than their 984A/B/X which was based upon the 2901. Communications abilities began to appear in approximately 1973. The first such system was Modicon's Modbus. The PLC could now talk to other PLCs and they could be far away from the actual machine they were controlling. They could also now be used to send and receive varying voltages to allow them to enter the analog world. Unfortunately, the lack of standardization coupled with continually changing technology has made PLC communications a nightmare of incompatible protocols and physical networks. Still, it was a great decade for the PLC! The 80's saw an attempt to standardize communications with General Motor's manufacturing automation protocol (MAP). It was also a time for reducing the size of the PLC and making them software programmable through symbolic programming on personal computers instead of dedicated programming terminals or handheld programmers. Today the world's smallest PLC is about the size of a single control relay! The 90's have seen a gradual reduction in the introduction of new protocols, and the modernization of the physical layers of some of the more popular protocols that survived the 1980's. The latest standard (IEC 1131-3) has tried to merge PLC programming languages under one international standard. We now have PLCs that are programmable in function block diagrams, instruction lists, C and structured text all at the same time! PC's are also being used to replace PLCs in some applications. The original company who commissioned the MODICON 084 has actually switched to a PC based control system. - 6 - ALLEN BRADLEY VOL1 UEUNEED027A Individual PLC sections Common to all PLCs are five sections, each of which can be subdivided into smaller but equally important sections. These primary sections include: • The power supply section which provides the operating DC power to the PLC and I/O base modules and includes battery backup. • The CPU module, which contains the processor and holds the memory. • The memory section • The software program section • The I/O section, which controls peripheral devices and contains the input and output modules. Power supply section. The power supply (PS) section gets its input power from an external 120VAC or 240VAC source (line voltage), which is usually fused and fed through a control relay and filter external to the PS. In addition, the PS has its own integral AC input fuse. This line voltage is then stepped-down, rectified, filtered, regulated, voltage- and current- protected, and status-monitored, with status indication displayed on the front of the PS in the form of several LEDs (light-emitting diodes). The PS can have a key switch for protecting the memory or selecting a particular programming mode. The output of the PS provides low DC voltage(s) to the PLC's various modules as well as to its integral lithium battery, which is used for the memory backup. Should the PS fail or its input line voltage drop below a specific value, the memory contents will not change from what they were prior to the failure. The PS output provides power to every module in the PLC; however, it does not provide the DC voltages to the PLC's peripheral I/O devices. CPU module. "CPU," "controller," or "processor" are all terms used by different manufacturers to denote the same module that performs basically the same functions. The CPU module can be divided into two sections: the processor section and the memory section. The processor section makes the decisions needed by the PLC so that it can operate and communicate with other modules. It communicates along either a serial or parallel data-bus. An I/O base interface module or individual on-board interface I/O circuitry provides the signal conditioning required to communicate with the processor. The processor section also executes the programmer's RLL software program. - 7 - ALLEN BRADLEY VOL1 UEUNEED027A The memory section This section stores (electronically) retrievable digital information in three dedicated locations of the memory. These memory locations are routinely scanned by the processor. The memory will receive ("write" mode) digital information or have digital information accessed ("read" mode) by the processor. This read/write (R/W) capability provides an easy way to make program changes. The memory contains data for several types of information. Usually, the data tables, or image registers, and the software program RLL are in the CPU module's memory. The program messages may or may not be resident with the other memory data. A battery backup is used by some manufacturers to protect the memory contents from being lost should there be a power or memory module failure. Still others use various integrated circuit (IC) memory technologies and design schemes that will protect the memory contents without the use of a battery backup. A typical memory section of the CPU module has a memory size of 96,000 (96K) bytes. This size tells us how many locations are available in the memory for storage. Additional memory modules can be added to your PLC system as the need arises for greater memory size. These expansion modules are added to the PLC system as the quantity of I/O modules are added or the software program becomes larger. When this is done, the memory size can be as high as 1,024,000 (1024K) bytes. Manufacturers will state memory size in either "bytes" or "words." A byte is eight bits, and a bit is the smallest digit in the binary code. It's either a logic "1" or a logic "0." A word is equal in length to two bytes or 16 bits. Not all manufacturers use 16-bit words, so be aware of what your PLC manufacturer has defined as its memory word bit size. - 8 - ALLEN BRADLEY VOL1 UEUNEED027A The Program Software Section. The PLC not only requires electronic components to operate, it also needs a software program. The PLC programmer is not limited to writing software in one format. There are many types available, each lending itself more readily to one application over and above another. Typical is the RLL type previously discussed. Other S/W programs include "C," State Language, and SFC (Sequential Function Charts). Regardless of which software is chosen, it will be executed by the PLC's CPU module. The software can be written and executed with the processor in an online state (while the PLC is actually running) or in the off-line state (whereby the S/W execution does not affect current operation of the I/O base). In the RLL software program, we find several types of programming elements and functions to control processes both internal to the PLC (memory and register) as well as external (field) devices. Listed below are some of the more common types of elements, functions, and instructions: Contacts (can be either normally opened or closed; highlighted on the monitor means they are active). • Coils (can be normal or latched; highlighted means they are energized). • Timers (coil can either be ON or OFF for the specified delay). • Counters (can count by increments either up or down). • Bit shift registers (can shift data by one bit when active). • One-shot (meaning active for one scan time; useful for pulse timer). • Drums (can be sequenced based on a time or event). • Data manipulation instructions (enable movement, comparison of digital values). • Arithmetic instructions (enable addition, subtraction, multiplication, and division of digital values). Input Output Section (I/O) Input module The input module has two functions: reception of an external signal and status display of that input point. In other words, it receives the peripheral sensing unit's signal and provides signal conditioning, termination, isolation and/or indication for that signal's state. The input to an input module is in either a discrete or analog form. If the input is an ON-OFF type, such as with a push button or limit switch, the signal is considered to be of a discrete nature. If, on the other hand, the input varies, such as with temperature, pressure, or level, the signal is analog in nature. Peripheral devices sending signals to input modules that describe external conditions can be switches (limit, proximity, pressure, or temperature), push buttons, or logic, binary coded decimal (BCD) or analog-to-digital (A/D) circuits. These input signal points are scanned, and their status is communicated through the interface module or circuitry within each individual PLC and I/O base. - 9 - ALLEN BRADLEY VOL1 UEUNEED027A Some typical types of input modules are listed below. * DC voltage (110, 220, 14, 24, 48, 15-30V) or current (4-20 mA). * AC voltage (110, 240, 24, 48V) or current (4-20 mA). * TTL (transistor transistor logic) input (3-15VDC). * Analog input (12-bit). * Word input (16-bit/parallel). * Thermocouple input. * Resistance temperature detector. * High current relay. * Low current relay. * Latching input (24VDC/110VAC). * Isolated input (24VDC/85-132VAC). * Intelligent input (contains a microprocessor). * Positioning input. * PID (proportional, integral, differentiation) input. * High-speed pulse. Output module The output module transmits discrete or analog signals to activate various devices such as hydraulic actuators, solenoids, motor starters, and displays the status (through the use of LEDs) of the connected output points. Signal conditioning, termination, and isolation are also part of the output module's functions. The output module is treated in the same manner as the input module by the processor. Some typical output modules available today include the following: * DC voltage (24, 48,110V) or current (4-20 mA). * AC voltage (110, 240v) or current (4-20 mA). * Isolated (24VDC). * Analog output (12-bit). * Word output (16-bit/parallel). * Intelligent output. * ASCII output. * Dual communication port. - 10 -
Description: