120
Electrical, Electronics Engineering Department Develop structured programs for control systems (Mitsubishi) UEUNEED027B Version 1 2 3 4 5 Date 01/09 05/10 06/10 Contact DK DK DK Chisholm Institute Berwick Tel: 9212 4526

D027B Mitsubishi

  • Upload
    sonuom

  • View
    228

  • Download
    1

Embed Size (px)

DESCRIPTION

plc

Citation preview

Electrical, Electronics Engineering Department Develop structured programsforcontrol systems (Mitsubishi) UEUNEED027B Version12345 Date01/0905/1006/10 ContactDKDKDK Chisholm Institute Berwick Tel: 9212 4526 MITSUBISHI UEUNEED027A - 2 - 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 MITSUBISHI UEUNEED027A - 3 - Table of contents Table of contents .......................................................................................................................... 3 Introduction to PLCs ...................................................................................................................... 5 Individual PLC sections ................................................................................................................. 7 Peripheral devices.......................................................................... Error! Bookmark not defined. PLC Operation ............................................................................................................................ 13 Basic PLC instructions ................................................................................................................ 19 Getting Started ............................................................................................................................ 27 Latching Instructions ................................................................................................................... 38 Timers ......................................................................................................................................... 40 Counters ..................................................................................................................................... 45 Exercises and Assessment items ................................................................................................ 50 Assessment Item 1 Door Simulation ................................................................................. 56 Assessment Item 2 Level application ................................................................................ 58 Assessment Item 3 Carton filling timer. ............................................................................. 59 Assessment Item 4 Pallet Loading Counter. ...................................................................... 60 Personal Safety and Safe Work Practices ................................................................................... 61 PLC Installation ........................................................................................................................... 63 Program Storage Methods .......................................................................................................... 65 PLC Hardware ............................................................................................................................ 72 Peripheral Devices ...................................................................................................................... 78 Derived Timers ............................................................................................................................ 89 Counters ..................................................................................................................................... 93 Derived timer Exercises .............................................................................................................. 96 Assessment item 5-Derived timers ....................................................................................... 98 Reversible Counters .................................................................................................................... 99 One Shot ................................................................................................................................... 100 Comparison instructions ............................................................................................................ 102 Assessment Item 6 Traffic light sequence ....................................................................... 107 Program Control ........................................................................................................................ 108 Assessment Item 7- Program Flow .................................................................................... 112 Shift Registers ........................................................................................................................... 113 Assessment Item 8 Shift Register ................................................................................... 120 MITSUBISHI UEUNEED027A - 4 - This page intentionally left blank MITSUBISHI UEUNEED027A - 5 - 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 thatthereisaPLCpresent.Ifyouareinvolvedinmachining,packaging,materialhandling, 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. Forexample,let'sassumethatwhenaswitchturnsonwewanttoturnasolenoidonfor5 seconds and then turn it off regardless of how long the switch is on for. We can do this with a simpleexternaltimer.Butwhatiftheprocessincluded10switchesandsolenoids? Wewould 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 eliminatingthelargecostinvolvedinreplacingthecomplicatedrelaybasedmachinecontrol systems.BedfordAssociates(Bedford,MA)proposedsomethingcalledaModularDigital 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 whenthechangeisfrequent.Sincerelaysaremechanicaldevicestheyalsohavealimited lifetime which required strict adhesion to maintenance schedules. Troubleshooting was also quite tediouswhensomanyrelaysareinvolved.Nowpicturea machinecontrolpanelthatincluded 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!Theserelayswouldbeindividuallywiredtogetherinamannerthatwouldyieldthedesired 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'sa lot to ask! The answerswere to use a programming technique most people were already familiar with and replace mechanical parts with solid-state ones. MITSUBISHI UEUNEED027A - 6 - In the mid1970's the dominant PLC technologies were sequencer state-machines and the bit-slice basedCPU.TheAMD2901and2903processorswerequitepopularinModiconandAllen-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.Communicationsabilitiesbegantoappearinapproximately1973.Thefirstsuchsystemwas 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 voltagestoallowthemtoentertheanalogworld.Unfortunately,thelackofstandardization coupledwithcontinuallychangingtechnologyhasmadePLCcommunicationsanightmareof incompatible protocols and physical networks. Still, it was a great decade for the PLC!The80'ssawanattempttostandardizecommunicationswithGeneralMotor'smanufacturing automation protocol (MAP). It was also a time for reducing the size of the PLC and making them softwareprogrammablethroughsymbolicprogrammingonpersonalcomputersinsteadof dedicated programming terminals or handheld programmers. Today the world's smallest PLC is about the size of a single control relay! The90'shaveseenagradualreductionintheintroductionofnewprotocols,andthe modernizationofthephysicallayersofsomeofthemorepopularprotocolsthatsurvivedthe 1980's. The latest standard (IEC 1131-3) has tried to merge PLC programming languages under oneinternationalstandard.WenowhavePLCsthatareprogrammableinfunctionblock 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. MITSUBISHI UEUNEED027A - 7 - 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. Thislinevoltageisthenstepped-down,rectified,filtered,regulated,voltage-andcurrent-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"arealltermsusedbydifferentmanufacturerstodenotethe same module that performs basically the same functions. The CPU module can be divided into two sections: the processor section and the memory section. TheprocessorsectionmakesthedecisionsneededbythePLCsothatitcanoperateand communicate with other modules. It communicates along either a serial or parallel data-bus. An I/Obaseinterfacemoduleorindividualon-boardinterfaceI/Ocircuitryprovidesthesignal conditioning required to communicate with the processor. The processor section also executes the programmer's RLL software program. MITSUBISHI UEUNEED027A - 8 - The memory sectionThissectionstores(electronically)retrievabledigitalinformationinthreededicatedlocationsof 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. Thememorycontainsdata forseveraltypesof information.Usually,thedatatables,orimage registers,andthesoftwareprogramRLLareintheCPUmodule'smemory.Theprogram 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 programbecomeslarger.Whenthisisdone,thememorysizecanbeashighas1,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. MITSUBISHI UEUNEED027A - 9 - The Program Software Section.The PLC not only requires electronic components to operate, it also needs a software program. ThePLCprogrammerisnotlimitedtowritingsoftwareinoneformat.Therearemanytypes 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). Regardlessofwhichsoftwareischosen,itwillbeexecutedbythePLC'sCPUmodule.The softwarecanbewrittenandexecutedwiththeprocessorinanonlinestate(whilethePLCis actuallyrunning)orintheoff-linestate(wherebytheS/Wexecutiondoesnotaffectcurrent operation of the I/O base). In the RLL software program, we find several types of programming elements and functions to controlprocessesbothinternaltothePLC(memoryandregister)aswellasexternal(field) devices.Listedbelowaresomeofthemorecommontypesofelements,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 Theinputmodulehastwofunctions:receptionofanexternalsignalandstatusdisplayofthat inputpoint.Inotherwords,itreceivestheperipheralsensingunit'ssignalandprovidessignal 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. Peripheraldevicessendingsignalstoinputmodulesthatdescribeexternalconditionscanbe 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. MITSUBISHI UEUNEED027A - 10 - 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 Theoutputmoduletransmitsdiscreteoranalogsignalstoactivatevariousdevicessuchas 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. MITSUBISHI UEUNEED027A - 11 - ThediagrambelowshowsablockdiagramofaPLCbeingusedtocontrolasimple security system MITSUBISHI UEUNEED027A - 12 - Inside The PLC ThePLCmainlyconsistsofaCPU,memoryareas,andappropriatecircuitstoreceive input/output data. We can actually consider the PLC to be a box full of hundreds or thousands of separate relays, counters, timers and data storage locations. Do these counters, timers, etc. really exist?No,theydon't"physically"existbutrathertheyaresimulatedandcanbeconsidered softwarecounters,timers,etc.Theseinternalrelaysaresimulatedthroughbitlocationsin registers. (more on that later) What does each part do?INPUT RELAYS (contacts) Theseareconnectedtotheoutsideworld.Theyphysicallyexistandreceivesignalsfrom switches, sensors, etc. Typically they are not relays but rather they are transistors. INTERNAL UTILITY RELAYS (contacts) Thesedonotreceivesignalsfromtheoutsideworldnordotheyphysicallyexist.Theyare simulated relays and are what enables a PLC to eliminate external relays. There are also some special relays that are dedicated to performing only one task. Some are always on while some are always off. Some are on only once during power-on and are typically used for initializing data that was stored.COUNTERS These again do not physically exist. They are simulated counters and they can be programmed to count pulses. Typically these counters can count up, down or both up and down. Since they are simulatedtheyarelimitedincountingspeed.Somemanufacturersalsoincludehigh-speed counters that are hardware based. We can think of these as physically existing. Most times these counters can count up, down or up and down.TIMERS Thesealsodonotphysicallyexist.Theycomeinmanyvarietiesandincrements.Themost common type is an on-delay type. Others include off-delay and both retentive and non-retentive types. Increments vary from 1ms through 1s. OUTPUT RELAYS (coils) Theseareconnectedtotheoutsideworld.Theyphysicallyexistandsendon/offsignalsto solenoids, lights, etc. They can be transistors, relays, or triacs depending upon the model chosen. DATA STORAGE Typically these are registers assigned to simply store data. They are usually used as temporary storage for maths or data manipulation.MITSUBISHI UEUNEED027A - 13 - PLC Operation A PLC works by continually scanning a program. We can think of this scan cycle as consisting of 3 important steps. There are typically more than 3 but we can focus on the important parts and not worry about the others. Typically the others are checking the system and updating the current internal counter and timer values. CHECK INPUT STATUS First the PLC takes a look at each input to determine if it is on or off. In other words, is the sensor which is connected tothe first input on? How about the second input? How about the third... It records this data into its memory to be used during the next step. EXECUTE PROGRAM Next the PLC executes your program one instruction at a time. Maybe your program said that if the first input was on then it should turn on the first output. Since it already knows which inputs are on/off from the previous step it will be able to decide whether the first output should be turned on based on the state of the first input. It will store the execution results for use later during the next step. UPDATE OUTPUT STATUS Finally the PLC updates the status of the outputs. It updates the outputs based on which inputs were on during the first step and the results of executing your program during the second step. Based on this exampleit would now turn on the first output. After the third step the PLC goes back to step one and repeats the steps continuously. One scan time is defined as the time it takes to execute the 3 steps listed above.MITSUBISHI UEUNEED027A - 14 - Response Time The total response time of the PLC is a fact we have to consider when shopping for a PLC. J ust like our brains, the PLC takes a certain amount of time to react to changes. In many applications speed is not a concern, in others though. If you take a moment to look away from this text you might see a picture on the wall. Your eyes actually see the picture before your brain says "Oh, there's a picture on the wall". In this example your eyes can be considered the sensor.The eyes are connected to the input circuit of your brain. The input circuit of your brain takes a certain amount of time to realize that your eyes saw something. (If you have been drinking alcohol this input response time would be longer!) Eventually your brain realizes that the eyes have seen something and it processes the data. It then sends an output signal to your mouth. Your mouth receives this data and begins to respond to it. Eventually your mouth utters the words "that's a really ugly picture!". Notice in this example we had to respond to 3 things: INPUT It took a certain amount of time for the brain to notice the input signal from the eyes. EXECUTION It took a certain amount of time to process the information received from the eyes. Consider the program to be: If the eyes see an ugly picture then output appropriate words to the mouth. OUTPUT The mouth receives a signal from the brain and eventually spits (no pun intended) out the words "that's a really ugly picture!" MITSUBISHI UEUNEED027A - 15 - Response Time Concerns Now that we know about response time, here's what it really means to the application. The PLC can only see an input turn on/off when it's looking. In other words, it only looks at its inputs during the check input status part of the scan.It is possible that an input pulse may not be detected if the pulse is too short (the pulse is shorter than the program scan. To avoid this we say that the input should be on for at least 1 input delay time +one scan time.But what if it was not possible for the input to be on this long? Then the PLC doesn't see the input turn on. Therefore it becomes a paper weight! Not true... of course there must be a way to get around this. Actually there are 3 ways. Pulse stretch function. This function extends the length of the input signal until the PLC looks at the inputs during the next scan(It stretches the duration of the pulse.) Interrupt function.This function interrupts the scan to process a special routine that you have written. ( As soon as the input turns on, regardless of where the scan currently is, the PLC immediately stopswhatitsdoingandexecutesaninterrupt routine.)A routinecan bethoughtofasamini program outside of the main program.After its done executing the interrupt routine, it goes back to the point it left offand continues on with the normal scan process. Immediate update Some PLCs have an instruction that allows you to set points in the program where the inputs are updated. Instead of just one input update per scan, you can set as many as you need to ensure that the input pulse is seen by the PLC MITSUBISHI UEUNEED027A - 16 - Relays Now that we understand how the PLC processes inputs, outputs, and the actual program we are almost ready to start writing a program. But first lets see how a relay actually works. After all, the main purpose of a PLC is to replace "real-world" relays.We can think of a relay as an electromagnetic switch. Apply a voltage to the coil and a magnetic field is generated. This magnetic field sucks the contacts of the relay in, causing them to make a connection. These contacts can be considered to be a switch. They allow current to flow between 2 points thereby closing the circuit.Let'sconsider the followingexample.Herewesimplyturnonabell(Lunchtime!)whenevera switch is closed. We have 3 real-world parts. A switch, a relay and a bell. Whenever the switch closes we apply a current to a bell causing it to sound. Notice in the picture that we have 2 separate circuits. The bottom, (thin) section indicates the DC part. The top(thick) section indicates the AC part.Here we are using a DC relay to control an AC circuit. That's the fun of relays! When the switch is open no current can flow through the coil of the relay. As soon as the switch is closed, however, current runs through the coil causing a magnetic field to build up. This magnetic field causes the contacts of the relay to close. Now AC current flows through the bell and we hear it. Lunch time! MITSUBISHI UEUNEED027A - 17 - Replacing Relays Next, lets use a PLC in place of the relay. (Note that this might not be very cost effective for this applicationbutitdoesdemonstratethebasicsweneed.)Thefirstthingthat'snecessaryisto create what's called a ladder diagram. After seeing a few of these it will become obvious why its called a ladder diagram. We have to create one of these because, unfortunately, a PLC doesn't understand a schematic diagram. It only recognizes code. Fortunately most PLCs have software which convert ladder diagrams into code. This shields us from actually learning the PLC's code. First step We have to translate all of the items we're using into symbols the PLC understands. The PLC doesn't understand terms like switch, relay, bell, etc. It prefers input, output, coil, contact, etc. It doesn't care what the actual input or output device actually is. It only cares that it is an input or an output.First we replace the battery with a symbol. This symbol is common to all ladder diagrams. We draw what are called bus bars. These simply look like two vertical bars. One on each side of the diagram. Think of the left one as being +voltage and the right one as being ground. Further think of the current (logic) flow as being from left to right.Next we give the inputs a symbol. In this basic example we have one real world input. (i.e. the switch) We give the input that the switch will be connected to, to the symbol shown below. This symbol can also be used as the contact of a relay. A contact symbol Next we give the outputs a symbol. In this example we use one output (i.e. the bell). We give the output that the bell will be physically connected to the symbol shown below. This symbol is used as the coil of a relay. A coil symbol The AC supply is an external supply so we don't put it in our ladder. The PLC only cares about which output it turns on and not what's physically connected to it. MITSUBISHI UEUNEED027A - 18 - Second step We must tell the PLC where everything is located. In other words we have to give all the devices an address. Where is the switch going tobe physically connected to the PLC? How about the bell? We start with a blank road map in the PLCs town and give each item an address. Could you find your friends if you didn't know their address? You know they live in the same town but which house? The PLC town has a lot of houses (inputs and outputs) but we have to figure out who lives where (what device is connected where). We'll get further into the addressing scheme later. The PLC manufacturers each do it a different way! For now let's say that our input will be called "0000". The output will be called "500". Final step We have to convert the schematic into a logical sequence of events. This is much easier than it sounds.Theprogramwe'regoingtowritetellsthePLCwhattodowhencertaineventstake place. In our example we have to tell the PLC what to do when the operator turns on the switch. Obviously we want the bell to sound but the PLC doesn't know that. The picture above is the final converted diagram. Notice that we eliminated the real world relay from needing a symbol. It's actually "inferred" from the diagram.Now let's examine some of the basic instructions is greater detail to see more about what each one does.MITSUBISHI UEUNEED027A - 19 - Basic PLC instructions LOAD and LOAD INVERSE instructions.

