You are on page 1of 87

Electrical, Electronics and Computer Engineering Department

PLC1 (Omron)
Module NE177
Version Date Contact 1 01/2006 DK 2 05/2008 DK 3 4 5

Chisholm Institute of TAFE Frankston Campus Fletchers Road, Frankston 3199 Tel: +61 3 9238 8226 Fax: +61 3 9238 8116

NE177 PLC1 OMRON

Contents
Installation Procedures & Precautions ...............................................................................4 Common Installation Considerations ................................................................................6 Program Storage Methods ...............................................................................................8 PLC Hardware..............................................................................................................16 Diagnostics ..................................................................................................................23 Timers .........................................................................................................................30 Counters ......................................................................................................................38 Comparison instructions ................................................................................................43 Exercises/assessment items ............................................................................................46 Peripheral devices .........................................................................................................54 Digital inputs ...............................................................................................................55 Digital Outputs .............................................................................................................60 Program Control ...........................................................................................................66 Bit Shift .......................................................................................................................70 The Omron bit shift register (SFT) .................................................................................72 Drum controllers (sequencers) .......................................................................................79 Exercises/Assessment items ...........................................................................................81

Copyright Chisholm Institute

Installation Procedures & Precautions


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' Responsibility
Employers shall ensure as far as is reasonably practicable that machinery, plant and equipment is safe and without risks when used property. This requires having the application of hazard 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.

NE177 PLC1 OMRON

Design and Procurement


Where 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. The employer shall also ensure that the specifications are in compliance with the relevant requirements of this standard, any other appropriate standard, the requirements of statutory 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.

Installation
The installation, spacing, clearance, services and foothold around machinery, plant and 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 Acceptance


Before 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 Supervision


Job 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 important to emphasise that methods of operation, training, instruction, testing, auditing and monitoring must be kept up-to-date.

Isolating controls
All 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. There shall be provision for the manual locking of the isolator in the isolated position, except where the machinery or equipment is supplied through a removable plug or coupling.

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.

Copyright Chisholm Institute

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. Some installation documentation can come as part of the online help within the programming 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.

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.

NE177 PLC1 OMRON

Simulate signals for each analogue loop Force each output on or off in turn to ensure correct operation of the field devices When all devices & wiring have been checked against the documentation and software, the system control simulation can commence.

Copyright Chisholm Institute

Program Storage Methods


In most applications, the USER PROGRAM which is developed for a P.L.C. is stored in, RAM (Random Access Memory) within the P.L.C. where the C.P.U. can gain fast access to the DATA stored in the memory and act upon the user instructions to enable the P.L.C. to operate as 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. The major drawback with R.A.M. is that because of it's design and physical construction it requires power to be applied at all times so as to retain it's data, and if power is removed or interrupted for only a very short period of time then all data will be lost. For this reason R.A.M is also known as VOLATILE MEMORY meaning that it's contents are volatile if the correct conditions do not exist. Because the user program is vital to the correct operation of the field controlled equipment there are various methods available to copy the exact contents of the R.A.M. onto another form of memory medium that does not require power to be continuously applied to it, and these types of memory medium are known as NONVOLATILE MEMORY. Although different methods are used the principle of storing the data onto NONVOLATILE memory is basically the same. The information that the P.L.C. accesses and uses from the R.A.M. memory is stored in groups of BITS (Binary Digits) which can only be in one of two states, being either ON or OFF (1 or 0) and the R.A.M. memory area consists of thousands of 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.

NE177 PLC1 OMRON

Non-Volatile Program Storage


There are various types of NON-VOLATILE memory storage mediums and some of these are outlined below:

The Floppy Disk


This is a NON-VOLATILE memory storage medium that makes use of a FLEXIBLE diskette (i.e. FLOPPY DISK). The disk has a 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 by magnetising the surface to represent groups of bit patterns in either the ON or OFF state. 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 and because this can occur at very high speeds then the resultant access time to READ or WRITE to the disk is extremely low.

Copyright Chisholm Institute

For this type of memory storage however, it is required that the PLC.'s programming unit has a floppy disk drive or the PLC must be connected to a COMPUTER which is equipped with a floppy disk drive and the appropriate software for the computer to communicate with the PLC. 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 Disk


The HARD DISK operates in essentially the same manner as the floppy disk, with the major difference being that the hard disk as it's name implies, is made from a rigid material and is permanently housed in a separate compartment within either the PLC's programming unit or 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. A sector contains a fixed number of bytesfor example, 256 or 512. Either at the drive or the operating system level, sectors are often grouped together into clusters. Again as with the use of floppy disks the hard disk drive which contains the READ / WRITE HEADS and the motors required for rotating the disk must be included within the PLCs programming unit or within a computer configured to communicate with the PLC.

10

NE177 PLC1 OMRON

ROM
Similar 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 can send a charge that is above the forward breakover down the appropriate column with the 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. As you can see, the way a ROM chip works necessitates the programming of perfect and 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 case of most small electronic devices, contain all the necessary programming to control the device.

Copyright Chisholm Institute

11

PROM
Creating ROM chips totally from scratch is time-consuming and very expensive in small quantities. For this reason, mainly, developers created a type of ROM known as programmable read-only memory (PROM). Blank PROM chips can be bought inexpensively and coded by 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.

PROMs can only be programmed once. They are more fragile than ROMs. A jolt of static electricity can easily cause fuses in the PROM to burn out, changing essential bits from 1 to 0. But blank PROMs are inexpensive and are great for prototyping the data for a ROM before committing to the costly ROM fabrication process.

12

NE177 PLC1 OMRON

