19467645 Omron PLC Study

download 19467645 Omron PLC Study

of 99

Transcript of 19467645 Omron PLC Study

  • 8/9/2019 19467645 Omron PLC Study

    1/99

    CHAPTER 1Process control system

    Introduction

    Generally speaking, process control system is made up of a group of electronicdevices and equipment that provide stability, accuracy and eliminate harmful

    transition statuses in production processes. Operating system can have differentform and implementation, from energy supply units to machines. As a result of fast

    progress in technology, many complex operational tasks have been solved byconnecting programmable logic controllers and possibly a central computer. Beside

    connections with instruments like operating panels, motors, sensors, switches, valvesand such, possibilities for communication among instruments are so great that theyallow high level of exploitation and process coordination, as well as greater flexibilityin realiing an process control system. !ach component of an process control system

    plays an important role, regardless of its sie. "or example, without a sensor, #$%

    wouldn&t know what exactly goes on in the process. 'n automated system, #$%controller is usually the central part of an process control system. (ith execution of aprogram stored in program memory, #$% continuously monitors status of the systemthrough signals from input devices. Based on the logic implemented in the program,#$% determines which actions need to be executed with output instruments. )o runmore complex processes it is possible to connect more #$% controllers to a central

    computer. A real system could look like the one pictured below*

  • 8/9/2019 19467645 Omron PLC Study

    2/99

    1.1 Conventional control panel

    At the outset of industrial revolution, especially during sixties and seventies, relayswere used to operate automated machines, and these were interconnected using

    wires inside the control panel. 'n some cases a control panel covered an entire wall.)o discover an error in the system much time was needed especially with morecomplex process control systems. On top of everything, a lifetime of relay contactswas limited, so some relays had to be replaced. 'f replacement was required,machine had to be stopped and production too. Also, it could happen that there wasnot enough room for necessary changes. control panel was used only for oneparticular process, and it wasn&t easy to adapt to the requirements of a new system.As far as maintenance, electricians had to be very skillful in finding errors. 'n short,conventional control panels proved to be very inflexible. )ypical example of

  • 8/9/2019 19467645 Omron PLC Study

    3/99

    conventional control panel is given in the following picture.

    'n this photo you can notice a large number of electrical wires, time relays, timersand other elements of automation typical for that period. #ictured control panel is notone of the more +complicated ones, so you can imagine what complex ones lookedlike.

    -ost frequently mentioned disadvantages of a classic control panel are*

    )oo much work required in connecting wires /ifficulty with changes or replacements /ifficulty in finding errors0 requiring skillful work force (hen a problem occurs, holdup time is indefinite, usually long.

    1.2 Control panel with a PLC controller

    (ith invention of programmable controllers, much has changed in how an processcontrol system is designed. -any advantages appeared. )ypical example of controlpanel with a #$% controller is given in the following picture.

  • 8/9/2019 19467645 Omron PLC Study

    4/99

    Advantages of control panel that is based on a #$% controller can be presented in fewbasic points*

    1.%ompared to a conventional process control system, number of wires needed forconnections is reduced by 1232.%onsumption is greatly reduced because a #$% consumes less than a bunch ofrelays./iagnostic functions of a #$% controller allow for fast and easy error detection.!.%hange in operating sequence or application of a #$% controller to a differentoperating process can easily be accomplished by replacing a program through aconsole or using a #% software 4not requiring changes in wiring, unless addition ofsome input or output device is required5.".6eeds fewer spare parts#.'t is much cheaper compared to a conventional system, especially in cases wherea large number of '7O instruments are needed and when operational functions arecomplex.$.8eliability of a #$% is greater than that of an electromechanical relay or a timer.

    1. %ystematic approach in desi&nin& an process control

    system

    First, you need to select an instrument or a system that you wish to control.Automated system can be a machine or a process and can also be called an processcontrol system. "unction of an process control system is constantly watched by inputdevices 4sensors5 that give signals to a #$% controller. 'n response to this, #$%

    controller sends a signal to external output devices 4operative instruments5 thatactually control how system functions in an assigned manner 4for simplification it isrecommended that you draw a block diagram of operations& flow5.

    Secondly, you need to specify all input and output instruments that will be connectedto a #$% controller. 'nput devices are various switches, sensors and such. Outputdevices can be solenoids, electromagnetic valves, motors, relays, magnetic startersas well as instruments for sound and light signaliation."ollowing an identification of all input and output instruments, corresponding

  • 8/9/2019 19467645 Omron PLC Study

    5/99

    designations are assigned to input and output lines of a #$% controller. Allotment ofthese designations is in fact an allocation of inputs and outputs on a #$% controllerwhich correspond to inputs and outputs of a system being designed.

    Third, make a ladder diagram for a program by following the sequence of operationsthat was determined in the first step.

    "inally, program is entered into the #$% controller memory. (hen finished withprogramming, checkup is done for any existing errors in a program code 4usingfunctions for diagnostics5 and, if possible, an entire operation is simulated. Beforethis system is started, you need to check once again whether all input and outputinstruments are connected to correct inputs or outputs. By bringing supply in,system starts working.

    CHAPTER 2 Introduction to PLC controllers

    'ntroduction

    9.: "irst programmed controllers9.9 #$% controller parts9.; %entral #rocessing unit %# ?ow to program a #$% controller9.@ #ower supply9. 'nput to a #$% controller9.1 'nput adustable interface9.C Output from a #$% controller9.:2 Output adustable interface9.:: !xtension lines

    Introduction

    'ndustry has begun to recognie the need for quality improvement and increase inproductivity in the sixties and seventies. "lexibility also became a maor concern4ability to change a process quickly became very important in order to satisfyconsumer needs5.

    )ry to imagine automated industrial production line in the sixties and seventies.)here was always a huge electrical board for system controls, and not infrequently itcovered an entire wallD (ithin this board there was a great number of interconnectedelectromechanical relays to make the whole system work. By word EconnectedE itwas understood that electrician had to connect all relays manually using wiresD Anengineer would design logic for a system, and electricians would receive a schematic

    outline of logic that they had to implement with relays. )hese relay schemas oftencontained hundreds of relays. )he plan that electrician was given was called EladderschematicE. $adder displayed all switches, sensors, motors, valves, relays, etc. foundin the system. !lectricianFs ob was to connect them all together. One of theproblems with this type of control was that it was based on mechanical relays.-echanical instruments were usually the weakest connection in the system due totheir moveable parts that could wear out. 'f one relay stopped working, electricianwould have to examine an entire system 4system would be out until a cause of theproblem was found and corrected5.

    http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#Introductionhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.1http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.2http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.3http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.4http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.5http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.6.http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.7http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.8http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.9http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.10http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.11http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#Introductionhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.1http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.2http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.3http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.4http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.5http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.6.http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.7http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.8http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.9http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.10http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter2/chapter2.htm#2.11
  • 8/9/2019 19467645 Omron PLC Study

    6/99

    )he other problem with this type of control was in the systemFs break period when asystem had to be turned off, so connections could be made on the electrical board. 'fa firm decided to change the order of operations 4make even a small change5, itwould turn out to be a maor expense and a loss of production time until a systemwas functional again.

    'tFs not hard to imagine an engineer who makes a few small errors during hisproect. 't is also conceivable that electrician has made a few mistakes in connectingthe system. "inally, you can also imagine having a few bad components. )he onlyway to see if everything is all right is to run the system. As systems are usually notperfect with a first try, finding errors was an arduous process. ou should also keepin mind that a product could not be made during these corrections and changes inconnections. Hystem had to be literally disabled before changes were to beperformed. )hat meant that the entire production staff in that line of production wasout of work until the system was fixed up again. Only when electrician was donefinding errors and repairing,, the system was ready for production. !xpenditures forthis kind of work were too great even for welltodo companies.

    2.1 'irst pro&ramma(le controllers

    EGeneral -otorsE is among the first who recognied a need to replace the systemFsEwiredE control board. 'ncreased competition forced automakers to improveproduction quality and productivity. "lexibility and fast and easy change ofautomated lines of production became crucialD General -otorsF idea was to use forsystem logic one of the microcomputers 4these microcomputers were as far as theirstrength beneath todayFs eightbit microcontrollers5 instead of wired relays.%omputer could take place of huge, expensive, inflexible wired control boards. 'fchanges were needed in system logic or in order of operations, program in amicrocomputer could be changed instead of rewiring of relays. 'magine only whatelimination of the entire period needed for changes in wiring meant then. )oday, such

    thinking is but common, then it was revolutionaryD

    !verything was well thought out, but then a new problem came up of how to makeelectricians accept and use a new device. Hystems are often quite complex andrequire complex programming. 't was out of question to ask electricians to learn anduse computer language in addition to other ob duties. General -otors ?idromatic/ivision of this big company recognied a need and wrote out proect criteria for firstprogrammable logic controller 4 there were companies which sold instruments thatperformed industrial control, but those were simple sequential controllers I not #$%controllers as we know them today5. Hpecifications required that a new device bebased on electronic instead of mechanical parts, to have flexibility of a computer, tofunction in industrial environment 4vibrations, heat, dust, etc.5 and have a capabilityof being reprogrammed and used for other tasks. )he last criteria was also the mostimportant, and a new device had to be programmed easily and maintained byelectricians and technicians. (hen the specification was done, General -otors lookedfor interested companies, and encouraged them to develop a device that would meetthe specifications for this proect.

    EGould -odiconE developed a first device which met these specifications. )he key tosuccess with a new device was that for its programming you didnFt have to learn anew programming language. 't was programmed so that same language Ia ladderdiagram, already known to technicians was used. !lectricians and technicians could

  • 8/9/2019 19467645 Omron PLC Study

    7/99

    very easily understand these new devices because the logic looked similar to oldlogic that they were used to working with. )hus they didnFt have to learn a newprogramming language which 4obviously5 proved to be a good move. #$% controllerswere initially called #% controllers 4programmable controllers5. )his caused a smallconfusion when #ersonal %omputers appeared. )o avoid confusion, a designation #%was left to computers, and programmable controllers became programmable logic

    controllers. "irst #$% controllers were simple devices. )hey connected inputs such asswitches, digital sensors, etc., and based on internal logic they turned output deviceson or off. (hen they first came up, they were not quite suitable for complicatedcontrols such as temperature, position, pressure, etc. ?owever, throughout years,makers of #$% controllers added numerous features and improvements. )odayFs #$%controller can handle highly complex tasks such as position control, variousregulations and other complex applications. )he speed of work and easiness ofprogramming were also improved. Also, modules for special purposes weredeveloped, like communication modules for connecting several #$% controllers to thenet. )oday it is difficult to imagine a task that could not be handled by a #$%.

    2.2 PLC controller components

    #$% is actually an industrial microcontroller system 4in more recent times we meetprocessors instead of microcontrollers5 where you have hardware and softwarespecifically adapted to industrial environment. Block schema with typical componentswhich #$% consists of is found in the following picture. Hpecial attention needs to begiven to input and output, because in these blocks you find protection needed inisolating a %#< blocks from damaging influences that industrial environment canbring to a %#< via input lines. #rogram unit is usually a computer used for writing aprogram 4often in ladder diagram5.

    2. Central Processin& )nit * CP)

    %entral #rocessing

  • 8/9/2019 19467645 Omron PLC Study

    8/99

    2.! +emory

    Hystem memory 4today mostly implemented in "$AH? technology5 is used by a #$%for an process control system. Aside from this operating system it also contains a

    user program translated from a ladder diagram to a binary form. "$AH? memorycontents can be changed only in case where user program is being changed. #$%controllers were used earlier instead of "$AH? memory and have had !#8O-memory instead of "$AH? memory which had to be erased with

  • 8/9/2019 19467645 Omron PLC Study

    9/99

  • 8/9/2019 19467645 Omron PLC Study

    10/99

    measure temperature, pressure, or some other physical dimension, etc. 4ex.inductive sensors can register metal obects5.

    Other devices also can serve as inputs to #$% controller. 'ntelligent devices such asrobots, video systems, etc. often are capable of sending signals to #$% controllerinput modules 4robot, for instance, can send a signal to #$% controller input as

    information when it has finished moving an obect from one place to the other.5

    2., Input ad-ustment interace

    Adustment interface also called an interface is placed between input lines and a %# o%, the capacitor will back up memory for 92 days.;. (hen accessing a #K, )% numbers are used as word data0 when accessing %ompleting "lags, they are used asbit data.=. /ata in /-@:== to /-@@>> cannot be overwritten from the program, but they can be changed from a#eripheral /evice

    !.$ Timers and counters

    )imers and counters are indispensable in #$% programming. 'ndustry has to numberits products, determine a needed action in time, etc. )iming functions is veryimportant, and cycle periods are critical in many processes.

    )here are two types of timers delayoff and delayon. "irst is late with turn off andthe other runs late in turning on in relation to a signal that activated timers. !xampleof a delayoff timer would be staircase lighting. "ollowing its activation, it simplyturns off after few minutes.

    !ach timer has a time basis, or more precisely has several timer basis. )ypical valuesare* : second, 2.: second, and 2,2: second. 'f programmer has entered .: as timebasis and >2 as a number for delay increase, timer will have a delay of > seconds 4>2x 2.: second M > seconds5.

    )imers also have to have value HK set in advance. Kalue set in advance or ahead oftime is a number of increments that timer has to calculate before it changes theoutput status. Kalues set in advance can be constants or variables. 'f a variable isused, timer will use a real time value of the variable to determine a delay. )hisenables delays to vary depending on the conditions during function. !xample is asystem that has produced two different products, each requiring different timingduring process itself. #roduct A requires a period of :2 seconds, so number :2 wouldbe assigned to the variable. (hen product B appears, a variable can change value to

    what is required by product B.

    )ypically, timers have two inputs. "irst is timer enable, or conditional input 4whenthis input is activated, timer will start counting5. Hecond input is a reset input. )hisinput has to be in O"" status in order for a timer to be active, or the whole functionwould be repeated over again. Home #$% models require this input to be low for atimer to be active, other makers require high status 4all of them function in the sameway basically5. ?owever, if reset line changes status, timer erases accumulatedvalue.

    (ith a #$% controller by Omron there are two types of timers* )'- and )'-?. )'-timer measures in increments of 2.: seconds. 't can measure from 2 to CCC.Cseconds with precision of 2.: seconds more or less.

    Quick timer 4)'-?5 measures in increments of 2.2: seconds. Both timers are EdelayonE timers of a lesseningstyle. )hey require assignment of a timer number and a setvalue 4HK5. (hen HK runs out, timer output turns on. 6umbers of a timing counterrefer to specific address in memory and must not be duplicated 4same number cannot be used for a timer and a counter5.

  • 8/9/2019 19467645 Omron PLC Study

    28/99

    CHAPTER " Ladder dia&ram

    'ntroduction>.: $adder diagram>.9 6ormally open and normally closed contacts>.; Brief example

    Introduction

    #rogrammable controllers are generally programmed in ladder diagram 4or ErelaydiagramE5 which is nothing but a symbolic representation of electric circuits. Hymbolswere selected that actually looked similar to schematic symbols of electric devices,and this has made it much easier for electricians to switch to programming #$%controllers. !lectrician who has never seen a #$% can understand a ladder diagram.

    ".1 Ladder dia&ram

    )here are several languages designed for user communication with a #$%, among

    which ladder diagram is the most popular. $adder diagram consists of one verticalline found on the left hand side, and lines which branch off to the right. $ine on theleft is called a Ebus barE, and lines that branch off to the right are instruction lines.%onditions which lead to instructions positioned at the right edge of a diagram arestored along instruction lines. $ogical combination of these conditions determineswhen and in what way instruction on the right will execute. Basic elements of a relaydiagram can be seen in the following picture.

    -ost instructions require at least one operand, and often more than one. Operandcan be some memory location, one memory location bit, or some numeric value

    http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter5/chapter5.htm#Introductionhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter5/chapter5.htm#5.1http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter5/chapter5.htm#5.2http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter5/chapter5.htm#5.3http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter5/chapter5.htm#Introductionhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter5/chapter5.htm#5.1http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter5/chapter5.htm#5.2http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter5/chapter5.htm#5.3
  • 8/9/2019 19467645 Omron PLC Study

    29/99

    number. 'n the example above, operand is bit 2 of memory location '8222. 'n acase when we wish to proclaim a constant as an operand, designation R is usedbeneath the numeric writing 4for a compiler to know it is a constant and not anaddress.5

    Based on the picture above, one should note that a ladder diagram consists of two

    basic parts* left section also called conditional, and a right section which hasinstructions. (hen a condition is fulfilled, instruction is executed, and thatFs allD

    #icture above represents a example of a ladder diagram where relay is activated in#$% controller when signal appears at input line 22. Kertical line pairs are calledconditions. !ach condition in a ladder diagram has a value O6 or O"", depending ona bit status assigned to it. 'n this case, this bit is also physically present as an inputline 4screw terminal5 to a #$% controller. 'f a key is attached to a correspondingscrew terminal, you can change bit status from a logic one status to a logic erostatus, and vice versa. Htatus of logic one is usually designated as EO6E, and statusof logic ero as EO""E.

    8ight section of a ladder diagram is an instruction which is executed if left conditionis fulfilled. )here are several types of instructions that could easily be divided intosimple and complex. !xample of a simple instruction is activation of some bit inmemory location. 'n the example above, this bit has physical connotation because itis connected with a relay inside a #$% controller. (hen a %#< activates one of theleading four bits in a word '82:2, relay contacts move and connect lines attached toit. 'n this case, these are the lines connected to a screw terminal marked as 22 andto one of %O- screw terminals.

    ".2 5ormally open and normally closed contacts

    Hince we frequently meet with concepts Enormally openE and Enormally closedE inindustrial environment, itFs important to know them. Both terms apply to words suchas contacts, input, output, etc. 4all combinations have the same meaning whether weare talking about input, output, contact or something else5.

    #rinciple is quite simple, normally open switch wonFt conduct electricity until it ispressed down, and normally closed switch will conduct electricity until it is pressed.Good examples for both situations are the doorbell and a house alarm.

  • 8/9/2019 19467645 Omron PLC Study

    30/99

    'f a normally closed switch is selected, bell will work continually until someonepushes the switch. By pushing a switch, contacts are opened and the flow ofelectricity towards the bell is interrupted. Of course, system so designed would not inany case suit the owner of the house. A better choice would certainly be a normallyopen switch. )his way bell wouldnFt work until someone pushed the switch buttonand thus informed of his or her presence at the entrance.

    ?ome alarm system is an example of an application of a normally closed switch. $etFssuppose that alarm system is intended for surveillance of the front door to thehouse. One of the ways to EwireE the house would be to install a normally openswitch from each door to the alarm itself 4precisely as with a bell switch5. )hen, if thedoor was opened, this would close the switch, and an alarm would be activated. )hissystem could work, but there would be some problems with this, too. $etFs supposethat switch is not working, that a wire is somehow disconnected, or a switch isbroken, etc. 4there are many ways in which this system could become dysfunctional5.)he real trouble is that a homeowner would not know that a system was out of order.A burglar could open the door, a switch would not work, and the alarm would not beactivated. Obviously, this isnFt a good way to set up this system. Hystem should beset up in such a way so the alarm is activated by a burglar, but also by its own

    dysfunction, or if any of the components stopped working. 4A homeowner wouldcertainly want to know if a system was dysfunctional5. ?aving these things in mind,it is far better to use a switch with normally closed contacts which will detect anunauthoried entrance 4opened door interrupts the flow of electricity, and this signalis used to activate a sound signal5, or a failure on the system such as a disconnectedwire. )hese considerations are even more important in industrial environment wherea failure could cause inury at work. One such example where outputs with normallyclosed contacts are used is a safety wall with trimming machines. 'f the wall doorsopen, switch affects the output with normally closed contacts and interrupts a supplycircuit. )his stops the machine and prevents an inury.

    %oncepts normally open and normally closed can apply to sensors as well. Hensors

    are used to sense the presence of physical obects, measure some dimension orsome amount. "or instance, one type of sensors can be used to detect presence of abox on an industry transfer belt. Other types can be used to measure physicaldimensions such as heat, etc. Htill, most sensors are of a switch type. )heir output isin status O6 or O"" depending on what the sensor EfeelsE. $etFs take for instance asensor made to feel metal when a metal obect passes by the sensor. "or thispurpose, a sensor with a normally open or a normally closed contact at the outputcould be used. 'f it were necessary to inform a #$% each time an obect passed bythe sensor, a sensor with a normally open output should be selected. Hensor outputwould set off only if a metal obect were placed right before the sensor. A sensorwould turn off after the obect has passed. #$% could then calculate how many timesa normally open contact was set off at the sensor output, and would thus know howmany metal obects passed by the sensor.

    %oncepts normally open and normally closed contact ought to be clarified andexplained in detail in the example of a #$% controller input and output. )he easiestway to explain them is in the example of a relay.

  • 8/9/2019 19467645 Omron PLC Study

    31/99

    6ormally open contacts would represent relay contacts that would perform aconnection upon receipt of a signal.

  • 8/9/2019 19467645 Omron PLC Study

    32/99

    6ormally open7closed conditions differ in a ladder diagram by a diagonal line across asymbol. (hat determines an execution condition for instruction is a bit statusmarked beneath each condition on instruction line. 6ormally open condition is O6 ifits operand bit has O6 status, or its status is O"" if that is the status of its operandbit. 6ormally closed condition is O6 when its operand bit is O"", or it has O"" statuswhen the status of its operand bit is O6.

    (hen programming with a ladder diagram, logical combination of O6 and O""conditions set before the instruction determines the eventual condition under whichthe instruction will be, or will not be executed. )his condition, which can have onlyO6 or O"" values is called instruction execution condition. Operand assigned to anyinstruction in a relay diagram can be any bit from '8, H8, ?8, A8, $8 or )% sector.)his means that conditions in a relay diagram can be determined by a status of '7O

    bits, or of flags, operational bits, timers7counters, etc.

    ". 9rie eample

    !xample below represents a basic program. !xample consists of one input deviceand one output device linked to the #$% controller output. Ley is an input device, anda bell is an output supplied through a relay 22 contact at the #$% controller output.'nput 222.22 represents a condition in executing an instruction over 2:2.22 bit.#ushing the key sets off a 222.22 bit and satisfies a condition for activation of a2:2.22 bit which in turn activates the bell. "or correct program function another lineof program is needed with !6/ instruction, and this ends the program.

  • 8/9/2019 19467645 Omron PLC Study

    33/99

    )he following picture depicts the connection scheme for this example.

  • 8/9/2019 19467645 Omron PLC Study

    34/99

    CHAPTER # %:%4I5 pro&ram or pro&rammin& a PLCcontroller

  • 8/9/2019 19467645 Omron PLC Study

    35/99

    'ntroduction@.: %onnecting a #$% controller with a #% [email protected] HH('6 program installation@.; (riting your first program@.= Having a proect@.> #rogram transfer to #$% controller

    @.@ )esting program function@. 'nterpretation of E)oolsE [email protected] #$% controller working [email protected] 8un mode@.:2 -onitor mode@.:: #rogramHtop mode@.:9 #rogram execution and monitoring@.:; 'mpact on the program during monitoring@.:= Graphic representation of dimension changes in a program

    Introduction

    HH('6 is a software designed for O-8O6 programmable controllers class % and %K.'t is designed for creating and maintaining a program, as well as for testing #$%controller function, in offline and controllerFs operational regime.6ecessary conditions for starting HH('6 are -icrosoft (indows environment on astandard 'B- or ;1@7=1@ compatible or #entium computer, with 1-B 8A- at least,and :2-B free disc space.

    #.1 Connectin& a PLC controller with a PC computer

    #$% controller is linked with a #% computer through an 8H9;9 cable. One end of thecable is connected to a serial #% port 4Cpin or 9>pin connector5, while the otherend is connected to an 8H9;9% connector on 8H9;9 module of a %#-:A controller.'n order to establish a connection with a #%, /'# switch on the connector must be set

    in E?ostE position.

    #.2 %:%4I5 pro&ram installation

    'nstruction package for %#-:A is covered by three HH('6 installation diskettes. 't

    http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#Introductionhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.1http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.2http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.3http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.4http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.5http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.6http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.7http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.8http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.9http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.10http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.11http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.12http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.13http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.14http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#Introductionhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.1http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.2http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.3http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.4http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.5http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.6http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.7http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.8http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.9http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.10http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.11http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.12http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.13http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter6/chapter6.htm#6.14
  • 8/9/2019 19467645 Omron PLC Study

    36/99

    can be installed in (indows ;.:, ;.::, C>, C1 or 6) =.2. 'n order to start theinstallation you need to select 8

  • 8/9/2019 19467645 Omron PLC Study

    37/99

    Helect a #$% controller by clicking on OL, and a program is ready to be used. 't isrecommended when you begin working that you write in a header a title of aprogram, authorFs name and inputs7outputs used. )his may seem as a waste of time,but really isnFt because this habit of writing comments will pay off in the future.

    #rogram written here is ust a basic program made for learning Hyswin. #rogram candetect when a key has been pressed and can activate a relay at the #$% controlleroutput. As long as the key is pressed down, a relay is active. Operation of a relayand a key can be followed via $!/ diodes on #$% controller housing. (riting aprogram begins with a click on the first icon to the left, recognied by two verticallines. 'con beneath this one is similar to the first but for a slash. )hese two iconscorrespond with concepts normally open and normally closed contact which allinstruction lines start with. ou can select an option with an open contact by clickingon the first icon. (hen you click on the black rectangle to the right, a small windowwill appear where you need to write in the address of a bit a contact relates to.

    't is very important to use addresses in a regular way when programming withHH('6. Addresses can have two parts, first refers to the word address, and thesecond to bit address in that word 4both numbers must be separated by a period5."or example, if address 922 is used, HH('6 will interpret this as 9.22, and a erobit whose word address is 9 will be called for. 'f you wish to access word 922 or itsero bit, you must use a call 92222, or better even 922.22. 'n this example address222.22 is assigned for input address 4key5. )his address represents a ero bit forword 222 from memory region '8. Himply said, it is an input screw terminal

  • 8/9/2019 19467645 Omron PLC Study

    38/99

    designated as 22 input. By connecting a key to it, and to one of the %O-- terminalscrews, a needed connection between #$% controller and keys is established.

    Address dialogue box for a bit that contact refers to

    (hen you have written in 222.22, select OL, and first segment of the program willcome up. Bit address will appear above the symbol with two vertical lines whichrefers to this bit, and a black rectangle will move one space to the right.

    "irst element of a program myprog.swp

    "irst instructions up to the bus bar are called conditions because their executionactivates instructions found to the right of the condition instructions. (hen acondition is entered, you also need to enter a corresponding instruction that is set offby an execution of the condition. 'n this example it is a relay controlled by a 22 bit ina word 2:2 of memory region '8. Output instructions are represented by a circle, ora circle and a line if we are dealing with a normally closed contact. By clicking on theicon with a circle, you select an output option with normally open contacts. %lick on ablack rectangle, and a contact window will come up where you need to write in the

  • 8/9/2019 19467645 Omron PLC Study

    39/99

    address for the output bit 2:2.22. Output of the '8 region is found at address '82:2,and first four bits of this word represent a relay within a #$% controller 4if we aretalking about a model %#-:A with relay outputs5. #rogram done so far looks as inpicture below.

    Hecond element of myprog.swp program

    )he basic functional entirety of some program is Network. #rogram consists ofseveral networks found one below the other. Operations with these are found in Blockoption of the menu. Of all options, two basic ones, 'nsert network and /eletenetwork are used the most. Other makers for #$% controllers use different conceptssuch as 8ung instead of the term 6etwork. Himply said, we are talking about a #$%program sequence which has one or more executing instructions, and along with !6/instruction can make up one correct #$% program. As the first network in a programis already in use, the next one has to be added. Adding a 6etwork is done with 'nsertnetwork command from a Block menu.

  • 8/9/2019 19467645 Omron PLC Study

    40/99

    (hen selecting this option, a small window appears where you need to selectwhether a new network will appear above or below the existing one.

    'n our case you should choose the second option and click on OL. "ollowing this, anew network appears as in picture below.

  • 8/9/2019 19467645 Omron PLC Study

    41/99

    $ast network in every program must contain !6/ instruction. Hince this is a simpleexample, second network is also the last. !nd instruction is found among thefunctions. 'n order to come to it, you need to click on "

  • 8/9/2019 19467645 Omron PLC Study

    42/99

    "inished myprog.swp program

    #.! %avin& a pro-ect

    Hince youFve finished writing a program, you need to save a proect. Helect Have#roect option from a "ile menu, and write in the file name in a message window4myprog.swp in this case5. After you click on OL, proect will be saved. ou canaccess HH('6 file contents only from HH('60 file type is identified by extension*

    #roect.swp HH('6 program

    #roect.swl HH('6 library

    #roect.swt HH('6 pattern

    #roect.swb HH('6 backup file

    #roect.prg #-/ program

    #." Pro&ram transer to PLC controller

    "irst you need to check whether #$% is connected with a #% correctly, and youFll dothis by checking physical connection through a serial cable. "ollowing this you needto select a %ommunication option from #roect menu in order to set parameters for

  • 8/9/2019 19467645 Omron PLC Study

    43/99

    serial communication. Of all the parameters, the most important one to be selectedis a serial port of a computer that #$% is connected to. /efault settings for %#-:Aare* %O-:, C@22 Baud,

  • 8/9/2019 19467645 Omron PLC Study

    44/99

    "irst we need to explain tools palette 4/rawing )ools5 and the meaning of each icon.Aside through the usual mouse click, you can access the specific elements of thispalette from a keyboard. ouFll find a corresponding key of the keyboard by eachicon, and you can accomplish the same action with it as you would using a mouse.

    By clicking on the icon, we have selected a desired tool, and with a click on networksection this symbol will be stored in a program. !xplanation for each of the icons isgiven as follows*

    Open contact icon. By clicking on this icon 4or using a key FEF5 we enter an open

    contact into 6etwork. (e need to position the element we have entered at aspecified place 4black space5. "ollowing this, a message window where data can beentered 4open contact addressnumber of words, bit position5 is activatedautomatically.

    %losed contact icon. By clicking on this icon 4or F7F on keyboard5 we enter a closedcontact or inverted condition into network.

    ?oriontal line. By clicking on this icon 4or using FF on a keyboard5, horiontal line islengthened out from left to right. HH('6, however, retains a right to make drawnlines optimal in terms of length, or to point out possible errors. )his option is used

    when you need to add another condition before an instruction contingent upon thiscondition, or when something simply can not fit.

    Kertical line. (ith a click on this icon, or use of FF, we draw vertical lines from top tobottom. )his option is necessary to realie parallel connections between contacts.

    Output instruction. )his represents an instruction that is executed if conditioninstruction preceding it is executed. (ith the help of this instruction we advance a

  • 8/9/2019 19467645 Omron PLC Study

    45/99

    result of logical expression with output variables 4bits5. (e can arrive to thisinstruction with the help of keyboard 4FOF key5.

    'nverted output instruction 4shortcutkey FQF5. Himilarly to the previous case, withthis executing instruction we advance a result of logical expression to an output bit,and the only difference is that this bit is turned on if a condition is not executed andvice versa.

    #$% functions 4shortcutkey F"F5. %lick on this icon accomplishes possibility ofinstallment of complex #$% instructions into a program. (indow that appearsfollowing a click on the icon contains all instructions sorted by sections. Home ofthese instructions are given separately as icons, and some can be accessed onlythrough this option. One such instruction is !6/ instruction which is used in eachprogram. (indow that comes up is displayed in the following picture.

    (hen this window pops up, select an instruction and click on OL.

    %lick on this icon 4or using F)F key5 will give you an option to enter a timer into theprogram.

  • 8/9/2019 19467645 Omron PLC Study

    46/99

    O"" to O6 status.

    (ith this icon we can invert previously entered contact, output or input. 'nversion isdone so that we first click on this icon, and then on a variable whose inversion wewish to perform.

    !rase icon. %lick on this icon and a shaded area of network erases the shaded part ofthe program.

    -ouse plays an important part in the HH('6 program. !ach doubleclick on any #$%instruction results in a corresponding editor where necessary changes can beentered. )his principle is accordingly installed into HH('6, so doubleclick on blockor network heading 4B$O%L ?!A/!8 BA8 or 6!)(O8L ?!A/!8 BA85 gives the sameresults.

    #., PLC controller wor3in& modes

    )here are several ways to find out the present working mode, for example from anOnline -ode menu or its display in a )oolbar. )his option is accessible ifcommunication was successfully established with a #$% controller.

    'f we choose a mode that differs from a present one, change of mode will bemomentary. 'n order to avoid an accidental change of #$% controller mode, there isan option that obliges a computer to ask a question before each mode change,whether that is the option a user really wants 4this option is included as default5. #$%controller has three modes in class %, -O6')O8, 8

  • 8/9/2019 19467645 Omron PLC Study

    47/99

    mode. 't is used for data and program transfer to #$% controller.

    #.12 Pro&ram eecution and monitorin&

    #rogram transferred from a #% to a #$% starts executing at the moment when youmove from a Htop7#rogram mode to a -onitor or 8un mode. (hen -onitoring

    function starts executing, some sections of the monitor will be shaded 4see pictureabove5, and this way you can follow program execution. -onitoring is active duringediting of some program segment, and is stopped at the moment when a changedsection of the program is transferred into a #$% controller.

    #.1 Impact on the pro&ram durin& monitorin&

    /uring monitoring, you can use the right button on the mouse to call up a menu ofsome elements of ladder diagram. -enu that appears when we click on locationwhere address of some bit is positioned, contains the following elements*

    'orce %et used for permanent forced set up of bit status to O6

    'orce Reset used for permanent forced set up of bit status to O""Cancel cancels out the forced status%et

  • 8/9/2019 19467645 Omron PLC Study

    48/99

    and7or words whose values we are monitoring. -apping of a time diagram fordimensions previously specified begins after the last command.

    Quitting is done with a click on a black square icon, and restarting is performed byclicking on an a red circle icon. 8eturn to the editor with a ladder diagram by clickingon !ditors menu and #rogram editor submenu.

    CHAPTER $ E?A+PLE%

    'ntroduction.: Helfmaintenance.9 -aking large time intervals.; /elays of O6 and O"" status.= %ounter over CCCC.> Alternate O6O"" output.@ Automation of parking garage. Operating a charge and discharge process.1 Automation of product packaging.C Automation of storage door

    Introduction

    #rogramming only related examples make up the first group of examples. )hey aregiven as separate small programs that can later be incorporated into larger ones.Hecond group consists of examples which can be applied to some real problems.

    $.1 %el*maintenance

    #rogram allows input to remain at O6 status even when the condition that brought itto that status stops. !xample in picture below illustrates how use of a key connectedto the input '8222.22 changes '82:2.2: output status to O6. By letting the key go,output '82:2.2: is not reset. )his is because '82:2.2: output keeps itself at statusO6 through O8 circuit 4having '8222.225, and it stays in this status until key at input'8222.2: is pressed. 'nput '8222.2: is in ' connection with the output pin '82:2.2:which cancels out a condition, and resets an '82:2.2: bit. !xample of selfmaintenance is quite frequent in specific applications. 'f a user was connected to'82:2.2: output, H)A8) and H)O# functions could be realied from two keys

    4without the use of switches5. Hpecifically, input '8222.22 would be a H)A8) key, and'8222.2: would be a H)O# key.

    http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7.htm#Introductionhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7.htm#7.1http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7.htm#7.2http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7.htm#7.3http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7.htm#7.4http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7.htm#7.5http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7a.htm#7.6http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7a.htm#7.7http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7a.htm#7.8http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7a.htm#7.9http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7.htm#Introductionhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7.htm#7.1http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7.htm#7.2http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7.htm#7.3http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7.htm#7.4http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7.htm#7.5http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7a.htm#7.6http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7a.htm#7.7http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7a.htm#7.8http://www.mikroelektronika.co.yu/english/product/books/PLCbook/chapter7/chapter7a.htm#7.9
  • 8/9/2019 19467645 Omron PLC Study

    49/99

    $.2 +a3in& lar&e time intervals

    'f itFs necessary to make a bigger time interval of CCC.C seconds 4CCCCx2.:s5 twolinked timers, or a timer and a counter can be used as in this example. %ounter is setto count to 9222, and timer is set to > seconds which gives a time interval of :2.222seconds or 9. hours. By executing a condition at '8222.22 input, timer begins tocount. (hen it reaches the limit, it sets a flag )'-22: which interrupts the link andsimultaneously resets a timer. Once > seconds have run out, flag )'-22: changes itsstatus to O6 and executes a condition at the counter input %6)229. (hen a counternumbers 9222 such changes in timer flag status, )'-22: sets its flag %6)229 whichin turn executes a condition for '82:2.22 to change status to O6. )ime that haselapsed from the change of '8222.22 input status to O6 and a change of '82:2.22

    input status to O6 comes to :2.222 seconds.

    $adder /iagram*

  • 8/9/2019 19467645 Omron PLC Study

    50/99

    $. 7elays o 5 and '' status

    !xample shows how to make output 4'82:2.225 delay as opposed to 4in relationto unclear meaning5 input 4'8222.225. By executing a condition at '8222.22 input,timer )'-222 begins counting a set value :2 in steps of 2.: seconds each. After onesecond has elapsed, it set its flag )'-222 which is a condition in changing outputstatus '82:2.22 to O6. )hus we accomplish a delay of one second between O6status of '8222.22 input and O6 status '82:2.22 input. By changing '82:2.22output status to O6, half of the condition for activation of the second timer isexecuted. Hecond half of the timer is executed when '8222.22 input changes status

    to O"" 4normally closed contact5. )imer )'-22: sets its flag )'-22: after onesecond, and interrupts a condition for keeping an output in O6 status.

    $adder /iagram*

  • 8/9/2019 19467645 Omron PLC Study

    51/99

    $.! Counter over ////

    'f you need to count over CCCC 4maximum value for a counter5, you can use twoconnected timers. "irst counter counts up to certain value, and the other one countsflag status changes of the first counter. )hus you get the possibility of counting up to

    a value which is a result of set values of the first and second counter. 'n an exampleat the bottom, first counter counts up to :222, and second up to 92 which allows youto count to 92222. By executing a condition at '8222.22 input 4line whose changesare followed is brought to it5, first counter decreases its value by one. )his isrepeated until counter arrives at ero when it sets its flag %6)22: andsimultaneously resets itself 4is made ready for a new cycle of counting from :222 to25. !ach setting of %6)22: influences the other counter which sets its flag aftertwenty settings of the first counterFs flag. By setting %6)229 flag of the secondcounter, a condition is executed for an '82:2.22 output to be activated and to stay inthat status through selfmaintenance.

    $adder /iagram*

  • 8/9/2019 19467645 Omron PLC Study

    52/99

    Hame effect can be achieved with a modified program below. "irst change is thatthere is a EswitchE for the whole program, and this is '8222.22 input 4program canaccomplish its function only while this switch is active5. Hecond change is that theline whose status is followed is brought to '8222.2: input. )he rest is the same as inthe previous version of the program. %ounter %6)229 counts status changes of the%6)22: counter flag. (hen it numbers them, it changes the status of its flag

    %6)229 which executes the condition for status change of '82:2.22 output. )hischanges '82:2.22 output status after 92222 changes of input '8222.2:.

    $adder /iagram*

  • 8/9/2019 19467645 Omron PLC Study

    53/99

    $." Alternate 5*'' output

    !xample makes a certain number of impulses of desired duration at #$% controller'82:2.22 output. 6umber of impulses is given in instruction of the counter 4here it is

    a constant R22:2 or ten impulses5 impulse duration in two timer instructions. "irsttimer defines duration of O6 status, and second one duration of O"" status of'82:2.22 output bit. 'n the example these two durations are the same, but throughassigning them different parameters they can differ so that duration of O6 status canbe different from duration of O"" status.

  • 8/9/2019 19467645 Omron PLC Study

    54/99

    #rogram starts executing a condition at '8222.22 bit. Hince a normally closed contactwhich refers to counter flag 4that isnFt set 5 is linked with this '8222.22 bit in E'Ecircuit, this status of '8922.22 bit will change to O6. Bit '8922.22 keeps its statusthrough selfmaintenance until counter flag is not set and a condition interrupted.

    (hen an '8922.22 bit is set, timers )'-22: and )'-229 start counting a set interval

    number at 2.: s 4 in the example, this number is :2 for the first timer, or 92 for thesecond timer, and this sets the period of one or two seconds5. (ith both timers, anormally closed contact which refers to )'-229 timer flag is connected with '8922.22bit. (hen this flag is set which happens every two seconds, both timers are reset.)imer )'-229 resets timer )'-22: and itself, and this starts a new cycle.

    At the start of a program, '82:2.22 output bit changes status to O6 and stays in thisstatus until )'-22: flag changes status to O6 4after one second5. By changing)'-22: flag status to O6, condition is broken 4because it is represented as normallyclosed contact5 and '82:2.22 bit changes status to O"".

    '82:2.22 output status changes to O6 again when time has run out on )'-229timer. )his resets )'-22: timer and its flag which in turn executes a condition for

    status change of the '82:2.22 output. %ycle is thus repeated until a counternumbers :2 changes of )'-22: flag status. (ith the change of status of %6)222counter flag, a condition for an assisting bit '8922.22 is broken, and program stopsworking.

    $adder /iagram*

  • 8/9/2019 19467645 Omron PLC Study

    55/99

    APPE57I? A Epandin& the num(er o input@outputlines

    '6)8O/

  • 8/9/2019 19467645 Omron PLC Study

    56/99

    Introduction

    )his appendix is an answer to the question +(hat if more input or output lines areneeded . -odel detailed in the book carries the mark %#-:A:2%/8A and is takenas an optimal for it&s price and features. Alternative models with greater number oflines include %#-:A92%/8A, %#-:A;2%/8A or %#-:A=2%/8A. )he last two can

    be expanded with three additional modules with 92 extra '7O lines each, totaling :22'7O lines as a maximum 4if this is still insufficient, maybe it is time for you to startusing some of more powerful #$% controllers5.

    'f not even the most powerful model of %#-:A family satisfies your needs, thenextra modules with 92 '7O lines are added. )his form of connection reaches :22input7outputs, which is a significant number in industrial proportions.

    A.1. 7ierences and similarities

    )aking the other model of #$% controller from %#-:A class basically doesn&t change athingD !verything said for one model also applies to the other. Only thing thatchanges is the number of screw terminal and the number of bits in '8 areaconnected to that screw terminal. 'f model with :2 '7O lines 4model described in thebook5 has @ inputs on addresses '82222 '8222>, then the 92 '7O lines model willhave :9 inputs on addresses '82222 '822::. !xpanding itself should not be aproblem. After taking off the cover on the right side, there is a connector which isthen connected to the expansion module via flat cable. Htill, it requires skill whenassigning inputs and outputs because expansion increases the cost of the proect. Allthe models and expansions of %#-:A class carry additional marks defining themmore precisely.

    7escription Input pointsutputpoints

    Power%upply +odel 5um(er

    :2 '7Opoints

    @ points = point8elayOutput

    :22 to9=2KA%, >27@2?

    %#-:A:2%/8A

    9= K/% %#-:A:2%/8/

    )ransistor6#6

    9= K/% %#-:Al2%/)/

    )ransistor

    #6#

    9= K/% %#-:A

    :2%/):/

  • 8/9/2019 19467645 Omron PLC Study

    57/99

    92 '7O points

    :9 points 1 points :22 to 9=2KA%, >27@2 ?

    %#-lA92%/8A

    9= K/% %#-:A92%/8/

    )ransistor

    6#6

    9= K/% %#-:A

    92%/)/)ransistor#6#

    9= K/% %#-lA92%/):/

    ;2 '7O points :1points

    :9 points :22 to 9=2KA%, >27@2 ?

    %#-:A;2%/8A

    9= K/% %#-:A;2%/8/

    )ransistor6#6

    9= K/% %#-:A;2%/)/

    )ransistor

    #6#

    9= K/% %#-:A

    ;2%/):/=2 '7O points

    9=points

    :@ points :22 to 9=2KA%, >27@2 ?

    %#-:A=2%/8A

    9= K/% %#-:A=2%/8/

    )ransistor6#6

    9= K/% %#-:A=2%/)/

    )ransistor#6#

    9= K/% %#-:A=2%/):/

    6otice that #$% controllers with :2 and 92 '7O lines do not have an expansion port.Generally speaking, if there is the slightest possibility for expansion in the proect,#$% controller with ;2 or =2 '7O lines should be used.

    A.2. +ar3in& the PLC controller

    -arking the controller and the expansion module undergoes three criteria. )he firstis voltage, the second is the type of input7output and the third is number of '7Olines. )he picture below is selfexplanatory.

  • 8/9/2019 19467645 Omron PLC Study

    58/99

    A.. %peciic case

    'f two 92 '7O lines expansion modules and one analog module are added to ;2 '7Olines model, assigned inputs7outputs will have the addresses from the followingtable.

    )nit Assi&ned input (its Assi&ned output (its

    :%entral processing unit4%#-9A;2%/SS5

    '8 22222'8 222:: and'8 22:22'8 22:2>

    '8 2:222'8 2:22 and '82::22'8 2::2;

    9 and'8 22=22'8 22=:>

    '8 2:;22'8 2:;:>

    =22'8 22>:: '8 2:=22'8 2:=:>

    APPE57I? 9 7etailed memory map o PLC controller

    '6)8O/

  • 8/9/2019 19467645 Omron PLC Study

    59/99

    B.= A8 memory area

    B.> #% memory area

    Introduction

    #urpose of this appendix is to explain certain memory areas in detail. As thefollowing tables cover whole memory, there are options left unused in this book.)hey should be skipped during the first reading, and used later according to needs.

    9.1 >eneral eplanation o memory areas

    -emory of #$% controller consists of several areas, some of these having predefinedfunctions.

    7ata area 4ord

    4:@2 bits5

    output area'8 2:2 '8 2:C 4:2

    words5'8 2:222 '8 2:C:>

    4:@2 bits5

    )hese bits may beassigned to an external'7O connection. Home ofthese have direct outputon screw terminal 4forexample, '8222.22 '8222.2> and '82:2.22 '82:2.2; with %#-:Amodel5

    workingarea

    '8 922 '8 9;: 4;9words5

    '8 92222 '8 9;::>4>:9 bits5

    (orking bits that can beused freely in theprogram. )hey arecommonly used as swapbits

    H8 area H8 9;9 H8 9>> 49=words5

    H89;922 H89>>:>4;1= bits5

    Hpecial functions, such asflags and control bits

    )8 area )8 2 )8 41 bits5)emporary storage ofO67O"" states when

    ump takes place

    ?8 area?8 22 ?8 :C 492

    words5?82222 ?8:C:> 4;92

    bits5

    /ata storage0 these keeptheir states when poweris off

    A8 areaA8 22 A8 :> 4:@

    words5A82222 A8:>:> 49>@

    bits5Hpecial functions, such asflags and control bits

    $8 area $8 22 $8 :> 4:@ words5$82222 $8:>:> 49>@

    bits5:*: connection withanother #%

    )imer7counter area )% 222 )% :9 4timer7counter numbers5Hame numbers are usedfor both timers andcounters

    http://www.mikroelektronika.co.yu/english/product/books/PLCbook/app_b/app_b.htm#B.4.%20AR%20MEMORY%20AREAhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/app_b/app_b.htm#B.5.%20PC%20MEMORY%20AREAhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/app_b/app_b.htm#B.4.%20AR%20MEMORY%20AREAhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/app_b/app_b.htm#B.4.%20AR%20MEMORY%20AREAhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/app_b/app_b.htm#B.5.%20PC%20MEMORY%20AREAhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/app_b/app_b.htm#B.5.%20PC%20MEMORY%20AREA
  • 8/9/2019 19467645 Omron PLC Study

    60/99

    /- area

    8ead7write/- 2222 /- 2CCC and

    /- :299 /- :29;4:229 words5

    /ata of /- area may beaccessed only in wordform. (ords keep theircontents after the poweris off

    !rrorwriting

    /- :222 /- :29: 499words5

    8ead only/- @:== /- @>CC

    4=>@ words5

    #art of the memory forstoring the time and codeof error that occurred.(hen not used for thispurpose, they can beused as regular /- wordsfor reading and writing.)hey cannot be changedfrom within the program

    #% setup/- @@22 /- @@>> 4>@

    words5

    Htoring variousparameters for controllingthe #%

    6ote*:. '8 and $8 bits, when not used to their purpose, may be used as working bits.9. %ontents of ?8 area, $8 area, counter and /- area for reading7writing is storedwithin backup condenser. On 9>%, condenser keeps the memory contents for up to92 days.;. (hen accessing the current value of #K, )% numbers used for data have the formof word. (hen accessing the %ompleting flags, they are used as data bits. =. /atafrom /-@:== to /-@@>> must not be changed from within the program, but can bechanged by peripheral device.

    9.2. %R memory area

    '8 area doesn&t have predefined memory locations, but is meant for general use inthe program. Of all the locations this memory area consists of, only those directlyconnected to #$% controller input7output lines are of interest for this appendix.

    '8 area can be divided into ; parts*

    :. 'nput area is located from word '8222 to '822C, totaling :@2 bits. -ost importantof these are in the word '8222 because they are directly connected to screw terminalof #$% controller. 'nput '8222.2: is directly connected to screw terminal marked with2: on the casing of the #$% controller.

    9. Output area is located from word '82:2 to '82:C, totaling :@2 bits. -ostimportant of these are in the word '82:2 because they are directly connected toscrew terminal of #$% controller. Output '8222.22 is directly connected to screwterminal marked with 22 on the casing of the #$% controller.

    ;. (orking area is located from word '8922 to '89;: totaling >:9 bits for generaluse.

    As '8 memory area does not have predefined memory locations, more detailedexplanations are not necessary.

    9.. IR memory area

  • 8/9/2019 19467645 Omron PLC Study

    61/99

    22 :>'nput area for macro functions. %ontains input operands for-%8O4CC5 4may be used for working bits, when -%8O4CC5 isnot used5

    H8 9;@ H8 9;C 22 :>Output area for macro functions. %ontains output operandsfor -%8O4CC5 4may be used for working bits, when -%8O4CC5is not used5

    H8 9=2 22 :>

    %ontains set value HK, when input interrupt 2 is used incounter mode 4= hexadecimal digits5 4may be used forworking bits, when input interrupt 2 is not used in countermode5

    H8 9=: 22 :>

    %ontains set value HK, when input interrupt : is used incounter mode 4= hexadecimal digits5 4may be used forworking bits, when input interrupt : is not used in countermode5

    H8 9=9 22 :>%ontains set value HK, when input interrupt 9 is used incounter mode 4= hexadecimal digits5 4may be used forworking bits, when input interrupt 9 is not used in countermode5

    H8 9=; 22 :>

    %ontains set value HK, when input interrupt ; is used incounter mode 4= hexadecimal digits5 4may be used forworking bits, when input interrupt ; is not used in countermode5

    H8 9== 22 :>%ontains current value 4#K:5, when input interrupt 2 is usedin counter mode 4= hexadecimal digits5

    H8 9=> 22 :>%ontains current value 4#K:5, when input interrupt : is usedin counter mode 4= hexadecimal digits5

    H8 9=@ 22 :>%ontains current value 4#K:5, when input interrupt 9 is usedin counter mode 4= hexadecimal digits5

    H8 9= 22 :>

    %ontains current value 4#K:5, when input interrupt ; is used

    in counter mode 4= hexadecimal digits5

    H8 9=1, H8 9=C 22 :>%ontains current value #K of the highspeed counter 4may beused for working bits, when highspeed counter is not used5

    H8 9>2 22 :>Analog setting of value 2. Leeps = digit B%/ value 42222 29225 set via analog potentiometer on the #$% controllercasing.

    H8 9>: 22 :>Analog setting of value :. Leeps = digit B%/ value 42222 29225 set via analog potentiometer on the #$% controllercasing.

    H8 9>9 22 8eset of the highspeed counter

    2: 2 6ot used

    21

    #eripheral port. Hwitches on for the reset of the peripheralport 4this doesnFt apply to a case when peripheral device is

    connected5. Bit automatically changes state to O"" after thereset

    2C 6ot used

    :2#$% Hetup 8eset Bit. (hen on, it initialies #% setup4/-@@22/-@@>>5. 't automatically goes to O"" after thereset. )his applies only if the #% is in #8OG8A- mode

    :: "orced Htatus ?old Bit. O""* bits used in the operation offorced set7reset are cleared when changing from #8OG8A- to-O6')O8 mode. O6* bits used in the operation of forcedset7reset keep their states when changing from #8OG8A- to

  • 8/9/2019 19467645 Omron PLC Study

    62/99

    -O6')O8 mode.

    :9'7O ?old bit. O""* '8 and $8 bits are reset when starting orending an operation. O6* '8 and $8 bits keep their stateswhen starting or ending an operation.

    :; 6ot used

    :=!rror $og 8eset Bit. Bit state O"" clears the record of error

    taking place. Bit automatically goes off after the operation

    :> 6ot used

    H8 9>; 22 2

    "A$ error code. $ocation contains error code 49 digit number5."A$ number is stored at this location upon executing "A$42@5or "A$425 instructions. $ocation contents are reset uponexecuting "A$ 22 instruction or by clearing an error fromperipheral device

    21 6ot used

    2C%ycle )ime Overrun "lag. Bit goes to O6 when program lengthdoesnFt allow cycle of input7output scanning to be executed ina specified time period

    :2 :9 6ot used

    :; "lag always on

    := "lag always off

    :>"irst %ycle "lag. Goes O6 during the first cycle at thebeginning of the operation

    H8 9>= 22 : min clock impulse 4;2s on, ;2s off5

    2: 2.29s clock impulse 42.2:s on, 2.2:s off 5

    29 6egative 465 flag

    2; 2> 6ot used

    2@ /ifferential -onitor "lag

    2 H)!#415 execution flag

    21 :> 6ot used

    H8 9>> 22 2.:s clock impulse 42.2>s on, 2.2>s off5

    2: 2.9s clock impulse 42.:s on, 2.:s off5

    29 :.2s clock impulse 42.>s on, 2.>s off5

    2;'nstruction !xecution !rror 4!85 "lag. %hanges state to O6 iferror occurs during instruction execution

    2= %arry 4%5 flag

    2> EGreater thanE 4G85 flag

    2@ E!qualsE 4!Q5 flag

    2 E$ess thanE 4$!5 flag

    21 :> 6ot used

    9.!. AR memory area

  • 8/9/2019 19467645 Omron PLC Study

    63/99

    #urpose of this memory area is to provide information on #$% controller state,malfunctions and some system data. -emory locations of this area keep their statesafter the power has been shut down.

    4ord 6umber of connected '7O units

    A82; A82 22 :> 6ot used

    A821 22 2 6ot used

    21 :: #eripheral device error code

    :9 "lag of peripheral device error

    :; #eripheral /evice )ransmission !nabled "lag

    := :> 6ot used

    A82C 22 :> 6ot used

    A8:2 22 :> #oweroff counter. %ontains =digit B%/ value

    A8:: 22 2 ?ighspeed %ounter 8ange %omparison "lags

    21 := 6ot used

    :> #ulse Output Htatus. O6* stopped0 O""* 'mpulse at output

    A8:9 22 :> 6ot used

    A8:; 22#owerup #% Hetup !rror "lag. Goes O6 when error occurs in

    area /- @@22 /- @@:=

    2:Htartup #% Hetup !rror "lag. Goes O6 when error occurs inarea /- @@:> /- @@==

    298CC range

    ::#% Hetup !rror "lag. Goes O6 when checksum error occurs in#% Hetup area

    :9#rogram !rror "lag. Goes O6 when checksum error occurs inprogram memory 4

  • 8/9/2019 19467645 Omron PLC Study

    64/99

    := :> 6ot used

    A8:= 22 :>-aximum %ycle )ime. = B%/ digits. %leared at the beginningof the operation

    A8:> 22 :>%urrent %ycle )ime. = B%/ digits. 6ot cleared when theoperation ends

    6ote*:. '8 and $8 bits when not used for their function may be used as working bits.9. %ontents of ?8 area, $8 area, counter, and /- area for reading7writing are keptby battery of central processing unit. 'n case that the battery is removed ormalfunction occurs, this data will be lost.;. (hen accessing the current value of #K, )% numbers used for data have form ofword. (hen accessing %ompleting flags, they are used as data bits.=. /ata stored from /-@:== to /-@@>> cannot be changed from within theprogram, but can be changed by peripheral device.>. #rogram and data from /- @:== to /- @@>> are stored in the flash memory.

    9.". PC memory area

    #$% setup area can be roughly divided into = categories*

    :. Hettings related to basic operations of #$% controller and '7O processes9. Hettings related to cycle duration;. Hettings related to interrupts=. Hettings related to communication.

    4ord

  • 8/9/2019 19467645 Omron PLC Study

    65/99

    /- @@:> /- @@:@ 22 :> 6ot used

    /- @@: 22 2Hervicing time for peripheral port. Active when bits 21 :>are set to 2:. 't is expressed in percentage of cycle timeduration 422 to CC 4B%/55

    21 :>#eripheral port servicing setting enable. 22* >3 of cycleduration0 2:* time defined in first half of the word

    /- @@:1 22 2%ycle monitor time. Hettings are identical to those of thesecond half of the previous word

    21 :>%ycle monitor enable 4Hetting in 22 to 2 x unit0 CC > max5.22*:92ms 4settings in bits 222 are disabled5 0 2:* settingunit :2ms0 29* setting unit :22ms0 2;* setting unit :s

    /- @@:C 22 :>%ycle time. 2222* variable 4no minimum50 222:* up to CCCC4B%/5. -inimal time is expressed in ms

    ,nterrupt Processing "#$ %%2- ' #$ %%3() take eect ater the transer to PC area* ne+t ti!e youstart working

    /- @@92 22 2;'nput constant for '8 22222 '8 22229. 2* 2.1ms0 :* :ms09* 9ms0 ;* =ms0 =* 1ms0 >* :@ms0 @* ;9ms0 * @=ms0 1*:91ms

    2= 2'nput constant for '8 2222; and '8 2222=. Hettings are sameas with bits 222;

    21 ::

    'nput constant for '8 2222> and '8 2222@. Hettings are same

    as with bits 222;

    :9 :>'nput constant for '8 2222 and '8 222::. Hettings are sameas with bits 222;

    /- @@9: 22 2'nput constant for '8 22:. 2* 2.1ms0 :* :ms0 9* 9ms0 ;*=ms0 =* 1ms0 >* :@ms0 @* ;9ms0 * @=ms0 1* :91ms

    21 :> 'nput constant for '8 229. Hettings are same as with '8 22:

    /- @@99 22 2 'nput constant for '8 22;. Hettings are same as with '8 22:

    21 :> 'nput constant for '8 22=. Hettings are same as with '8 22:

    /- @@9; 22 2 'nput constant for '8 22>. Hettings are same as with '8 22:

    21 :> 'nput constant for '8 22@. Hettings are same as with '8 22:

    /- @@9= 22 2 'nput constant for '8 22. Hettings are same as with '8 22:

    /- @@9> 22 2 'nput constant for '8 221. Hettings are same as with '8 22:

    21 :> 'nput constant for '8 22C. Hettings are same as with '8 22:

    /- @@9@ /- @@9 22 :> 6ot used

    /- @@91 22 2;'nterrupt enabled on '8 22222. 42* regular input0 :* interruptinput0 9* fastreaction input5

    2= 2'nterrupt enabled on '8 2222:. 42* regular input0 :* interruptinput0 9* fastreaction input5

    21 ::'nterrupt enabled on '8 22229. 42* regular input0 :* interruptinput0 9* fastreaction input5

    :9 :>'nterrupt enabled on '8 2222;. 42* regular input0 :* interruptinput0 9* fastreaction input5

    igh'speed counter settings "#$ %%/-'#$ %%//) take eect ater the transer to PC area* ne+t ti!eyou start working

    /- @@=2 /- @@=: 22 :> 6ot used

    /- @@=9 22 2;?ighspeed counter mode. 2* counting up7down0 =*incremental mode

    2= 2?ighspeed counter reset mode. 2* T phase and softwarereset0 :* software reset only

    21 :>?ighspeed counter enable. 2* highspeed counter not used0:* highspeed counter used with settings 222

    /- @@=; /- @@== 22 :> 6ot used

    Peripheral port settings take eect ater the transer to PC area

  • 8/9/2019 19467645 Omron PLC Study

    66/99

    /- @@=> /- @@=C 22 :> 6ot used

    /- @@>2 22 2#ort settings. 22* standard 4: start bit, even parity, 9 stopbits, C@22bps50 2:* Hettings in /- @@>: 4settings other thanthis cause error and turn on A8 :;295

    21 ::Area for :*: connection with a #% via peripheral port. 2*$822$8:>

    :9 :>-odes of communication. 2* ?ost link0 9* onetoone #% link4slave50 ;* onetoone #% link 4master50 =* 6) link 4settingsother than this cause error and turn on A8 :;295

    /- @@>: 22 2Baud rate. 22* :922 bps0 2:* 9=22 bps0 29* =122 bps0 2;*C@22 bps0 2=* :C922 bps

    21 :>

    "rame format 4Htart bits7/ata bits7Htop bits7#arity5.22*:77:7even0 2:*:77:7odd0 29*:77:7none02;*:7797even0 2=*:7797odd0 2>*:7797none02@*:77:7even0 2*:77:7odd0 21*:77:7none02C*:7797even0 :2*:7797odd0 ::*:7797none 4settingsother than this cause error and turn on A8 :;295

    /- @@>9 22 :>?ost $ink )ransmission /elay 42222 CCCCms54settings other than this cause error and turn on A8 :;295

    /- @@>; 22 2?ost $ink 422 ;:B%/5 4settings otherthan this cause error and turn on A8 :;295

    21 :> 6ot used

    /- @@>= 22 :> 6ot used

    0rror log settings "#$ %%&&) take eect ater the transer to PLC controller

    /- @@>> 22 2;Htyle. 2* move after records0 :* keep only first 4nomoving50 9"* no records

    2= 2 6ot used

    21 ::%ycle )ime monitor !nable. 2* detect long cycles as nonfatalerrors0 :* do not detect long cycles

    :9 :> 6ot used

    APPE57I? C PLC dia&nostics

    '6)8O/

  • 8/9/2019 19467645 Omron PLC Study

    67/99

    %. -!HHAG! -HG4=@5

    %.1 Hyntax errors

    %.C Algorithm for finding errors in the program

    Introduction

    )he whole work of #$% controller can be represented with a diagram shown on thefollowing page. After turning on the power, #$% is first initialied 4clearing '8, H8 i A8areas, presetting system timers and checking '7O lines5, and if no errors weredetected, monitoring process, program execution, calling the '7O lines and servingthe peripheral devices starts to occur in cycles.

    http://www.mikroelektronika.co.yu/english/product/books/PLCbook/app_c/app_c.htm#C.7%20MESSAGE%20-%20MSG%20(46)http://www.mikroelektronika.co.yu/english/product/books/PLCbook/app_c/app_c.htm#C.8%20SYNTAX%20ERRORShttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/app_c/app_c.htm#C.9%20ALGORITHM%20FOR%20FINDING%20ERRORS%20IN%20THE%20PROGRAMhttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/app_c/app_c.htm#C.7%20MESSAGE%20-%20MSG%20(46)http://www.mikroelektronika.co.yu/english/product/books/PLCbook/app_c/app_c.htm#C.8%20SYNTAX%20ERRORShttp://www.mikroelektronika.co.yu/english/product/books/PLCbook/app_c/app_c.htm#C.9%20ALGORITHM%20FOR%20FINDING%20ERRORS%20IN%20THE%20PROGRAM
  • 8/9/2019 19467645 Omron PLC Study

    68/99

    C.1 7ia&nostic unctions o PLC

    #$% controller features additional functions that make locating errors easier. !rrorscan be divided into two categories according to severity *

    :. "atal errors are severe and they prevent #$% controller from operating until theircause is located and solved.9. 6onfatal errors are those that do not prevent #$% controller from operating. Afterdetecting one or more nonfatal errors, program execution will continue.6evertheless, it is necessary to correct these errors as soon as possible.

  • 8/9/2019 19467645 Omron PLC Study

    69/99

    C.2 5on*atal errors

    (hen one of these errors takes place, indicators #O(!8 and 8;222 toH89>;2.

    Hame number must not be assigned to both "A$ and "A$H instructions. )o delete thecode of an error, error should be corrected and "A$ 22 instruction executed.

    C.# %evere ailure alarm * 'AL%

  • 8/9/2019 19467645 Omron PLC Study

    70/99

    6umbers of "A$H instruction can be assigned to certain states. Hame number mustnot be assigned to both "A$ and "A$H instructions. )o delete "A$H error, #$%controller must be in #8OG8A- mode, cause of error solved and then error codedeleted.

    C.$ +essa&e * +%>

    -HG4=@5 is used for printing messages on program console display. -essage cannotexceed :@ characters, and it appears when specified condition is fulfilled.

    C., %ynta errors

    /uring the program check with operation #rogram %heck, syntax errors are detected.)here are three levels of program check at user&s disposal. By selecting the level,types of errors to be checked for are selected. )he following table shows types oferrors, corresponding messages that appear on display and explains all of syntaxerrors. Tero level check searches for errors of A, B and % type. "irst level checksearches for errors of A and B type, while the second searches only for errors of type

    A.

    Type +essa&e +eanin& and the appropriate action

    A

    #rogram is damaged by creating nonexisting function in thecode. 8eenter your program.

    %'8%5.%orrect the number of ump and add the correct J-!42=5instruction.

    /

  • 8/9/2019 19467645 Omron PLC Study

    71/99

    %

    %O'$ /

  • 8/9/2019 19467645 Omron PLC Study

    72/99

    APPE57I? E Ladder dia&ram instructions

    #lacing the character +U ahead of operand from /- memory area allows us to use the indirect addressing.

    Himply put, value in the word U/- will be the address of the word that is the true operand. )he picture belowshows the -OK instruction with one operand given indirectly. )he contents of location /-222; equal +:=;;which is actually a pointer marking the address /-:=;; with contents +222>. )he result of this instruction wbe moving the value +222> from word /-:=;; to word $822.

    'n order to use the indirect addressing, contents of the word that is the indirect operand have to be in B%/format. Besides that, value of the contents of indirect operand must not be greater than the number ofaddresses in /- area.

  • 8/9/2019 19467645 Omron PLC Study

    73/99

    I5%TR)CTI5 'R+AT

    Operand is the address of a word or a bit in #$% controller memory 4most of the instructions has one or moreoperands5. )he common term for a word is ust +operand and in the case of bit we call it +operand bit. Also,operand can be a direct numerical value marked by character +R placed ahead of the value 4i.e.. R:9, R;=>

    etc5.

    )he state of operand bit can be O6 or O"". O6 means that its logic state equals +:, while O"" stands for +2.Besides these, terms +set and +reset are also used.

    Hymbols HK and #K commonly appear in instruction syntax. )hese abbreviations stand for +%et Kalue and+Present Kalue and are most frequently encountered with instructions concerning counters and timers.

    7I''ERE5TIAL I5%TR)CTI5 'R+

    /ifferential form is supported by almost all of the instructions. (hat differs this form from the classical one isthe character +V placed ahead of the name of the instruction. )his form ensures that the instruction with

    condition fulfilled will not be executed in every cycle, but only when its condition changes state from O"" to O/ifferential from is commonly used because it has a lot of applications in reallife problems.

    7I''ERE5CE 9ET4EE5 9I5AR: A57 9C7 REPRE%E5TATI5% ' 4R7 C5TE5T%

    Generally, there are two dominant ways for comprehending values of memory locations. )he first is binary anrelated to the contents of the word which is treated as a union of :@ bits. Kalue is calculated as a sum of eachbit 42 or :5 multiplied by 9 on power n, where nrepresents the position of bit in the word. Bit of the least valuhas position ero, while bit of greatest value has position :>.

    B%/ is an abbreviation for +Binary %oded /ecimal number. 't is nothing more than representing each decimafigure with = bits, similar to binary coding hence the name comes from. )he picture below shows the differencbetween binary and B%/ representations of the number. Hame contents can be interpreted as either @:9 or 9"or that reason, proper attention should be given to the format of the value within the word that will be sent tthe instruction as an operand.

  • 8/9/2019 19467645 Omron PLC Study

    74/99

    LA77ER 7IA>RA+ I5%TR)CTI5%

    'nstructions may be divided into several basic groups according to their purpose *

    'nput instructions Output instructions %ontrol instructions )imer7counter instructions

    /ata comparison instructions /ata movement instructions 'ncrement7decrement instructions B%/7binary calculation instructions /ata conversion instructions $ogic instructions Hpecial calculation instructions Hubroutine instructions 'nterrupt control instructions '7O units instructions /isplay instructions ?ighspeed counter control instructions /amage diagnosis instructions

    Hpecial system instructions

    !ach of these instruction groups is introduced with a brief description in the following tables and with moredetailed examples and descriptions afterwards.

  • 8/9/2019 19467645 Omron PLC Study

    75/99

    %euence Input Instructions

    Instruction +nemonic Code 'unction

    $OA/ $/ 2 %onnects an 6O condition to the left bus bar.

    $OA/ 6O) $/ 6O) 2 %onnects an 6% condition to the left bus bar.

    A6/ A6/ 2%onnects an 6O condition in series with thprevious condition

    A6/ 6O) A6/ 6O) 2%onnects an 6% condition in series with thprevious condition

    O8 O8 2%onnects an 6O condition in parallel with thprevious condition.

    O8 6O) O8 6O) 2 %onnects an 6% condition in parallel with thprevious condition.

    A6/ $OA/ A6/ $/ 2 %onnects two instruction blocks in series.

    O8 $OA/ O8 $/ 2 %onnects two instruction blocks in parallel.

    Sequence Output Instructions

    Instruction +nemonic Code 'unction

    O

  • 8/9/2019 19467645 Omron PLC Study

    76/99

    Instruction +nemonic Code 'unction

    6O

    O#!8A)'O66O# 22

    !6/ !6/ 2: 8equired at the end of the program.

    '6)!8$O%L '$ 29't the execution condition for '$4295 is O"", aoutputs are turned O"" and all timer #Ks rese

    between '$4295 and the next '$%42;5.

    '6)!8$O%L

    %$!A8'$% 2;

    '$%42;5 indicates the end of an interloc

    4beginning at '$42955.

    J

  • 8/9/2019 19467645 Omron PLC Study

    77/99

    Instruction +nemonic Code 'unction

    -OK! 4V5-OK 9:%opies a constant or the content of a word to aword.

    -OK! 6O) 4V5-K6 99

    %opies the complement of a constant or the

    content of a word to a word.B$O%L)8A6H"!8

    4V5S"!8 2%opies the content of a block of up to :,222consecutive words to a block of consecutive words.

    B$O%L H!) 4V5BH!) :%opies the content of a word to a block ofconsecutive words.

    /A)A!S%?AG!

    4V5S%?G ; !xchanges the content of two words.

    H'6G$!(O8//'H)8'B

  • 8/9/2019 19467645 Omron PLC Study

    78/99

    Instruction +nemonic Code 'unction

    H?'")8!G'H)!8

    H") 27:2%opies the specified bit 42 or :5 into therightmost bit of a shift register and shifts theother bits one bit to the left.

    (O8/ H?'") 4V5(H") :@%reates a multipleword shift register that shiftsdata to the left in oneword units.

    AH6%?8O6O of thespecified word, shifts the other bits one bit to theleft, and moves bit 22 to %.

    O6! /'G')H?'") $!")

    4V5H$/ =Hhifts a 2 into the rightmost digit 4=bit unit5 ofthe shift register and shifts the other digits onedigit to the left.

    O6! /'G')H?'") 8'G?)

    4V5H8/ >Hhifts a 2 into the rightmost digit 4=bit unit5 ofthe shift register and shifts the other digits onedigit to the right.

    8!K!8H'B$!H?'") 8!G'H)!8

    4V5H")8 1=%reates a single or multipleword shift registerthat can shift data to the left or right.

    Increment@7ecrement Instructions

    Instruction +nemonic Code 'unction

    '6%8!-!6) 4V5'6% ;1 'ncrements the B%/ content of the specified wordby :.

    /!%8!-!6) 4V5/!% ;C/ecrements the B%/ content of the specified wordby :.

  • 8/9/2019 19467645 Omron PLC Study

    79/99

    9C7@9inary Calculation Instructions

    Instruction +nemonic Code 'unction

    B%/ A// 4V5A// ;2 Adds the content of a word 4or a constant5.

    B%/H9-ultiplies the contents of two words 4orconstants5.

    B'6A8/'K'/!

    4V5/KB >;/ivides the content of a word 4or constant5 by thecontent of a word and obtains the result andremainder.

    /O=Add the 1digit B%/ contents of two pairs ofwords 4or constants5 and %.

    /O/ivides the 1digit B%/ contents of a pair ofwords 4or constants5 by the 1Xdigits B%/contents of a pair of words 4or constants5

    7ata Conversion Instructions

  • 8/9/2019 19467645 Omron PLC Study

    80/99

    Instruction +nemonic Code 'unction

    B%/ )OB'6A8

    4V5B'6 9; %onverts =digit B%/ data to =digit binary data.

    B'6A8 )O

    B%/ 4V5B%/ 9= %onverts =digit binary data to = digit B%/ data.

    = to :@/!%O/!8

    4V5-$#S @)akes the hexadecimal value of the specifieddigit4s5 in a word and turn O6 the correspondingbit in a word4s5.

    :@ to =/!%O/!8

    4V5/#-S

    'dentifies the highest O6 bit in the specifiedword4s5 and moves the hexadecimal value4s5corresponding to its location to the specifieddigit4s5 in a word.

    AH%'' %O/!%O6K!8)

    4V5AH% 1@%onverts the designated digit4s5 of a word into theequivalent 1bit AH%'' code.

    Lo&ic Instructions

    Instruction +nemonic Code 'unction

    %O-#$!-!6) 4V5%O- 9C)urns O"" all O6 bits and turns O6 all O"" bits inthe specified word

    $OG'%A$ A6/ 4V5A6/( ;=$ogically A6/s the corresponding bits of twoword 4or constants5

    $OG'%A$ O8 4V5O8( ;>$ogically O8s the corresponding bits of two word4or constants5

    !S%$

  • 8/9/2019 19467645 Omron PLC Study

    81/99

    Instruction +nemonic Code 'unction

    H

  • 8/9/2019 19467645 Omron PLC Study

    82/99

    Instruction +nemonic Code 'unction

    B%/ )OB'6A8

    4V5B'6 9; %onverts =digit B%/ data to =digit binary data.

    B'6A8 )O

    B%/ 4V5B%/ 9= %onverts =digit binary data to =digit B%/ data.

    = to :@/!%O/!8

    4V5-$#S @)akes the hexadecimal value of the specifieddigit4s5 in a word and tur