OUT instruction. Example, LD and OUT instructions MITSUBISHI UEUNEED027A - 20 - Example, LDI and OUT instructions MITSUBISHI UEUNEED027A - 21 - Simple Example Now let's compare a simple ladder diagram with its real world external physically connected relay circuit and see the differences. In the above circuit, the coil will be energized when there is a closed loop between the +and - terminals of the battery. We can simulate this same circuit with a ladder diagram. A ladder diagram consists of individual rungs just like on a real ladder. Each rung must contain one or more inputs and one or more outputs. The first instruction on a rung must always be an input instruction and the last instruction on a rung should always be an output (or its equivalent). Notice in this simple one rung ladder diagram we have recreated the external circuit above with a ladder diagram. Here we used the Load and Out instructions. Some manufacturers require that every ladder diagram include an END instruction on the last rung.MITSUBISHI UEUNEED027A - 22 - Level Application Let's consider the following application:Wearecontrollinglubricatingoilbeingdispensedfromatank.Thisispossiblebyusingtwo sensors. We put one near the bottom and one near the top, as shown in the picture below. Here, we want the fill motor to pump lubricating oil into the tank until the high level sensor turns on. At that point we want to turn off the motor until the level falls below the low level sensor. Then we should turn on the fill motor and repeat the process. Here we have a need for 3 I/O (i.e. Inputs/Outputs). 2 are inputs (the sensors) and 1 is an output (the fill motor). Both of our inputs will be NC (normally closed) fiber-optic level sensors. When they are NOT immersed in liquid they will be ON. When they are immersed in liquid they will be OFF.We will give each input and output device an address. This lets the PLC know where they are physically connected. The addresses are shown in the following tables: InputsAddressOutputsAddressInternal Utility Low0000Motor50001000 High0001 MITSUBISHI UEUNEED027A - 23 - Below is what the ladder diagram will actually look like. Notice that we are using an internal utility relay in this example. You can use the contacts of these relays as many times as required. Here they are used twice to simulate a relay with 2 sets of contacts. Remember, these relays DO NOT physically exist in the PLC but rather they are bits in a register that you can use to simulate a relay. We should always remember that the most common reason for using PLCs in our applications is for replacing real-world relays. The internal utility relays make this action possible. It's impossible to indicate how many internal relays are included with each brand of PLC. Some include 100's whileothersinclude1000'swhilestillothersinclude10'sof1000's!Typically,PLCsize(not physical size but rather I/O size) is the deciding factor. If we are using a micro-PLC with a few I/O we don't need many internal relays. If however, we are using a large PLC with 100's or 1000's of I/O we'll certainly need many more internal relays. If ever there is a question as to whether or not the manufacturer supplies enough internal relays, consult their specification sheets. In all but the largest of large applications, the supplied amount should be MORE than enough.MITSUBISHI UEUNEED027A - 24 - The Program Scan Let's watch what happens in this program scan by scan. Initially the tank is empty therefore, input 0000 is TRUE and input 0001 is also TRUE. Scan 1 Scan 2-100 Gradually the tank fills because 5000 (fill motor) is on.MITSUBISHI UEUNEED027A - 25 - After 100 scans the oil level rises above the low level sensor and it becomes open.( false) Scan 101-1000 Notice that even when the low level sensor is false there is still a path of true logic from left to right. This is why we used an internal relay. Relay 1000 is latching the output (5000) on. It will stay this way until there is no true logic path from left to right.(i.e. when 0001 becomes false). After 1000 scans the oil level rises above the high level sensor at it also becomes open (false) Scan 1001 Scan 1002 MITSUBISHI UEUNEED027A - 26 - Since there is no more true logic path, output 5000 is no longer energized (true) and therefore the motor turns off. After 1050 scans the oil level falls below the high level sensor and it will become true again. Scan 1050 Notice that even though the high level sensor became true there still is NO continuous true logic path and therefore coil 1000 remains false! After 2000 scans the oil level falls below the low level sensor and it will also become true again. AtthispointthelogicwillappearthesameasSCAN1aboveandthelogicwillrepeatas illustrated above. MITSUBISHI UEUNEED027A - 27 - Getting Started To start the program Double click on the FX-program icon on your desktop. The FX workspace You can move around and select the variousscreen functionsand optionseither by using the keyboard buttons or the mouse . The menu options at the top of the screen identify the alternative key operations. If you are only using the keyboard, you will not need to display the tool bars (see Tool bars note below). Hint: You can jump between the project workspace and the ladder diagram by pressing the Alt-O keys. MITSUBISHI UEUNEED027A - 28 - Using Tool bars The tool bar is a row of icons below the menu options that you can click on with the mouse to activate a variety of commands and functions. These are not needed if you use the keyboard to select items. Hint:You may not see the tool barsyou needwhenthe screen is first displayed. To display specific tool bars, select Tool Bars from the View menu; when the tool bar dialogue window is displayed, click the tool bar tick-boxes needed and press OK. It is possible to customise the tool bars. Select project new project to start your program. MITSUBISHI UEUNEED027A - 29 - The following dialog box will appear Complete the windows in the box as shown and press ok. You are now ready to write your program MITSUBISHI UEUNEED027A - 30 - Ladder diagram elements Normally open contact Normally closed contact Normally open parallel contact Normally closed parallel contact Vertical line Horizontal line Output coil Function command This means that the ladder diagram can be constructed by either using the mouse and selecting the required element or entering the function key corresponding to the required element Entering the Ladder Diagram (COMPACT_PROG1) The Ladder Diagram of COMPACT_PROG1 as shown at the beginning of this section will now be entered. Entering the first contact, Normally Open X0 -Using the mouse or F5 from keyboard, select the normally open contact. - -Enter the name X0 --Select OK -The Ladder Diagram now becomes as shown below MITSUBISHI UEUNEED027A - 31 - Entering the second contact, Normally Cl osed T1. Using the keyboard, enter: -T1 -Select OK - -The Ladder Diagram now becomes as shown below. Output, Timer T0. Enter the following: -Function key F7 -T0 -Space -K10 -OK The Ladder Diagram now becomes as shown belowMITSUBISHI UEUNEED027A - 32 - Conversion to an Instruction Program Before the program can be saved, the Ladder Diagram must first of all be converted into a set of MELSECTM instructions. (Incidentally, MELSEC is the brand name used by Mitsubishi Electric for their PLC products and is derived from the term: Mitsubishi Electric Sequencers) To execute the conversion process, carry out the following: 1.From the Main Menu, select Convert. 2.Select the Convert function. Alternatively click on either of the buttons or simply press the F4 key. The Ladder diagram will now be converted to instruction code for the PLC and the resulting display will be as shown below. NOTE: The grey unconverted background area becomes clear and line numbers appear at the start of each line. MITSUBISHI UEUNEED027A - 33 - Saving the Project. To save the project on the hard drive, carry out the following. 1.From the Main Menu, select Project. 2.Select Save. Alternatively press thebutton on the tool bar. The project will now be saved to C:\MELSEC\COMPACT_PROG1 on the computer hard disk drive. (Dependent on Individual computer preferences) MITSUBISHI UEUNEED027A - 34 - Instruction List Programming An Instruction List program is an alternative method for producing PLC Programs. The instruction program is the actual command instructions that the PLC executes when running a program. However, unless a programmer is very skilled at producing such programs, it is usually preferred that the program be produced by the ladder method. When GX Developer has been used to produce a Ladder Diagram, then the equivalent instruction Program can easily be displayed. Instruction List Program (COMPACT_PROG1) To obtain the equivalent instruction Program for COMPACT_PROG1, carry out the following. 1.From the Main Menu select, -View -Instruction List 2.Displayed on the screen will be the instruction list representation of the program for COMPACT_PROG1. NOTE: By toggling the keys F1 or by clicking the button on the toolbar, the Ladder Diagram or equivalent Instruction Program can be displayed. MITSUBISHI UEUNEED027A - 35 - Explanation Instruction List Programming Start of a Rung Where the first contact on each rung is a normally open contact, then the equivalent instruction will always be: -LD(Load). Where the first contact on each rung is a normally closed contact, then the equivalent instruction will always be: -LDI (Load inverse) Contacts in Series Where there is more than one contact connected in series, then to obtain an Output, all of the contacts must be correctly operated. -i.e. X0 ON, T1 OFF HenceforthetimercoilT0tobeenergised,inputX0isoperatedANDtheinputT1isnot operated.This is written in an instruction program as -LD X0 -AN1T0 Henceafterthefirstcontactoneachrung,anyadditionalseriesconnectedcontacts,willbe preceded -AND for all normally open contacts -ANI for all normally closed contacts. Outputs Each run must be terminated by one or more outputs i.e. Output solenoid Y Timer coil T Counter C Internal memory bit (relay) M Special instructions i.e. -Pulse (One shot on rising ege) PLS -Master Control Contact MC -End of program END An Applied/Functional Instruction i.e. -Block Move BMOV -Addition ADD -Multiplication MUL AllOutputSolenoid(Coil)instructionsareprecededwiththeinstructionOUT,followedbythe output number and if appropriate, a constant K value i.e. OUT TO K10 This indicates that Timer T0 has been programmed to give an ON time delay of (10 x 0.1 ms) =1.0 second. MITSUBISHI UEUNEED027A - 36 - Write Program to PLC 1.From the Main menu, select Online. 2.Select Write to PLC. Alternatively, click on the button from the toolbar. TIP:Get into the habit of using the tool buttons, they save a great deal of time! 3.The display will be as shown below: MITSUBISHI UEUNEED027A - 37 - Monitoring Monitoring the example program COMPACT_PROG4 To monitor the Ladder Diagram of COMPACT_PROG4, carry out the following. 1.From the Main Menu, select Online. 2.Select Monitor. 3.Select Start Monitoring (All Windows) NOTE: Use the Start Monitoring F3 shortcut key: As can be seen from the display, an alternative to the drop down menus to startmonitoring is the F3 key. Alternatively, use theicon to start the monitor mode. MITSUBISHI UEUNEED027A - 38 - Latching Instructions Regular output coils are of course an essential part of our programs but we must remember that they are only TRUE when all instructions before them on the rung are also TRUE. What happens if they are not? Then of course, the output will become false (turn off).Think back to the lunch bell example we did a few chapters ago. What would've happened if we couldn't find a "push on/push off" switch? Then we would've had to keep pressing the button for as long as we wanted the bell to sound. (A momentary switch) The latching instructions let us use momentary switches and program the PLC so that when we push one the output turns on and when we push another the output turns off. Here is a real world example.Picture the remote control for your TV. It has a button for ON and another for OFF.When you push the ON button the TV turns on. When you push the OFF button the TV turns off. You don't have to keep pushing the ON button to keep the TV on. This would be the function of a latching instruction. The latch instruction is often called a SET or OTL (output latch).The unlatch instruction is often called a RES (reset), OTU (output unlatch) or RST (reset). The diagram below shows how to use them in a program. Here we are using 2 momentary push button switches. One is physically connected to input 0000 while the other is physically connected to input 0001. When the operator pushes switch 0000 the instruction "set 0500" will become true and output 0500 physically turns on.Even after the operator stops pushing the switch, the output (0500) will remain on. It is latched on. The only way to turn off output 0500 isturn on input 0001. Thiswill cause the instruction "res 0500" to become true thereby unlatching or resetting output 0500. Here's something to think about. What would happen if input 0000 and 0001 both turn on at the exact same time.Will output 0500 be latched or unlatched?Toanswerthisquestionwehavetothinkaboutthescanningsequence.Theladderisalways scanned from top to bottom, left to right. The first thing in the scan is to physically look at the inputs. 0000 and 0001 are both physically on.NextthePLCexecutestheprogram.Startingfromthetopleft,input0000istruethereforeit should set 0500. Next it goes to the next rung and since input 0001 is true it should reset 0500. The last thing it said was to reset 0500. Therefore on the last part of the scan when it updates the outputs it will keep 0500 off. MITSUBISHI UEUNEED027A - 39 - Latching Example using set (SET) and reset (RST) For this exercise we need two Normally Open momentary switches (push buttons) and a lamp. Add the following three rungs to your program. Once you have the rungs entered correctly, download and run your program. Ladder Mnemonics Activate the Start and Stop switches and ensure that the S and R output instructions are responding correctly. MITSUBISHI UEUNEED027A - 40 - Timers Let'snowseehowatimerworks.Whatisatimer?Itsexactlywhatthewordsays...itisan instruction that waits a set amount of time before doing something.When we look at the different kinds of timers available the fun begins. As always, different types of timers are available with different manufacturers. Here are most of them: On-Delaytimer-Thistypeof timersimply"delaysturningon". Inother words,afteroursensor (input) turns on we wait x-seconds before activating a solenoid valve (output). This is the most common timer. It is often called TON (timer on-delay), TIM (timer) or TMR (timer). Off-Delay timer- This type of timer is the opposite of the on-delay timer listed above. This timer simply "delays turning off". After oursensor (input) sees a target we turn on a solenoid (output). When the sensor no longer sees the target we hold the solenoid on for x-seconds before turning it off.It is called a TOF (timer off-delay) and is less common than the on-delay type listed above. Retentive or Accumulating timer- This type of timer needs 2 inputs. One input starts the timing event (i.e. the clock starts ticking) and the other resets it. The on/off delay timers above would be reset if the input sensor wasn't on/off for the complete timer duration. This timer however holds or retains the current elapsed time when the sensor turns off in mid-stream.For example, we want to know how long a sensor is on for during a 1 hour period.If we use one of the above timers they will keep resetting when the sensor turns off/on. This timer however, will give us a total or accumulated time. It is often called an RTO (retentive timer) or TMRA (accumulating timer).Let's now see how to use them. We typically need to know 2 things: What will enable the timer. Typically this is one of the inputs.(a sensor connected to input 0000 for example) How long we want to delay before we react. Let's wait 5 seconds before we turn on a solenoid, for example. When the instructions before the timer symbol are true the timer starts "timing". When the time elapses the timer will automatically close its contacts.WhentheprogramisrunningonthePLC,theprogramtypicallydisplaystheelapsedor "accumulated" time for us so we can see the current value.Typically timers can time from 0 to 9999 or 0 to 65535 times. Why the weird numbers? Again its because most PLCs have 16-bit timers. 0-9999 is 16-bit BCD (binary coded decimal) 0 to 65535 is 16-bit binary. Each tick of the clock is equal to x-seconds. Typically each manufacturer offers several different ticks.Most manufacturers offer 10 and 100 ms increments (ticks of the clock).A "ms" is a milli-second or 1/1000th of a second.Several manufacturers also offer 1ms as well as 1 second increments.Thesedifferentincrementtimersworkthesameasabovebutsometimestheyhavedifferent names to show their timebase.Some are TMH (high speed timer), TMS (super highspeed timer) or TMRAF (accumulating fast timer) MITSUBISHI UEUNEED027A - 41 - Shownbelowisatypicaltimerinstructionsymbolwewillencounter(dependingonwhich manufacturer we choose) and how to use it. Remember that while they may look different they are all used basically the same way. If we can setup one we can setup any of them. This timer is the on-delay type and is named Txxx.When the enable input is on the timer starts to tick.When it ticks yyyyy (the preset value) times, it will turn on its contacts that we will use later in the program.Remember that the duration of a tick (increment) varies with the vendor and the timebase used. (i.e. a tick might be 1ms or 1 second or...) Below is the symbol shown on a ladder diagram: In this diagram we wait for input 0001 to turn on. When it does, timer T000 (a 100ms increment timer) starts ticking.Itwilltick100times.Eachtick(increment)is100mssothetimerwillbea10000ms(i.e.10 second) timer.100ticks X 100ms =10,000ms. When 10 seconds have elapsed, the T000 contacts close and 500 turns on.When input 0001 turns off(false) the timer T000 will reset back to 0 causing its contacts to turn off(become false) thereby making output 500 turn back off.An accumulating/retentive timer would look similar to this: MITSUBISHI UEUNEED027A - 42 - This timer is named Txxx. When the enable input is on the timer starts to tick.When it ticks yyyyy (the preset value) times, it will turn on itscontacts that we will use later in the program.Rememberthatthedurationofatick(increment)varieswiththevendorandthe timebase used. (i.e. a tick might be 1ms or 1 second or...) If however, the enable input turns off before the timer has completed, the current value will be retained. When the input turns back on, the timer will continue from where it left off. The only way to force the timer back to its preset value to start again is to turn on the reset input.The symbol is shown in the ladder diagram below. In this diagram we wait for input 0001 to turn on. When it does timer T000 (a 10ms increment timer) starts ticking. It will tick 100 times.Each tick (increment) is 10ms so the timer will be a 1000ms (1 second) timer. (100ticks X 10ms =1,000ms).When 1 second has elapsed, the T000 contacts close and 5000 turns on. If input 0001 turns off while the timer is timing the accumulated value will be retained. When 0001 turns back on the timer will continue where it left off.When input 0002 turns on (true) the timer T000 will reset back to 0 causing its contacts to turn off (become false). Always remember that although the symbols may look different they all operate the same way.Typically the major differences are in the duration of the ticks increments.MITSUBISHI UEUNEED027A - 43 - Mitsubishi Timer instructions On delay ---( T0 K100 )--- Description A timer is activated when its input condition goes ON and is reset to 0 when the input condition goes OFF.Once activated, the timermeasures in units of 0.1 second from 0. If the input condition remains ON long enough for TIM to time down to zero, the Completion Flag for the Timer number used will turn ON and will remain ON until the timer is reset (that is, until its input condition goes OFF). Operand Data Areas: Timer Number 0 - 255 Timer range 0 - 32767 Use the Timer instruction to turn an output on or off after the timer has been on for a preset time interval. This output instruction begins timing when its rung goes "true." It then waits the specified amountof time (assetinthesetvalue), keepstrackoftheaccumulatedintervalswhichhave occurred, and sets the Timer done bit when the current time equals the set value. MITSUBISHI UEUNEED027A - 44 - Example(TIM ) Enter the following program being careful to enter the addresses exactly as shown. Confirm that you have entered the number 100 as the timer's set value. This value represents a 10 second timing interval (100x0.1) as the timebase is fixed at 0.1 seconds: Ladder Mnemonics Once you have your program entered and compiled, download it to the PLC. Ensure that Switch X0 is Open, and then place the PLC into the Run mode. Toggle the state of switch X0 a number of times, and observe the operation of the Timer in the Ladder Rung program display.Confirm that when the rung is taken false, the accumulator and its control bit is set to 0. This type of timer is a non-retentive instruction. Conclusion: Use the Timer instruction to turn an output on or off after the timer has been on for a preset time interval. This output instruction begins timing when its rung goes "true". It waits the specified amount of time (as set in the SV), keeps track of the accumulated intervals which have occurred and sets the timer contact when the accumulated time is reached.