EPROM
Working with ROMs and PROMs can be a wasteful business. Even though they are inexpensive per chip, the cost can add up over time. Erasable programmable read-only memory (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 an EPROM programmer that provides voltage at specified levels depending on the type of 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. A blank EPROM has all of the gates fully open, giving each cell a value of 1. To rewrite an EPROM, you must erase it first. To erase it, you must supply a level of energy 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.

Copyright Chisholm Institute

13

EEPROMs and Flash Memory


Though EPROMs are a big step up from PROMs in terms of reusability, they still require dedicated equipment and a labour-intensive process to 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 the localised application of an electric field to each cell. This erases the targeted cells of the 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 STORAGE


This is a method of data storage that incorporates the use of cassette tapes to hold the data 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 STORAGE


With this method the data held in the PLC.'s R.A.M. memory area can be transferred onto standard audio type cassette tapes using a standard audio cassette recorder and associated cables. This method is only available on PLC.'s that have this facility and those that do have standard audio cassette INPUT/OUTPUT jacks fitted to their programming units which are usually labelled MIC for transfer of data to the cassette recorder and EAR for transferring from the 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 a specific level so as to achieve a good quality transfer of data, therefore this is not one of the most widely used methods of data storage, but can be found in smaller models of P.L.C. especially the older types.

14

NE177 PLC1 OMRON

DIGITAL CASSETTE DATA STORAGE


This 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 tape recording system built into their programming units or separate digital recorders can be 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. Both tape methods are forms of NON-VOLATILE program storage but with the increases in 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 FACILITIES
Although the user program contained within the PLC's memory can be searched through and 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 plus all of the associated addressing information contained within the program. 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 reference information on all addresses used within the program and a listing of all contents of associated data registers (i.e. Timer, Counter and Shift Register values etc.

Copyright Chisholm Institute

15

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 limit to each of the packages. In this chapter we investigate the various choices that are commonly available.

PLC Package Configurations


PLCs come in a variety of configurations. Usually the project will determine the type used, 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


Rack/Chassis Type

Used for medium to large projects with a CPU, Power Supply and I/O modules on a rack or chassis Usually 64 I/O and upwards to many hundreds or even thousands of I/O

16

NE177 PLC1 OMRON

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.

Copyright Chisholm Institute

17

OMRON Micro Programmable Controller CPM1A


The CPM1A series micro controllers solve both basic and semi-complex applications. The brick style models include AC inputs/relay outputs, DC inputs/transistor or relay outputs to meet your design requirements. The base I/O for the CPUs ranges from 10, 20, 30, and 40 I/O points with maximum expansion to 100 I/O. Specialised expansion modules include mixed analogue I/O, temperature sensor inputs and serial communications

10, 20, 30 and 40 point I/O CPUs Expandable up to 100 I/O points Peripheral communications port built in AC or DC input models Analogue expansion modules available Temperature sensor input expansion modules available Auxiliary 24 VDC supply (AC type only) Relay or Transistor outputs

18

NE177 PLC1 OMRON

ZEN Simple Logic Controller


Nano sized controller has the features and functions of both a programmable controller and smart relay to allow simple yet powerful control. Apply the ZEN to small-scale control applications where simple functionality and low cost are critical.

Provides an economical alternative to discrete timers, counters and general purpose relays. Control programs can be created using the 32-bit, Windows-based ZEN support software or using the operation buttons on the front panel (LCD models only). The ZEN is also flexible, with six CPU types, multiple expansion options, and a wide selection of accessories. Wide variety of functions. Saving and copying of programs. Space saver-the extreme compact size allows for installation in almost any location. Flexible expansion- up to 3 expansion I/O modules can be added to any CPU for a maximum of 34 I/O points. Memory backup.

Copyright Chisholm Institute

19

SIEMENS
Siemens PLCs are widely used around the world and are available in many configurations and sizes. The S5-90U is the standard 16 I/O unit for use with units requiring digital signals only. The S5-95U and 100U both have additional analogue capabilities for the more sophisticated products such as the Enhanced PLC Trainer and the Process Control Unit. All PLCs are available in a pre-wired PLC Mounting Frame.

The S5 series of PLCs has a number of programming options available. The PC programming software follows the Siemens STEP5 structured programming which divides the programming into manageable pieces where only appropriate program blocks are executed to increase scan times. Alternatively, the Siemens POG605U Programming Panel (PLCSP1) is a small, online LCD programming panel suitable for entering basic programs into any of the S5 range of PLCs. Programs are entered using the STatement List (STL) method and programming is aided by the display of system prompts and error messages.

20

NE177 PLC1 OMRON

ALLEN BRADLEY
The Allen Bradley SLC500 range of PLCs are, perhaps, one of the most popular choices for solving many industrial control applications at relatively low cost.

The units are available in 'fixed' or 'modular' format, depending on requirements. At Bytronic we have taken the 20 I/O fixed controller for our products that require digital only and added an analogue module to cater for some special applications. The 'modular' type controller has been used with out Process Control Unit.

SLC500 Accessories
As you would expect from any PLC manufacturer, Allen Bradley have many programming options and accessories available for their PLCs. PC programming of the PLCs is easily achieved using the RS Logix Programming Software (RSLOGIX), which features Ladder Programming and Monitoring, together with a suite of editing tools. Programs are downloaded to the PLC using the PLC to PC converter supplied with the software. Multi-user versions of the software are also available.

The hand held programming terminal (PLCAP1) is a powerful, portable programming tool for the SLC500 fixed or 5/01 and 5/02 modular processors and can display up to 5 rungs of ladder logic at any time. The data access module (PLCAP8) is a plant floor device that gives easy assess to timer, counter and other data table areas.

Copyright Chisholm Institute

21

Micrologix 1000 PLC


Allen Bradley's Micrologix 1000 is a low-cost 'micro' plc, offering 16 or 32 digital I/O and available with a variety of power supply options. The 24V DC. option is ideal to link to low-cost applications such as the Traffic Control Unit, Rotary Transfer Unit and the Single Conveyor Unit.

Micrologix Accessories The Micrologix 1000 is fully supported by the standard Allen Bradley RS Logix Software, which includes program documentation for adding rung comments and instructions, editing facilities - cut, copy and paste, program reports, plus many more. A hand held programmer uses the globally accepted instruction list language to program the PLC and offers the facility to monitor operation, enter and modify programs plus store and transfer programs between controllers. The 'Micro-View' low-cost data access panel is available that gives access to the various data areas of the PLC.

22

NE177 PLC1 OMRON

Diagnostics
Diagnostics provide a programmer with the ability to problem solve and debug their program. PLCs have tools and features called diagnostics to enable fault finding. By using diagnostics a programmer can also test and commission a PLC project. The type and extent of the diagnostics will depend on the PLC type and model. Some common basic diagnostics tools for the CPM1A are: Compile errors Compile warnings Compile error window Error Dialogue Force Instruction Note A well designed program will be constructed so as to quickly locate and record programming and other errors. It is well worth your time to explore and understand the use of each of diagnostics tools described.

Compile errors
These codes are presented as an alert after program has been compiled when a particular programming or communication fault occurs. The Compile icon is located on the toolbar above the programming workspacecompiles the current block. The compiler follows the rules below when compiling each individual network. 1. 2. 3. 4. 5. 6. The compiler checks for calls to non-existent subroutines. The compiler checks for invalid calls to subroutines. The compiler checks for illegal syntax for instruction operands. The compiler validates each instruction operand. The compiler checks for invalid network construction. The compiler checks for errors due to features not present in the PLC selected.

Copyright Chisholm Institute

23

Compile error examples


Some common programming errors

Program 1

Compile error dialog

The program above shows a broken rung at the input to the counter. The error dialog box shows two errors. The first is referring to a broken connection to the output and the second is referring to a broken connection to the input. (two references to the same error). Note If you are not sure where the error is in your program simply double click on the error in the box and the cursor will move to the error.

24

NE177 PLC1 OMRON

Program 2

Compile error dialog

Program 3

Compile error dialog

Copyright Chisholm Institute

25

Compile warnings
Program

Compile error dialog box

Note 1 The program above is error free but the compiler is reminding you that you have programmed the same output twice. Note 2 The diagnostic tools will help find many unexpected problems and errors, but will not find program logic errors. Program logic errors must be solved using other methods such as flow charts or truth tables.

26

NE177 PLC1 OMRON

FORCE and SET Instructions Forcing


When the PLC is online and in the Run operating mode, you can force address bits to the ON or OFF state. Forcing a bit holds the state of the bit to a given value, 1 or 0, until the force condition is removed: Typically, the PLC should be placed into the Monitor operating mode. Then, the program will be running but it will also be possible to override some of the program logic by forcing values. Note: You cannot force certain bits that the PLC reserves (e.g. P_Off, P_1Min).

Force instuctions
Force On Forces the selected bit ON. Force Off Forces the selected bit OFF. Force Cancel Cancels the forced condition on the address. The current value is freed to be changed by the PLC program. Force Cancel All Forces Cancels all forcing of bits within the PLC. The current values are freed to be changed by the PLC program(s).

Copyright Chisholm Institute

27

Force example
Using the force instruction to force on timer bit TIM000.

To use the force instruction , right click on the bit you want to force then select force on or off. The bit will stay in the selected state until you cancel the force

28

NE177 PLC1 OMRON

The SET instruction


When the PLC is online and in the Run operating mode, you can change the values within addresses from the computer. PLC and view monitoring also needs to be enabled. Note: This operation does not hold the state or value within the address to that set (forcing is used for this). i.e. The PLC program(s) may also change the value. Note: You cannot set values inside certain PLC addresses that are reserved (e.g. P_Off or P_1Min).

SET example
You can use the set instruction to toggle a bit on or off in a program as long as the bit is not controlled by the program. Using the set instruction to control internal relay 200.00

Right click on the instruction you want to set and select set on or off as shown below.

Copyright Chisholm Institute

29

Timers
Intermediate Programming
To be an effective, a programmer must have a wide range of programming instruction available to them. Not only must the programmer know when to use a particular instruction or function, they must also have a good understanding of the instructions use and parameters. In this chapter we will explore the program instructions that provide the programmer with

Derived Timers
Depending on the PLC, you may not have a particular timer function, such as Off Delay. If this is the case you will need to construct or derive a timer function from one or more On Delay timers. Common derived timers are: Off Delay Begins timing when the input goes false When the input goes false the output energises instantaneously The output de-energises after the time delay period

Self-resetting (free running)


Constantly resetting time base

Constant duty cycle (cross coupled or recycling)


On and off times can be different Often used for flasher circuits

30

NE177 PLC1 OMRON

Off Delay Derived Timer


An Off Delay timer is a timer that begins timing when the input goes false When the input goes false the output energises instantaneously The output de-energises after the time delay period. The CPM1A PLC does not have an off delay timer. The example below shows how to derive an off delay timer using a TIM instruction. Output 10.00 will energise when normally open switch 0.00 is opened and will remain on for the timed period (10 seconds). A derived Off Delay timer

Ladder

Mnemonics

Copyright Chisholm Institute

31

Self Resetting (Free Running)


The Self Resetting timer is an easily built and widely used derived timer. It is used as a fixed duration pulse of one scan cycle, the period being adjustable by the preset. A Self Resetting timer self resets after every timing cycle. In the program below when start switch 0.00 is closed TIM000 will start timing. TIM000 will reset every 1second and output10.00 will energise for the period of 1 scan each time TIM000 resets. A one second Self Resetting timer

Ladder

Mnemonics

32

NE177 PLC1 OMRON

Constant Duty Cycle (Recycling)


Construct this derived timer for use in circuits that require a regular duty cycle such as a flasher. A Recycling timer can have separately adjustable interval and duration times. The output can be programmed to start in a true or false state. A recycling or Constant Duty Cycle timer with different off and on times

Ladder

Mnemonics

Note: Many PLCs have internal clocks that can be used for some of the derived timer functions we have described here.

Copyright Chisholm Institute

33

Retentive Instructions
Retentive instructions retain their state or value even after a power cycle. A retentive timer will hold its accumulated value and begin timing at the held state once it has been re-activated. Retentive instructions are those that will remain after power has been cycled. An example would be where a counter is counting the number of parts passing through a check point on a manufacturing line. If power is cycled, then the counter would lose its accumulated value if it was not retentive. The same applies for timers, and outputs or more particularly, memory bits that have been set. There are retentive instructions that provide the user with the retained value after a power failure. Common retentive instructions in the Omron CPM1A processor are: SET Set RSET Reset CNT Count Down CNTR Count Up/Down

Omron CPM1A processor non retentive instructions are: OUT (Output ) OUTNOT (Output not) TIM (Timer On Delay)

34

NE177 PLC1 OMRON

Cascading Timers and counters


It is possible to combine timers, counters, and timers and counters to obtain values higher than the maximum available settings. Note: it is important to note the cascading will be required when the maximum positive decimal number in the preset exceeds #9999. The following combinations can be used:

Timers cascaded with timers


In the program below output 10.00 will energise 1800 seconds after switch 0.00 is closed.

Copyright Chisholm Institute

35

Counters cascaded with counters


In the program below when start switch 0.00 is turned on, output 10.00 will energise after 18000 pulses of 0.01. 0.02 is used to reset both counters.

36

NE177 PLC1 OMRON

Timers and counters cascaded together


In the program below output 10.00 will energise 30,000 seconds after switch 0.00 is closed.

Copyright Chisholm Institute

37

Counters
Reversible Counters
Many PLCs including the Omron use a counter that can count up and down, the instruction in the Omron is CNTR (reversible). A count up bit will control the II (increment input) A count down bit will control the DI (decrement input A count up will increment the accumulator A count down will decrement the accumulator The counter also uses a reset input which resets the counter to zero when closed.

An Omron reversible counter

Use of reversible counters


An example of a reversible counter could be a car park which uses sensors for cars passing through the entry and exit points. An operation of the entry sensor would activate the II input while an operation of the exit sensor would activate the DI input. The counter preset would contain the maximum number of cars that the car park could hold and the accumulator the actual number of cars in the car park. In the program below 0.00 counts the cars entering, 0.01 counts the cars leaving and 0.02 resets the count to zero.

Example of a reversible counter used in a program

38

NE177 PLC1 OMRON

Differentiate (One Shot)


The differentiate instruction allows you to cause an output to occur for one rung scan based upon a change in rung status. You typically precede the one shot instruction with an input instruction. The Omron PLCs use the following instructions. Positive Transition contact

DIFU(13) turns ON the designated bit (B) for one scan on reception of the leading (rising) edge of the input signal.

Negative Transition contact

DIFD(14) turns ON the designated bit (B) for one scan on reception of the trailing (falling) edge of the input signal.

Copyright Chisholm Institute

39

Example
In this example we have one normally open push button 0.00 and a light 10.00. The first time we press the button the light will go on and the second time we press the button the light goes off. The program below is used to perform this function

Ladder

Mnemonics

40

NE177 PLC1 OMRON

Ladder Logic Solution


First Time we push the button. Rung 1 first Scan: When the push button is pressed the one shot will energize the rung only for one scan. During that scan internal relay 200.00 will be energized. Rung 1 second Scan: Whether the button is pressed or not, the one shot will not pass the signal and hence internal relay 200.00 will not be energized.

Rung 2 first Scan: Internal relay 200.00 is on and the light is not on so the rung will be energized and the light will be turned on. Rung 2 second Scan: Internal relay 200.00 is off, light is on so the light will stay energized.

Copyright Chisholm Institute

41

Second Time we push the button. Rung 1 first Scan: When the push button is pressed the one shot will energize the rung only for one scan. During that scan internal relay 200.00 will be energized. Rung 1second Scan: Whether the button is pressed or not, the one shot will not pass the signal and hence internal relay 200.00 will not be energized. The second time we press the button rung 1 will react exactly the same way as the first time we pressed the button. The difference will be in rung 2.

Rung 2 first Scan: Internal relay 200.00 is true but the light instruction is false so the rung will be deenergized. This will cause the light output to be turned off. Rung 2 second Scan: Internal relay 200.00 is off, light is off so the light will stay de-energized.

42

NE177 PLC1 OMRON

Comparison instructions
Comparison instructions are extremely useful in PLC programming in industry and are available in almost all manufacturers' controllers. The following compare instructions are taken from the Omron controller instruction set but they are available in some form in all PLCs.

The Omron compare instruction

This instruction compares Cp1 and Cp2 and outputs the result to the GR, EQ and LE flags in the SR area. The following flag numbers are used to implement the compare instructions 255.05 Greater Than (GT) Flag 255.06 Equals (EQ) Flag 255.07 Less Than (LT) Flag

Copyright Chisholm Institute

43

Using compare instructions


The program below shows how to use a greater than instruction to turn on an output when the accumulated value of timer TIM000 is greater than 200. (20 seconds)

44

NE177 PLC1 OMRON

The program below shows how to use a less than instruction to turn on an output when the accumulated value of counter CNT000 is less than 50.

Copyright Chisholm Institute

45

Exercises/assessment items
Motor Timer

This circuit operates as follows; a: Pressing the start button will start motor 1 (MI). b: Motor 2 (M2) starts five seconds after motor 1. c: Timer (TI) to be de-energised when motor 2 starts. d: Pressing the stop button will stop both motors.

46

NE177 PLC1 OMRON

Star delta starter

A star-delta starter is used to limit the starting torque of three phase motors by employing a two step switching circuit with a time delay. This type of starter finds applications where large motors are used to drive high inertia loads and where D.O.L. starting would place excessive torque stress on the transmission components. The circuit must provide for; a: Stop button input. b: Start button input. c: Star contactor output. d: Line contactor output. e: Delta contactor output. f: Motor running output.

Copyright Chisholm Institute

47

Derived Timers Exercises


Exercise 1 Turn on SOLENIOD 27 for 22 seconds after SW4 is turned off If interrupted, the solenoid should de-energise and the timer reset

Exercise 2 When SW2 is on, turn on LAMP2, LAMP5 and LAMP7 Turn off LAMP2, LAMP5 and LAMP7 at 5 second intervals once SW2 is turned off

48

NE177 PLC1 OMRON

Exercise 3 In a factory there is a machine that has a large steel shaft supported by three bearings The shaft is coupled to an electric motor The bearings are lubricated by an oil pump driven by a small electric motor To start the machine, the operator turns on SW1 Before the shaft starts to turn, the bearings must receive oil for 10 seconds When the operator turns SW1 off to stop the machine, the oil pump continues to supply oil for an additional 15 seconds

Note Retentive instructions can be useful when keeping the status of a timer, counter or bit after a power fail or unexpected stoppage. However, it must always be remembered that returning to the previous state after a re-start can be a possible safety issue; consequently your circuit design must take this into account.

Copyright Chisholm Institute

49

Exercise 4 A timing operation requires to time a long period of 27.5 hours Construct a timer program that will operate a lamp once the period has elapsed A manual reset is required

Exercise 5 A high-speed machine requires the number of parts to be counted before changing the dies for the next part. The number of parts is 18,200. Construct a counter program that will operate a buzzer and stop the process when the number of parts is reached

50

NE177 PLC1 OMRON

Compare Exercises Process control Exercise 1 Part 1


The process shown below has the capacity to contain 50 parts at any one time. Two sensors connected to the inputs of a PLC are to be used to keep track of the number of parts in the process. S1 detects parts entering and S2 detects parts leaving. An alarm is to be turned on when the process is full. Add instructions so that the counter will not count above 50 or below 0.

Part 2 (add to part 1)


A panel is used to display the contents of the process as follows

A green light is to be on when the number of parts in the process is less than 40. An amber light is to be on between 40 and 49. A red light indicates that the process is full.

Copyright Chisholm Institute

51

Exercise 2 Car park control The car park shown below has the capacity to contain 100 cars. Two sensors connected to inputs of a PLC are to be used to keep track of the number of parking spaces available. S1 detects cars entering and S2 detects cars leaving. An output is to be turned on when the car park is full. Use the count up and count down instructions to achieve this.

52

NE177 PLC1 OMRON

Assessment Item Traffic light sequence


The intersection of King Street and Turner street is controlled by traffic lights operating in a continuous sequence.

The start of the sequence is taken to be when King St red is off and Turner St red is on. The timing diagram below shows the sequence of the traffic lights (The black areas are on)

Program Write a program using a repeating timer and six compare instructions to control the intersection .

Copyright Chisholm Institute

53

Peripheral devices
Peripheral devices to the PLC and its I/O base(s) can be anything from a host computer and control console to a motor drive unit or field limit switch. Printers and industrial terminals used for programming are also peripheral devices. Peripheral devices can generate or receive AC or DC voltages and currents as well as digital pulse trains or single pulses of quick length (pulse width). These external operating devices, with their sometimes harsh and/or fast signal characteristics, must be able to interface with the PLC's sensitive microprocessor. Various types of I/O modules (using the proper shielded cabling) are available to do this job.

Input modules
The input module has two functions: reception of an external signal and status display of that input point. In other words, it receives the peripheral sensing unit's signal and provides signal conditioning, termination, isolation and/or indication for that signal's state. The input to an input module is in either a discrete or analogue 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 analogue in nature. Peripheral devices sending signals to input modules that describe external conditions can be switches (limit, proximity, pressure, or temperature), push buttons, or logic, binary coded decimal (BCD) or analogue-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. 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 logic) input (3-15VDC). Analogue 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.

54

NE177 PLC1 OMRON

Digital inputs
There are two forms of input signal, AC and DC. Input modules are required to accept high voltage AC or DC, and low voltage DC signals. The input module has a number of common sections, the functions of which are as follows: The input lamp shows the on/off status of the input to the assembly. The electrical isolation provides protection to the PLC internal logic by isolating it from the field wiring and terminations. The input filter provides field contact de-bouncing which will assist in reducing multiple unwanted field contact closures due to the characteristics of mechanical contacts. In addition, the input filter will reduce the possibility of electrical noise being detected as a field contact operation. The logic circuit processes the input signal to make it suitable to be fed into the PC CPU.

A block diagram of a typical PLC digital input module

Copyright Chisholm Institute

55

DC Inputs
Let's now take a look at how the input circuits of a plc work. This will give us a better understanding of how we should wire them up. Bad things can happen if we wire them up incorrectly! Typically, dc input modules are available that will work with 5, 12, 24, and 48 volts. Be sure to purchase the one that fits your needs based upon the input devices you will use. We'll first look at how the dc inputs work. DC input modules allow us to connect either PNP (sourcing) or NPN (sinking) transistor type devices to them. If we are using a regular switch (i.e. toggle or pushbutton, etc.) we typically don't have to worry about whether we wire it as NPN or PNP. We should note that most PLCs won't let us mix NPN and PNP devices on the same module. When we are using a sensor (photo-eye, proximity switch, etc.) we do, however, have to worry about its output configuration. (Always verify whether it's PNP or NPN). (Check with the manufacturer when unsure) The difference between the two types is whether the load (in our case, the plc is the load) is switched to ground or positive voltage. An NPN type sensor has the load switched to ground whereas a PNP device has the load switched to positive voltage. Below is what the outputs look like for NPN and PNP sensors.

On the NPN sensor we connect one output to the PLCs input and the other output to the power supply ground. If the sensor is not powered from the same supply as the plc, we should connect both grounds together. Many engineers will say that PNP is better (i.e. safer) because the load is switched to ground, but whatever works for you is best. Just remember to plan for the worst. On the PNP sensor we connect one output to positive voltage and the other output to the PLCs input. If the sensor is not powered from the same supply as the plc, we should connect both V+'s together. PNP sensors are most commonly used in Europe.

Inside the sensor, the transistor is just acting as a switch. The sensors internal circuit tells the output transistor to turn on when a target is present. The transistor then closes the circuit between the 2 connections shown above. (V+ and plc input).

56

NE177 PLC1 OMRON

The common terminal either gets connected to V+ or ground. Where it's connected depends upon the type of sensor used. When using an NPN sensor this terminal is connected to V+. When using a PNP sensor this terminal is connected to 0V (ground).

An ordinary switch (i.e. limit switch, pushbutton, toggle, etc.) would be connected to the inputs in a similar fashion. One side of the switch would be connected directly to V+. The other end goes to the plc input terminal. This assumes the common terminal is connected to 0V (ground). If the common is connected to V+ then simply connect one end of the switch to 0V (ground) and the other end to the plc input terminal. A device called a photocoupler is used to isolate the PLCs internal circuit from the inputs. This eliminates the chance of any electrical noise entering the internal circuitry. They work by converting the electrical input signal to light and then by converting the light back to an electrical signal to be processed by the internal circuit.

Copyright Chisholm Institute

57

AC Inputs
Now that we understand how dc inputs work, let's take a close look at AC inputs. An AC voltage is non-polarised. Put simply, this means that there is no positive or negative to worry about. However, AC voltage can be quite dangerous to work with if we are careless. Typically, AC input modules are available that will work with 24, 48, 110, and 220 volts. Be sure to purchase the one that fits your needs based upon the input devices (voltage) you will use. AC input modules are less common these days than dc input modules. The reason being that today's sensors typically have transistor outputs. A transistor will not work with an AC voltage. Most commonly, the AC voltage is being switched through a limit switch or other switch type. If your application is using a sensor it probably is operating on a dc voltage.

We typically connect an AC device to our input module as shown above. Commonly the AC "hot" wire is connected to the switch while the "neutral" goes to the PLC common. The AC ground (3rd wire where applicable) should be connected to the frame ground terminal of the PLC.(not shown) As is true with DC, AC connections are typically colour coded so that the individual wiring the device knows which wire is which. This coding varies from country to country. In Australia it is coded as brown (active), blue (neutral) and green with a yellow stripe (3rd wire ground where applicable).

The only things accessible to the user are the terminals labelled common and input 0000. The common terminal gets connected to the neutral wire. A common switch (ie. limit switch, pushbutton, toggle, etc.) would be connected to the input terminals directly. One side of the switch would be connected directly to 58

NE177 PLC1 OMRON

input 0000. The other end goes to the AC active wire. This assumes the common terminal is connected to neutral. Always check the manufacturers specifications before wiring, to be sure and safe. The photocouplers are used to isolate the PLCs internal circuit from the inputs. This eliminates the chance of any electrical noise entering the internal circuitry. They work by converting the electrical input signal to light and then by converting the light back to an electrical signal to be processed by the internal circuit. One last note, typically an AC input takes longer than a DC input for the PLC to see. In most cases it doesn't matter to the programmer because an AC input device is typically a mechanical switch and mechanical devices are slow. It's quite common for a PLC to require that the input be on for 25 or more milliseconds before it's seen. This delay is required because of the filtering which is needed by the PLC internal circuit. Remember that the PLC internal circuit typically works with 5 or less volts dc.

Copyright Chisholm Institute

59

Digital Outputs
The output assembly of a programmable controller consists of a number of sections (see Figure below). The output signal is derived from signals in the processor being fed to the output logic circuits which are isolated to protect the logic from accidental application of excessive voltages to field wiring. The output is usually provided with over current protection such as a fuse to stop the output assembly from being damaged if an accidental short circuit is applied in the field wiring. A block diagram of a typical digital output module.

A blown-fuse indicator is provided as a feature on some programmable controllers; it will indicate if any of the individual output fuses blow and assist in troubleshooting by indicating the general location, such as rack or module, of a fault. The output module of a programmable controller acts as a switch to supply power from the user power supply to operate the output. The output, under the control of the program, is fed from the processor to a logic circuit that will receive and store the processor command that is required to make an output become inactive. It is necessary to store the command because once an output is made active it must. remain in the active state until it is instructed by the program to become inactive. The output switching devices most often used to switch power to the load in programmable controllers are: A relay for AC or DC loads; A triac for AC loads only; A transistor for DC loads only.

Relay outputs
One of the most common types of outputs available is the relay output. A relay can be used with both AC and DC loads. A load is simply a fancy word for whatever is connected to our outputs. We call it a load because we are "loading the output" with

60

NE177 PLC1 OMRON

something. If we connected no load to the output (ie. just connect it directly to a power supply) we would certainly damage the outputs. This would be similar to replacing the light bulb in the lamp you're using to read this with a piece of wire. If you did this, the lamp would draw a tremendous amount of current from the outlet and certainly pop your circuit breaker or blow your fuse. Some common forms of a load are a solenoid, lamp, motor, etc. These "loads" come in all sizes. Electrical sizes, that is. Always check the specifications of your load before connecting it to the PLC output. You always want to make sure that the maximum current it will consume is within the specifications of the PLC output. If it is not within the specifications (ie. draws too much current) it will probably damage the output. When in doubt, double check with the manufacturer to see if it can be connected without potential damage. Some types of loads are very deceiving. These deceiving loads are called "inductive loads". These have a tendency to deliver a "back current" when they turn on. This back current is like a voltage spike coming through the system. A good example of an inductive load that most of us see about 6 months per year is an air conditioning unit. Perhaps in your home you have an air conditioner. Have you ever noticed that when the air conditioner switches on the lights dim for a second or two? Then they return to their normal brightness. This is because when the air conditioner turns on it tries to draw a lot of current through your wiring system. After this initial "kick" it requires less current and the lights go back to normal. This could be dangerous to your PLCs output relays. It can be estimated that this kick is about 30 times the rated current of the load. Typically a diode, varistor, or other "snubber" circuit should be used to help combat any damage to the relay. Enough said. Let's see how we can use these outputs in the "real PLC world".

Shown above is a typical method of connecting our outputs to the relays. Although our diagram shows the output connected to an AC supply, DC can be used as well. A relay is non-popolarised and typically it can switch either AC or DC. Here the common is connected to one end of our power supply and the other end of the supply is connected to the load. The other side of our load gets connected to the actual PLC output you have designated within your ladder program.

Copyright Chisholm Institute

61

The relay is internal to the PLC. Its circuit diagram typically looks like that shown above. When our ladder diagram tells the output to turn on, the PLC will internally apply a voltage to the relay coil. This voltage will allow the selected contact to close. When the contact closes, an external current is allowed to flow through our external circuit. When the ladder diagram tells the PLC to turn off the output, it will simply remove the voltage from the internal circuit thereby enabling the output contact to release. Our load will than have an open circuit and will therefore be off.

62

NE177 PLC1 OMRON

Transistor outputs
The next type of output we should learn about is our transistor type outputs. It is important to note that a transistor can only switch a DC current. For this reason it cannot be used with an AC voltage. We can think of a transistor as a solid-state switch. Or more simply put, an electrical switch. A small current applied to the transistors "base" (ie. input) lets us switch a much larger current through its output. The PLC applies a small current to the transistor base and the transistor output "closes". When it's closed, the device connected to the PLC output will be turned on. This is a very simple explanation of a transistor. There are, of course, more details involved but we don't need to get too deep. We should also keep in mind that as we saw before with the input circuits, there are generally more than one type of transistor available. Typically a PLC will have either NPN or PNP type outputs. The "physical" type of transistor used also varies from manufacturer to manufacturer. Some of the common types available are BJT and MOSFET. A BJT type (Bipolar Junction Transistor) often has more switching capacity (ie. it can switch more current) than a MOS-FET (Metal Oxide Semiconductor- Field Effect Transistor) type. The BJT also has a slightly faster switching time. Once again, please check the output specifications of the particular PLC you are going to use. Never exceed the manufacturers maximum switching current.

Shown above is how we typically connect our output device to the transistor output. Please (note that this is a NPN type transistor). If it were a PNP type, the common terminal would most likely be connected to V+ and V- would connect to one end of our load. Note that since this is a DC type output we must always observe proper polarity for the output. One end of the load is connected directly to V+ as shown above. Let's take a moment and see what happens inside the output circuit. Shown below is a typical output circuit diagram for a NPN type output.

Copyright Chisholm Institute

63

Notice that as we saw with the transistor type inputs, there is a photocoupler isolating the "real world" from the internal circuit. When the ladder diagram calls for it, the internal circuit turns on the photocoupler by applying a small voltage to the LED side of the photocoupler. This makes the LED emit light and the receiving part of the photocoupler will see it and allow current to flow. This small current will turn on the base of the output transistor connected to output 0500. Therefore, whatever is connected between COM and 0500 will turn on. When the ladder tells 0500 to turn off, the LED will stop emitting light and hence the output transistor connected between 0500 and COM will turn off. One other important thing to note is that a transistor typically cannot switch as large a load as a relay. Check the manufacturers specifications to find the largest load it can safely switch. If the load current you need to switch exceeds the specification of the output, you can connect the LC output to an external relay then connect the relay to the large load. You may be thinking, "why not just use a relay in the first place"? The answer is because a relay is not always the correct choice for every output. A transistor gives you the opportunity to use external relays when and only when necessary. In summary, a transistor is fast, switches a small current, has a long lifetime and works with DC only. Whereas a relay is slow, can switch a large current, has a shorter lifetime and works with AC or DC. Select the appropriate one based upon your actual application needs.

64

NE177 PLC1 OMRON

Summary Inputs
Digital DC Sink or Source Very Common Fast DC switching Voltage dependent, typically 24 VDC Digital AC Less common Fast AC switching Voltage dependent, typically 110 or 230 VAC

Outputs
Relay Very common. Slow switching at high currents up to 2.5A Voltage dependent Transistor Sink or Source Very common Fast switching at low currents up to 0.5A Voltage dependant, typically 24 VDC Triac Less common Fast AC switching at low currents up to 0.25A Voltage dependant, typically 110 or 230 VAC

Copyright Chisholm Institute

65

Program Control IL(02) - Interlock

Purpose:
If an interlock condition is OFF, all outputs and all timer PVs between the current IL(02) and the next ILC(03) are turned OFF or reset, respectively. Other instructions are treated as NOP. Counter PVs are maintained. If the execution condition is ON, execution continues normally.

ILC(03) - Interlock Clear

Purpose:
If an interlock condition is OFF, all outputs and all timer PVs between the current IL(02) and the next ILC(03) are turned OFF or reset, respectively. Other instructions are treated as NOP. Counter PVs are maintained. If the execution condition is ON, execution continues normally.

66

NE177 PLC1 OMRON

Jump (JMP)

Jump end (JME)

JMP(04) is always used in conjunction with JME(05) to create jumps, that is, to skip from one point in a ladder diagram to another point. JMP(04) defines the point from which the jump will be made; JME(05) defines the destination of the jump. When the execution condition for JMP(04) in ON, no jump is made and the program is executed consecutively as written. When the execution condition for JMP(04) is OFF, a jump is made to the JME(05) with the same jump number and the instruction following JME(05) is executed next. N: Jump Number 0 to 8 (CxxK) 0 to 49 (CPM1) 0 to 99 (all other PLCs)

Availability: C200H, C200HS, CPM1, CPM2*, SRM1, SRM1-V2, CQM1, CQM1H, C1000H, C2000H, IDSC and C200HX Family

Copyright Chisholm Institute

67

Jump example

Network1 ---Network 2----

Network 4------------------Network 9----

---Network n ----

When 0.00 is true, the program scan operates normally and the whole program is scanned. When 0.00 goes false the program between network 4 and 9 is no longer scanned and all outputs, timers and counters etc remain in their last state.

68

NE177 PLC1 OMRON

End

Description END(01) is required as the last instruction in any program. If there are subroutines, END(01) is placed after the last subroutine. No instruction written after END(01) will be executed. END(01) can be placed anywhere in the program to execute all instructions up to that point, as is sometimes done to debug a program, but it must be removed to execute the remainder of the program. Note: If there is no END(01) in the program, no instructions will be executed and the error message "NO END INST" will appear

The temporary end instruction allows you to set conditions to end the program at any point in the scan. In the program shown below the program scan ends at network 6. Only rungs 1 to 6 are scanned .

Network1 ---Network 2------------Network 6 ----

------------Network n ----

Copyright Chisholm Institute

69

Bit Shift
Shift registers are used extensively in industry for a variety of purposes. Essentially a shift register uses a register or group of registers to form a train of bits to store the previous on/off status. Each time the Clock input is pulsed, the status of the data input gets stored in the first bit and the remaining bits get shifted down the train.

The shift register goes by many names. SFT (Shift), BSL (Bit Shift Left), SFR (Shift Forward Register) are some of the common names. These registers shift the bits to the left. BSR (Bit Shift Right) and SFRN (Shift Forward Register Not) are some examples of instructions that shift bits to the right. We should note that not all manufacturers have shift registers that shift data to the right but most have left shifting registers. A typical shift register instruction has a symbol like that shown below. The symbol needs 3 inputs and has some data inside the symbol.

70

NE177 PLC1 OMRON

Data
The data input gathers the true/false status that will be shifted down the train. When the data input is true the first bit in the register will be a 1. This data is only entered into the register on the rising edge of the clock input.

Clock
On the rising edge of the clock input, the shift register shifts the data one location to the right or left enters the status of the data input into the first bit. On each rising edge of this input the process will repeat.

Reset
The reset input does just what it says. It clears all the bits inside the register to 0. Bit 1000 inside the shift register symbol is the location of the first bit of our shift register. Bit 1003 inside the symbol above is the last bit of our shift register. Bits 1001 and 1002 are intermediate bits. So this shift register has 4 bits. (1003, 1002, 1001, 1000)

Copyright Chisholm Institute

71

The Omron bit shift register (SFT)

Description
SFT(10) is controlled by three execution conditions, I (input), P (pulse), and R (reset). If SFT(10) is executed and (a) execution condition P is ON and was OFF the last execution and (b) R is OFF, then execution condition I is shifted into the rightmost bit of a shift register defined between St and E, that is, if I is ON, a 1 is shifted into the register; if I is OFF, a 0 is shifted in. When I is shifted into the register, all bits previously in the register are shifted to the left and the leftmost bit of the register is lost. The execution condition on P functions like a differentiated instruction, that is, I will be shifted into the register only when P is ON and was OFF the last time SFT(10) was executed. If execution condition P has not changed or has gone from ON to OFF, the shift register will remain unaffected. St designates the rightmost word of the shift register; E designates the leftmost. The shift register includes both of these words and all words between them. The same word may be designated for St and E to create a 16-bit (that is, 1-word) shift register.

Operand Data Areas: St: E: Starting Word IO, AR, HR, LR End Word IO, AR, HR, LR

72

NE177 PLC1 OMRON

Program example

When execution condition R (reset) goes ON, all bits in the shift register will be turned OFF (that is, set to 0) and the shift register will not operate until R goes OFF again.

Copyright Chisholm Institute

73

Practical example
The following application describes a typical use for a bit shift register. An ice-cream cone machine has 4 steps. First we verify the cone is not broken. Next we put ice cream inside the cone.(turn on output 10.00). Next we add chocolate.(turn on output 10.01) Finally we add sprinkles.(turn on output 10.02) If the cone is broken we obviously don't want to add ice cream and the other items. Therefore we have to track the bad cone down our process line so that we can tell the machine not to add each item.

We use a sensor to look at the bottom of the cone as it enters the machine. ( 0.00) If it is on then the cone is perfect and if it is off then the cone is broken. Another sensor clocks the register each time a cone enters the machine. (0.01)

74

NE177 PLC1 OMRON

Here's what the ladder would look like:

Let's now follow the shift register as the operation takes place. Here's what the data register (the register we're shifting) looks like initially: Data word 200 15 --4 3 0 2 0 1 0 0 0

A good cone comes in front of the sensor (0.00). The sensor turns on. Bit 0 will not turn on until the rising edge of the clock pulse. (0.01). When the clock input generates a pulse the status of the data input (cone sensor input 1) is transferred to bit 0.

Copyright Chisholm Institute

75

The register now looks like this: Data word 200 15 --4 3 0 2 0 1 0 0 1

As the conveying system moves on, another cone comes in front of the sensor. This time it's a broken cone, the fault sensor remains off and the clock input generates another pulse. The old status of bit 0 is transferred to bit 1. The old status of bit 1 shifts to bit 2. The old status of bit 2 shifts to bit 3 and the new status of the data input (cone sensor) is transferred to bit 0. The register now looks like this: Data word 200 15 --4 3 0 2 0 1 1 0 0

Since the register shows that bit 1 is now on, the ladder says that output 10.00 will turn on and ice cream is put in the cone. As the conveying system continues to move on, another cone comes in front of the sensor. This time it's a good cone and the sensor turns on. Now the clock input generates another pulse. The old status of bit 0 is transferred to bit 1. The old status of 1 shifts to 2. The old status of 2 shifts to 3 and the new status of the data input (cone sensor) is transferred to bit 0.

76

NE177 PLC1 OMRON

The register now looks like this: Data word 200 15 --4 3 0 2 1 1 0 0 1

Since the register shows that bit 2 is now on the ladder says that output 10.01 will turn on and chocolate is put on the cone. Since bit 1 now holds the status of a broken cone, output 10.00 remains off and no ice-cream is inserted into this cone. As the conveying system continues to move on, another cone comes in front of the sensor. This time it's also a good cone and the sensor turns on and the clock input generates another pulse. The old status of bit 0 is transferred to bit 1. The old status of 1 shifts to 2. The old status of 2 shifts to 3 and the new status of the data input (cone sensor) is transferred to bit 0. The register now looks like this: Data word 200 15 --4 3 1 2 0 1 1 0 1

Since the register shows that bit 3 is now on, the ladder says that output 10.02 will turn on and sprinkles are put on the cone. Since bit 2 now holds the status of a broken cone, output 10.01 remains off and no chocolate is put onto this cone. Since the register shows that bit 1 is now on, the ladder says that output 10.00 will turn on and ice cream is put in that cone. As the conveying system continues to move on, another cone comes in front of the sensor. This time it's another broken cone and the sensor turns off. The clock input generates another pulse. The old status of bit 0 is transferred to bit 1. The old status of 1 shifts to 2. The old status of 2 shifts to 3 and the new status of the data input (cone sensor) is transferred to bit 0.

Copyright Chisholm Institute

77

The register now looks like this: Data word 200 15 --4 3 0 2 1 1 1 0 0

The operation above would continue on with each bit shifting on the rising edge of the clock signal.

Some other bit shift applications


The shift register is most commonly used in conveyor systems, labelling or bottling applications, etc. Sometimes it's also conveniently used when the operation must be delayed in a fast moving bottling line. For example, a solenoid can't immediately kick out a bad bottle when the sensor says its bad. By the time the solenoid reacted, the bottle would have already passed by. Typically the solenoid is located further down the conveyor line and a shift register tracks the can to be kicked out later when it's more convenient.

78

NE177 PLC1 OMRON

Drum controllers (sequencers)


Drum controllers fall into the category of "sequencers". Several variations on sequencer controls exist but the basic criteria is to be able to control bits or groups of bits (words) "sequentially". The drum controller, like many software functions, derives its name from a hard-wired electrical control device. This device consists of a shaft with a number of contact switches attached to it; the shaft can be rotated by hand or a small motor. The contacts connected to the rotating shaft, brush against fixed stationary contacts arranged to switch at different intervals throughout the complete rotation cycle. By arranging suitable control circuit wiring, a "sequential" switching operation cycle is achieved. The software drum controller borrows the same functional concept for its hard-wired namesake, by using the following criteria. 1- An Input To Move To The Next Position. (Rotate The Shaft) 2- A Group Of Bits To Be Read From. (Moving Contacts) 3- A Group Of Bits To Be Written To. (Stationary Contacts) 4- A Pointer To Indicate The Current Position. (Handle / Protractor) The group of bits to be read from is referred to as the source table, or file. A Table or File is a group of successive words. The group of bits to be written to is referred to as the destination register or, word. The pointer itself is a register or word, having a value which is incremented each time the functions input is true. It is common for the pointer to increment for each program scan that the input is true so the input may need to be arranged as a "one shot" bit. A "one shot" bit is only true for one scan when changing from either true to false, & can be described as an "edge trigger" for rising or falling (high or low) conditions. The pointer value is used by the drum controller to indicate the word from within the designated table that is to be sent to the output destination.

Copyright Chisholm Institute

79

Drum controller operation

The diagram above indicates the pointer is currently equal to 5. This means the input has changed from low to high & back to low 5 times. The pointer value will "point" to a location within the table, in this case location 5, and copy that location to the output destination. The source location indicates where in ram a table of information is located with an offset of +1.

80

NE177 PLC1 OMRON

Exercises/Assessment items
Program Flow Assessment Item 1
Refer to the program below Write the program and download to the PLC. Alter the program as follows using the appropriate program control instructions. When normally open switch, 0.10 is opened, Rungs 1 - 3 are not scanned and all outputs in those rungs remain in their last state

Copyright Chisholm Institute

81

Program Flow Assessment Item 2


Refer to the program below Write the program and download to the PLC. Alter the program as follows using the appropriate program control instructions so that only rungs 0 to 3 are scanned.

82

NE177 PLC1 OMRON

Shift register exercises Exercise 1 Bit shift


Create a car wash program with three treatment points one each for Suds, Rinse and Hot Wax This program must turn on and off each of the treatment points as cars proceed through the wash The treatment points should be outputs on your simulator. The program should include the following: A sensor S1 to detect the presence of a car. A sensor S2 to pulse the shift register each time the cars are moved to the next position. A reset switch RS to clear the register

Copyright Chisholm Institute

83

Exercise 2
The over voltage protection unit shown below operates as follows When the unit senses a rise in input voltage it disconnects the process from the mains. It also contains a circuit that pulses a trip output for 1second when the unit trips. A 1second pulse on the reset input will reconnect the mains.

The PLC is to be programmed as follows. Part 1 The PLC receives a pulse from the trip output. After a five-minute delay, the program automatically resets the unit by applying a 1second pulse to the reset input. Part 2 If however, the protection unit trips more than three times in the period of one hour the automatic reset is to be disabled and an audible alarm sounded. When this happens the maintenance electrician is called to reset the system by pressing a manual reset button. (for the purposes of testing your program, reduce the time delays accordingly)

84

NE177 PLC1 OMRON

Shift Register Assessment Item


Refer to the diagram below The spray booth operates as follows Parts are indexed through the paint booth from left to right. When a part is positioned in front of either of the spray guns, an output is energised to spray the part. The spray guns should not operate if no part is present. Proximity switch (prox1) activates each time a part holder passes. Proximity switch (prox2) detects whether a part is present. The controller and limit switches are mounted outside the spray booth to avoid electrical hazards. Write a program using the bit shift instruction to achieve this. Include a reset switch to clear the register. Note Assume that the movement of parts has already been programmed, you only have to program the shift register.

Copyright Chisholm Institute

85

Drum controllers exercises Exercise 1 Aim


To program a sequential switching operation cycle using the PLC sequencer instruction. The timing diagram below shows how a group of outputs are controlled in cycle. The shaded areas of the diagram show the output ON and the blank section shows the output OFF. (In step 1 outputs 0, 2 and 5 are ON for 5seconds)

Program Write a program to achieve the sequence of operations shown in the timing diagram. Run and test

86

NE177 PLC1 OMRON

Drum controller Assessment Item


The intersection of King street and Turner street is controlled by traffic lights operating in a continuous sequence.

The start of the sequence is taken to be when King St red is off and Turner St red is on. The timing diagram below shows the sequence of the traffic lights (The black areas are on)

Program Write a program using sequencer instruction to control the intersection.

Copyright Chisholm Institute

87

You might also like