As long as rung conditions remain true, the timer adjusts its accumulated value each evaluation until it reaches zero. The accumulated value is reset when rung conditions go false, regardless of whether the timer has timed out. Note The Mitsubishi FX1 does not support timer off delay and retentive timer instructions. MITSUBISHI UEUNEED027A - 45 - Counters A counter is a simple device intended to do one simple thing - count. Using them, however, can sometimes be a challenge because every manufacturer (for whatever reason) seems to use them adifferentway.Thefollowinginformationwillletyousimplyandeasilyprogramanybody's counters.Types of counters What kinds of counters are there? Well, there are up-counters (they only count up 1,2,3...). These are called CTU,(count up) CNT,C, or CTR.There are down counters (they only count down 9,8,7,...). These are typically called CTD (count down) when they are a separate instruction. There are also up-down counters (they count up and/or down 1,2,3,4,3,2,3,4,5,...). These are typically called UDC (up-down counter) when they are separate instructions.Many manufacturers have only one or two types of counters but they can be used to count up, down or both.To furtherconfusetheissue,mostmanufacturersalsoincludealimitednumberofhigh-speed counters.These are commonly called HSC (high-speed counter), or CTH (Counter High-speed?).Typicallyahigh-speedcounterisa"hardware"device.Thenormalcounterslistedaboveare typically "software" counters, in other words they don't physically exist in the plc but rather they are simulated in software.Hardware counters do exist in the plc and they are not dependent on scan time.A good rule of thumb is simply to always use the normal (software) counters unless the pulses you are counting will arrive faster than 2X the scan time. (i.e. if the scan time is 2ms and pulses will be arriving for counting every 4ms or longer then use a software counter.Iftheyarrivefasterthanevery4ms(3msforexample)thenusethehardware(high-speed) counters. (2xscan time =2x2ms=4ms)To use them we must know 3 things: Wherethepulsesthatwewanttocountarecomingfrom.Typicallythisisfromoneofthe inputs.(a sensor connected to input 0000 for example)How many pulses we want to count before we react. Let's count 5 bottles before we box them, for example.When/how we will reset the counter so it can count again. After we count 5 bottles lets reset the counter, for example.WhentheprogramisrunningonthePLCtheprogramtypicallydisplaysthecurrentor "accumulated" value for us so we can see the current count value.Typicallycounterscancountfrom"0to9999","-32,768to+32,767"or"0to65535". Whythe weird numbers?Thisisbecause0-9999is16-bitBCD(binarycodeddecimal)and-32,768to32767and0to 65535 require 16-bit binary and most PLCs use 16bit numbers Here are some of the instruction symbols we will encounter (depending on which manufacturer we choose) and how to use them.Remember that while they may look different they are all used basically the same way. If we can program one we can program any of them. MITSUBISHI UEUNEED027A - 46 - In this counter we need 2 inputs. One goes before the reset line. When this input turns on the current (accumulated) count value will return to zero. The second input is the address where the pulses we are counting are coming from. For example, if we are counting how many bottles pass in front of the sensor that is physically connected to input 0001 then we would put normally open contacts with the address 0001 in front of the pulse line.Cxxx is the name of the counter. If we want to call it counter 000 then we would put "C000" here. yyyyy is the number of pulses we want to count before doing something. If we want to count 5 bottlesbeforeturningonaphysicaloutputtoboxthemwewouldput5here.Ifwewantedto count 100 bottles then we would put 100 here, etc.When the counter is finished (i.e we counted yyyyy bottles) it will turn on a separate contact that we also label Cxxx.Note that the counter accumulated value ONLY changes at the off to on transition of the pulse input.Here's the symbol on a ladder showing how we set up a counter (we'll name it counter 000) to count 100 bottles from input 0001 before turning on output 500.Sensor 0002 resets the counter. MITSUBISHI UEUNEED027A - 47 - Below is one symbol we may encounter for an up-down counter. We'll use the same abbreviation as we did for the example above.(i.e. UDCxxx and yyyyy) In this up-down counter we need to assign 3 inputs. The reset input has the same function as above, however, instead of having only 1 input for the pulse counting we now have 2. One is for counting up and the other is for counting down. In this example we will call the counter UDC000 and we will give it a preset value of 1000. (we'll count 1000 total pulses) For inputs we'll use a sensor which will turn on input 0001 when it sees a target and another sensor at input 0003 will also turn on when it sees a target. When input 0001 turns on we count up and when input 0003 turns on we count down. When we reach 1000 pulses we will turn on output 500. Again note that the counter accumulated value ONLY changes at the off to on transition of the pulse input. The ladder diagram is shown below. OneimportantthingtonoteisthatinsomePLCscountersandtimerscan'thavethesame address. This is because they typically use the same registers. MITSUBISHI UEUNEED027A - 48 - Mitsubishi FX1 Counter instructions Count up ---( C0 K100 )--- Description CNT is used to count up from 0 when the input condition on the count pulse, CP, goes from OFF to ON, that is, the present value (PV) will be incremented by one whenever CNT is executed with a positive pulse. If the input condition has not changed or has changed from ON to OFF, the Present Value of the counter will not be changed. The Completion Flag for a counter is turned ON when the Present Value reaches the Set Value and will remain ON until the counter is reset. CNT is reset with a reset input, RST. When RST goes from OFF to ON, the counter is reset to 0. The counter will not be incremented while RST is ON. Operand Data Areas: Counter Number0 - 255 Counter range 0 - 32767 Sincethereisonecurrentvalueforeachcounter,donotassignthesamecounternumberto more than one counter.Example (CNT) Enter the following program being careful to enter the addresses exactly as shown. Ladder MITSUBISHI UEUNEED027A - 49 - Mnemonics Confirm that you have entered the number 100 as the counter's set value. This value is optionally used to set the point at which the counter's completion flag will be Set, indicating that the count is complete. Once you have your program entered, and have ensured that it is correct, download it to the PLC. Ensure that Switches X0 and X1 are Open, and then place the PLC into the Run mode. OpenandCloseswitchX0anumberoftimesandcarefullyobservetheincrementingofthe counteraccumulator and the operation of the output bit. Close switch X1 and observe the effect that the "RST" input has on the counter. Attempt to increment the counter while switch X1 is closed.You should not be able to increment the counter while the "RST" input is held "True".OpenswitchX1toallowthe"RST"input to go false,andthenincrementthecounteruntilthe counter equals 100. Conclusion: The CNT output instruction counts up for each false-to-true transition of conditions preceding it in the rung and produces an output when the accumulated value reaches the preset value. Rung transitions might be triggered by a limit switch or by parts travelling past a detector etc. The ability of the counter to detect a false-to-true transition depends on the speed (frequency) of the incoming signal. The on and off duration of an incoming signal must not be faster than the scan time.

MITSUBISHI UEUNEED027A - 50 -

Exercises and Assessment items MITSUBISHI UEUNEED027A - 51 - Exercise 1 STOP START STATION. When the start button is operated the line contactor is energised, closing the hold in contact. The line contactor will remain energised until the stop button is pressed. MITSUBISHI UEUNEED027A - 52 - Exercise 2 MULTIPLE STOP START STATION. Operation of either PB3 or PB4 will energise the line contactor and operation of PBI or PB2 will de-energise the circuit. MITSUBISHI UEUNEED027A - 53 - Exercise 3 DIRECT ON LINE MOTOR STARTER. A D.O.L. motor starter is used to connect AC motors to the supply mains in one switching step. A typical D.O.L. starter would cater for; a: Stop button input. b: Start button input. c: Thermal overload protection. d: motor stop/run indicators. MITSUBISHI UEUNEED027A - 54 - Exercise 4 CONVEYOR CONTROL The above circuit operates as follows. When the conveyor is stopped 'Motor stopped' light is on. When the reverse start button is pressed the conveyor starts in reverse and the reverseindicator light comes on. When the forward start button is pressed the conveyor starts in forward and the forward indicator light comes on. The Conveyor must be stopped before changing from reverse to forward and vice versa. The conveyor shuts down if either 'Thermal overload' or 'master stop' is pressed. MITSUBISHI UEUNEED027A - 55 - Exercise 5 CONVEYOR CONTROL OPERATION PB2 starts the conveyor in fast forward mode. PB3') starts the conveyor in fast reverse mode. Interlocking prevents forward and reverse being energised at the same time. PB5 puts the conveyor into slow mode.(Only when fast forward or reverse is selected). MITSUBISHI UEUNEED027A - 56 - Assessment Item 1 Door Simulation Take the time to familiarize yourself with the components used in the Door system, and take particular note of the current state of the limit switches.When the door is in the closed position, the lower limit is activated and the upper limit is deactivated. Both upper and lower limit switches are normally open switches and only close when the striker on the bottom of the door comes in contact with them. Don't continue on with the exercise until you are confident that you understand the operation of the system. In this exercise we want you to apply your knowledge of Relay Logic Instructions to design a program which will control the Door. The Door System includes a Reversible Motor, a pair of Limit Switches and a Control Panel, all connected to your PLC. The program you create will monitor and control this equipment while adhering to the following criteria: The Open and Close pushbuttons will be used to control the movement of the door. Movement will not be maintained when either switch is released. Pressing the Open Switch will cause the door to move upwards (open) if not already fully open. The opening operation will continue as long as the switch is held down. If the switch is released, or if limit switch LS1 closes, the door movement will halt immediately. MITSUBISHI UEUNEED027A - 57 - Pressing the Close Switch will cause the door to move down (close) if not already fully closed. The closing operation will continue as long as the switch is held down. If the switch is released, or if limit switch LS2 closes, the door movement will halt immediately. If the Door is already fully opened, Pressing the Open Switch will Not energize the motor. If the Door is already fully closed, Pressing the Close Switch will Not energize the motor. Under no circumstance will both motor windings be energized at the same time. The Open Lamp will be illuminated if the door is in the Fully Open position. The Shut Lamp will be illuminated if the door is in the Fully Closed position. The Ajar lamp will be illuminated when the door is ajar Design, debug, and test your Program. Avoid the use of Set or Reset latching instructions, and make a concerted effort to minimize the number of rungs employed. Ensure that you have made effective use of both instruction and rung comments to clearly document your program. All I/O components referenced within your program should be clearly labelled, and rung comments should be employed to add additional clarity as required. MITSUBISHI UEUNEED027A - 58 - Assessment Item 2 Level application Level Application (Using Latching instructions.) Write a PLC program to control the following process using latch (S) and unlatch (R) instructions Wearecontrollingtheleveloflubricatingoilbeingdispensedfromatank.Thisispossibleby using two sensors. We put one near the bottom and one near the top, as shown in the picture below. The fill motor is to pump lubricating oil into the tank until the high level sensor turns on. At that point the motor is turned off until the level falls below the low level sensor. The fill motor should turn on again and repeat the process. Both inputs are NC (normally closed) fibre-optic level sensors.When they are NOT immersed in liquid they will be ON.When they are immersed in liquid they will be OFF.MITSUBISHI UEUNEED027A - 59 - Assessment Item 3 Carton filling timer. This circuit places a ten second shot of liquid into a carton each time a carton position limit switch is operated. The circuit must provide for; a: Carton position limit input. b: Dosing solenoid output. MITSUBISHI UEUNEED027A - 60 - Assessment Item 4 Pallet Loading Counter. This system batches boxes onto a pallet. A solenoid is energised when the eighth box is loaded, and de-energised when a full pallet moves out. The circuit provides for the following inputs and outputs; a: Box detector limit switch, LSI, actuated by boxes arriving on the pallet. b: Pallet change limit switch, LS2, actuated by an outgoing pallet. c: Pallet change solenoid. MITSUBISHI UEUNEED027A - 61 - Personal Safety and Safe Work Practices One of the most important features of any type of technology is Personal Safety and Safe Work Practices.Australian Standards The Australian Standards are the guiding publication for safety.Listed below are some of the key clauses in the current versions of the standards. AS/NZ 3000 clause 2.8 devices for isolation and switching Clause 2.8.3.2 states that a semiconductor device shall not be used for isolation purposes AS/NZ 3000 clause 2.11.8 refers to cranes and hoists This will also refer you to AS1418 AS 1543 Electrical equipment of industrial machines - all sections (but in general) Section 1 - Scope & general Section 3 - Power & control circuits Section 4 - Control Equipment Section 6 Wiring Appendix C - Protective interlocking Employers' ResponsibilityEmployers shall ensure as far as is reasonably practicable that machinery, plant and equipment is safeandwithoutriskswhenusedproperty.Thisrequireshavingtheapplicationofhazard analysis procedures at the design stage together with procedures which specifically relate to the following:Design and procurement.Installation.Commissioning and acceptance.Training and supervision.Operation.Maintenance.Design and ProcurementWhere practicable, manufacturers shall ensure that their product complies with the requirements of the appropriate standards, e.g. hearing conservation control. When preparing documents for the design, repair, procurement or hire of machinery, plant and equipment, either from a manufacturer, importer, supplier, or a service within the same enterprise. Theemployershallalsoensurethatthespecificationsareincompliancewiththerelevant requirementsofthisstandard,anyotherappropriatestandard,therequirementsofstatutory authorities, together with other recognised good practices (which shall be in writing). Note: In some States, manufacturers, importers and suppliers of machinery, plant and equipment, have legal obligations to supply plant and substances which are without risks to health and safety when used properly).MITSUBISHI UEUNEED027A - 62 - InstallationTheinstallation,spacing,clearance,servicesandfootholdaroundmachinery,plantand equipment shall be such as to ensure:stability, safe operation, access and supervision.satisfactory facilities for maintenance work, operating adjustments and cleaning.adequate space for handling materials and parts to or from machines and for work in progress.Commissioning and AcceptanceBefore any machinery, plant or equipment is brought into operation, measures shall be taken to ensure that:machinery, plant or equipment is not used or operated until it has been ascertained that such use or operation does not expose any person to risk of injury;the manufacturer's operating and maintenance instructions/ manuals are readily available to employees and job instructions have been prepared. Note: Attention is drawn to the requirements of some regulatory authorities which, for example, prescribe minimum age limits for operators of some machines. Training and Supervi sionJ ob safety training and instructions form the basis for operator safety training. Supervisory and operating staff should be completely familiar with correct training and operating techniques. It is importanttoemphasisethatmethodsofoperation,training,instruction,testing,auditingand monitoring must be kept up-to-date.Isolating controlsAll power driven machinery or equipment shall have a control for isolating it from all sources of power, whether electrical, hydraulic, pneumatic, mechanical or other.The isolator shall be either on the machine, or in close proximity to it, and shall be clearly visible, readily accessible and clearly identified. Thereshallbeprovisionforthemanuallockingoftheisolatorintheisolatedposition,except where the machinery or equipment is supplied through a removable plug or coupling.MITSUBISHI UEUNEED027A - 63 - PLC Installation Installation of a PLC requires the installer to understand many factors, including environmental, electrical and safety considerations.This chapter will explore these factors in more detail. Specifications and Documentation PLCs, I/O and special purpose modules are complex and expensive pieces of equipment. It is important to consult the manufacturers installation specifications prior to installing hardware; this is often supplied with the equipment. It is not uncommon to receive a CD or be referred to the products support web site. Someinstallationdocumentationcancomeaspartoftheonlinehelpwithintheprogramming software package. Technical documentation often has a language of its own and can be very dry in its text. There is also a degree of assumed knowledge in some text, and that may require careful reading and further research. Common Installation Considerations Safety There are many rules governing the installation of automated equipment and extreme care must be taken to meet these requirements. Climatic Environment Heat, moisture and airborne materials can affect a PLC system. A suitable enclosure should be chosen. The location of PLC should be away from heat sources, preferably towards the bottom of the electrical enclosure. Electrical Interference Some electrical equipment, such as welders and Variable Speed Drives (VSDs), emit high levels of electrical interference. A PLC can be affected by this interference and precautions such as line filtering may need to be taken. Generally PLCs should be installed away from sources of interference such as above as well the cables running to such devices. The PLC input signal wiring must be kept away from these interference sources and any power cables that may be in the vicinity. MITSUBISHI UEUNEED027A - 64 - Earthing For the safety reasons, earthing procedures are important on PLC installations. It is also important that the PLC equipment is correctly earthed so as to limit and/or exclude any unwanted electrical interference. Manufacturers will clearly state the minimum earthing requirements and these should be adhered to. Basic Commissioning Procedures Commissioning a PLC controlled system is an important procedure. Incorrect installation procedures or programming can injure personnel or damage equipment. Good practice requires the installers to follow a set of commissioning procedures, some of which could be: Check each cable connection & continuity between PLC I/O terminals & field devices Test & verify the operation of the emergency stop facility Manually operate field devices and check they are connected to the correct I/O, and that they are in the correct state, i.e.: NO, NC etc. Simulate signals for each analogue loop Force each output on or off in turn to ensure correct operation of the field devices Whenalldevices&wiringhavebeencheckedagainstthedocumentationandsoftware,the system control simulation can commence MITSUBISHI UEUNEED027A - 65 - Program Storage Methods In most applications, the USER PROGRAMwhich isdeveloped for a P.L.C. isstored in, RAM (Random Access Memory) within the P.L.C. where the C.P.U. can gain fast access to the DATA storedinthememoryandactupontheuserinstructionstoenabletheP.L.C.tooperateas programmed. The DATA which is held in the R.A.M. can easily be READ from, WRITTEN to or ALTERED which makes it a very flexible and versatile method of storing the user program as this program also may need to be altered at some point. R.A.M. is also often referred to as READ/WRITE memory because of its operation. ThemajordrawbackwithR.A.M.isthatbecauseofit'sdesignandphysicalconstructionit requirespowertobeappliedatalltimessoastoretainit'sdata,andifpowerisremovedor interrupted for only a very short period of time then all data will be lost. For this reason R.A.M is alsoknownasVOLATILEMEMORYmeaningthatit'scontentsarevolatileifthecorrect conditions do not exist. Because the user program is vital to the correct operation of the field controlled equipment there arevariousmethodsavailabletocopytheexactcontentsoftheR.A.M.ontoanotherformof memory medium that does not require power to be continuously applied to it, and these types of memory medium are known as NON-VOLATILE MEMORY. AlthoughdifferentmethodsareusedtheprincipleofstoringthedataontoNON-VOLATILE memoryisbasicallythesame.TheinformationthattheP.L.C.accessesandusesfromthe R.A.M. memory is stored in groups of BITS (Binary Digits) which can only be in one of two states, beingeither ONor OFF(1or0)andtheR.A.M.memoryareaconsistsofthousandsof these groups made up of wafer thin logic gates that are either in the ON state or the OFF state. The principal of storing the data on a NON-VOLATILE medium simply means that a direct copy of the states of the BITS within the groups is taken and placed in the NON-VOLATILE medium. If the need arises it is a simple matter to re-copy this same data back to the R.A.M. memory area within a very short space of time.MITSUBISHI UEUNEED027A - 66 - Non-Volatile Program StorageTherearevarioustypesofNON-VOLATILEmemorystoragemediumsandsomeoftheseare outlined below:The Floppy DiskThis is a NON-VOLATILE memory storage medium that makes use of a FLEXIBLE diskette (i.e. FLOPPY DISK). The disk hasa thin coating of material that can be electrically magnetised by equipment within a FLOPPY DISK DRIVE, which must be used in conjunction with the disk so as to transfer the data. The diskette is housed in a protective jacket and the whole disk is inserted into the disk drive to enable data transfer. The DATA is transferred to the diskette one bit at a time onto sections of the disk called TRACKS bymagnetisingthesurfacetorepresentgroupsofbitpatternsineithertheONorOFFstate. Within the disk drive there is a magnetising head which is known as the READ / WRITE HEAD and is used to either WRITE data onto the disk or READ data from the disk whilst it is spinning at extremely high speed. The head moves in and out over the spinning disk to access the different sections of the disk area andbecausethiscanoccuratveryhighspeedsthentheresultantaccesstimetoREADor WRITE to the disk is extremely low.MITSUBISHI UEUNEED027A - 67 - For this type of memory storage however, it is required that the P.L.C.'s programming unit has a floppydiskdriveortheP.L.C.mustbeconnectedtoaCOMPUTERwhichisequippedwitha floppy disk drive and the appropriate software for the computer to communicate with the P.L.C. Once the data has been transferred to the floppy diskette the disk can be removed from the disk drive and providing it is stored in a safe place and treated correctly the data will remain on the disk until required.The Hard DiskTheHARDDISKoperatesinessentiallythesamemannerasthefloppydisk,withthemajor differencebeingthattheharddiskasit'snameimplies,ismadefromarigidmaterialandis permanentlyhousedinaseparatecompartmentwithineithertheP.L.C.'sprogrammingunitor within a computer. Because of this the hard disk is often referred to as a FIXED DISK because the disk, the corresponding disk drive and the data are permanent fixtures of the programming unit. The hard disk is kept spinning whereas the floppy disk is only rotated when required, the speed of rotation is greater than that of the floppy, therefore the access time of the hard disk is quicker than that of the floppy disk. The storage capacity of the hard disk is also much greater than the floppy and it is usual to find the hard disk has in excess of 1000 times the capacity of a floppy disk. A typical track and a typical sector is shown in the above diagram. MITSUBISHI UEUNEED027A - 68 - A sector contains a fixed number of bytes -- for example, 256 or 512. Either at the drive or the operating system level, sectors are often grouped together into clusters. AgainaswiththeuseoffloppydiskstheharddiskdrivewhichcontainstheREAD/WRITE HEADSandthemotorsrequiredforrotatingthediskmustbeincludedwithintheP.L.C.'s programming unit or within a computer configured to communicate with the P.L.C.ROMSimilar to RAM, ROM chips contain a grid of columns and rows. But where the columns and rows intersect, ROM chips are fundamentally different from RAM chips. While RAM uses transistors to turn on or off access to a capacitor at each intersection, ROM uses a diode to connect the lines if the value is 1. If the value is 0, then the lines are not connected at all. A diode normally allows current to flow in only one direction and has a certain threshold, known as the forward breakover, that determines how much current is required before the diode will pass it on. In silicon-based items such as processors and memory chips, the forward breakover voltage is approximately 0.6 volts. By taking advantage of the unique properties of a diode, a ROM chip cansendachargethatisabovetheforwardbreakoverdowntheappropriatecolumnwiththe selected row grounded to connect at a specific cell. If a diode is present at that cell, the charge will be conducted through to the ground, and, under the binary system, the cell will be read as being "on" (a value of 1). If the cell's value is 0, there is no diode at that intersection to connect the column and row. So the charge on the column does not get transferred to the row. Asyoucansee,thewayaROMchipworksnecessitatestheprogrammingofperfectand complete data when the chip is created. You cannot reprogram or rewrite a standard ROM chip. If it is incorrect, or the data needs to be updated, you have to throw it away and start over. Creating the original template for a ROM chip is often a laborious process full of trial and error. But the benefits of ROM chips outweigh the drawbacks. Once the template is completed, the actual chips can cost as little as a few cents each. They use very little power, are extremely reliable and, in the caseofmostsmallelectronicdevices,containallthenecessaryprogrammingtocontrolthe device.MITSUBISHI UEUNEED027A - 69 - PROM CreatingROMchipstotallyfromscratchistime-consumingandveryexpensiveinsmall quantities. For this reason, mainly, developers created a type of ROM known as programmable read-onlymemory(PROM).BlankPROMchipscanbeboughtinexpensivelyandcodedby anyone with a special tool called a programmer.PROM chips have a grid of columns and rows just as ordinary ROMs do. The difference is that every intersection of a column and row in a PROM chip has a fuse connecting them. A charge sent through a column will pass through the fuse in a cell to a grounded row indicating a value of 1. Since all the cells have a fuse, the initial (blank) state of a PROM chip is all 1s. To change the value of a cell to 0, you use a programmer to send a specific amount of current to the cell. The higher voltage breaks the connection between the column and row by burning out the fuse. This process is known as burning the PROM. PROMscanonlybeprogrammedonce.TheyaremorefragilethanROMs.Ajoltofstatic electricity can easily cause fuses in the PROM to burn out, changing essential bits from 1 to 0. ButblankPROMsareinexpensiveandaregreatforprototypingthedataforaROMbefore committing to the costly ROM fabrication process. EPROM Working with ROMs and PROMs can be a wasteful business. Even though they are inexpensive perchip, thecostcanaddupovertime.Erasableprogrammableread-onlymemory(EPROM) addresses this issue. EPROM chips can be rewritten many times. Erasing an EPROM requires a special tool that emits a certain frequency of ultraviolet (UV) light. EPROMs are configured using anEPROMprogrammerthatprovidesvoltageatspecifiedlevelsdependingonthetypeof EPROM used. Once again we have a grid of columns and rows. In an EPROM, the cell at each intersection has two transistors. The two transistors are separated from each other by a thin oxide layer. One of the transistors is known as the floating gate and the other as the control gate. The floating gate's only link to the row (wordline) is through the control gate. As long as this link is in place, the cell has a value of 1. To change the value to 0 requires a curious process called Fowler-Nordheim tunnelling. Tunnelling is used to alter the placement of electrons in the floating gate. An electrical charge, usually 10 to 13 volts, is applied to the floating gate. The charge comes from the column (bitline), enters the floating gate and drains to a ground.This charge causes the floating-gate transistor to act like an electron gun. The excited electrons arepushedthroughandtrappedontheothersideofthethinoxidelayer,givingitanegative charge. Thesenegativelychargedelectronsactasabarrierbetweenthecontrolgateandthe MITSUBISHI UEUNEED027A - 70 - floating gate. A device called a cell sensor monitors the level of the charge passing through the floating gate. If the flow through the gate is greater than 50 percent of the charge, it has a value of 1. When the charge passing through drops below the 50-percent threshold, the value changes to 0. A blank EPROM has all of the gates fully open, giving each cell a value of 1. TorewriteanEPROM,youmusteraseitfirst.Toeraseit,youmustsupplyalevelofenergy strong enough to break through the negative electrons blocking the floating gate. In a standard EPROM, this is best accomplished with UV light at a frequency of 253.7. Because this particular frequency will not penetrate most plastics or glasses, each EPROM chip has a quartz window on top of it. The EPROM must be very close to the eraser's light source, within an inch or two, to work properly. An EPROM eraser is not selective, it will erase the entire EPROM. The EPROM must be removed from the device it is in and placed under the UV light of the EPROM eraser for several minutes. An EPROM that is left under too long can become over-erased. In such a case, the EPROM's floating gates are charged to the point that they are unable to hold the electrons at all. EEPROMs and Flash Memory ThoughEPROMsareabigstepupfromPROMsintermsofreusability,theystillrequire dedicated equipment and a labour-intensiveprocessto remove and reinstall them each time a change is necessary. Also, changes cannot be made incrementally to an EPROM; the whole chip must be erased. Electrically erasable programmable read-only memory (EEPROM) chips remove the biggest drawbacks of EPROMs.In EEPROMs:The chip does not have to removed to be rewritten.The entire chip does not have to be completely erased to change a specific portion of it.Changing the contents does not require additional dedicated equipment. Instead of using UV light, you can return the electrons in the cells of an EEPROM to normal with thelocalisedapplicationofanelectricfieldtoeachcell.Thiserasesthetargetedcellsofthe EEPROM, which can then be rewritten. EEPROMs are changed 1 byte at a time, which makes them versatile but slow. In fact, EEPROM chips are too slow to use in many products that make quick changes to the data stored on the chip. Manufacturers responded to this limitation with Flash memory, a type of EEPROM that uses in-circuit wiring to erase by applying an electrical field to the entire chip or to predetermined sections of the chip called blocks. Flash memory works much faster than traditional EEPROMs because it writes data in chunks, usually 512 bytes in size, instead of 1 byte at a time.Cassette Tape StorageThisisamethodofdatastoragethatincorporatestheuseofcassettetapestoholdthedata transferred from the P.L.C.'s R.A.M. memory, this method of storage falls into two distinct types which are mentioned below:Audio Cassette StorageWiththismethodthedataheldinthePLC.'sR.A.M.memoryareacanbetransferredonto standardaudiotypecassettetapesusingastandardaudiocassetterecorderandassociated cables.ThismethodisonlyavailableonPLC.'sthathavethisfacilityandthosethatdohave standard audio cassette INPUT/OUTPUT jacks fitted to their programming units which are usually labelledMICfortransferofdatatothecassetterecorderandEARfortransferringfromthe cassette recorder back into the PLC.'s R.A.M. memory area. This method is quite tedious and requires that the plugs and cables are placed in the correct jacks at both the P.L.C. and the recorder ends, and also that the volume control of the recorder is set to MITSUBISHI UEUNEED027A - 71 - a specific level so as to achieve a good quality transfer of data, therefore this is not one of the mostwidelyusedmethodsofdatastorage,butcanbefoundinsmallermodelsofP.L.C. especially the older types.Digital Cassette Data StorageThis method incorporates the use of both Digital grade quality cassette tape and also a Digital tape recording system, and although physically this method may look similar to the Audio tape method it is far superior in both recording transfer quality and time. Some PLC.'s have a digital taperecordingsystembuiltintotheirprogrammingunitsorseparatedigitalrecorderscanbe obtained. This method is very reliable as generally no controls must be adjusted by the user and the tapes are designed specially to record digital data. BothtapemethodsareformsofNON-VOLATILEprogramstoragebutwiththeincreasesin technology it would be more common to see either DISK or E.P.R.O.M. type storage mediums used in P.L.C. systems these days in preference to cassette tape methods.Printing FacilitiesAlthoughtheuserprogramcontainedwithinthePLC'smemorycanbesearchedthroughand monitored using the PLC's programming unit it is almost essential that a hard copy print-out can be obtained from the PLC system. Being able to view the entire Ladder diagram layout of the user program on paper allows the user to follow through the operational sequence of the program.If the Ladder print-out is correct and well documented then fault finding and commissioning can be accomplished with much less confusion and also quite possibly without the use of the PLC's programming unit. At the very least the print-out obtained generally consists of the program Ladder diagram layout plusalloftheassociatedaddressinginformationcontainedwithintheprogram.Additional features available with most PLC systems allow the user to print out comments on the programs operation, specific names given to each of the addresses (usually known as Mnemonics), Cross referenceinformationonalladdressesusedwithintheprogramandalistingofallcontentsof associated data registers (i.e. Timer, Counter and Shift Register values etc.). MITSUBISHI UEUNEED027A - 72 - PLC Hardware Correct choice of PLC hardware is an important step in an automation project.There are many types on packages with various CPUs, I/O modules and mounting chassis.There is also an I/O limittoeachofthepackages.Inthischapterweinvestigatethevariouschoicesthatare commonly available. PLC Package Configurations PLCscomeinavarietyofconfigurations.Usuallytheprojectwilldeterminethetypeused, however some users will standardise on a particular configuration.This allows them to keep the minimum amount of spares, plus the training of personnel in just the one type can be viewed as an advantage.Below we describe some common package styles. Micro Typically used for small projects Usually fixed I/O sizes from 10 to 30 points A typical micro PLC package showing the Allen-Bradley MicroLogix 1000 Shoe Box Used for medium sized projects with a fixed I/O base Configuration can be expanded with additional modules Usually up to 64 I/O but can be configured up to 128 I/O A typical shoe-box PLC package showing the Allen-Bradley MicroLogix 1500 MITSUBISHI UEUNEED027A - 73 - Rack-Chassis Type UsedformediumtolargeprojectswithaCPU,PowerSupplyandI/Omodulesonarackor chassis Usually 64 I/O and upwards to many hundreds or even thousands of I/O A typical rack/chassis PLC package showing the Allen-Bradley SLC 500 CPU Speed CPU speed is often mentioned by technical sales people when referring to features of a particular PLC.It should be kept in mind that PLCs are all fast, some just faster than others. Unless your project has a particular requirement for speed of operation, a rule of thumb is that the basic CPU will probably do.The choice will then be based on the number of I/O points that are required. Omron Micro Programmable Controller CPM1A The CPM1A series micro contro