plc programming with rslogix 500_shared

132

Upload: badenkey

Post on 26-Dec-2015

313 views

Category:

Documents


4 download

DESCRIPTION

Programming with RSlogix 500shared book

TRANSCRIPT

Page 1: PLC Programming With RSLogix 500_shared
Page 2: PLC Programming With RSLogix 500_shared

PLC Programming

withRSLogix 500

How to Program an Allen-Bradley PLC with Rockwell Automation’s

RSLogix 500

By Jack Rindell

Industrial Automation Series

engineer-and-technician.com

PLC Programming with RSLogix 500 Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 3: PLC Programming With RSLogix 500_shared

Table of Contents

......................................................................................Introduction! 1...............................................................................................PLCs! 2

.........................................................................................Hardware! 3........................................................................................SLC Rack! 3

..........................................................................SLC Power Supply ! 3..............................................................................SLC Processors! 3.............................................................................SLC I/O Modules! 4..............................................................................MicroLogix 1000! 4..............................................................................MicroLogix 1200! 4..............................................................................MicroLogix 1500! 4

....................................................................................Ladder Logic! 5........................................................................The Dialect of PLCs! 5

..............................................................................Equivalent Logic! 9.......................................................................................Scan Time! 10

..................................................................................Project Scope! 11..................................................................Summarizing the Scope! 17

....................................................................................Which PLC?! 18..............................................................................Lay Out The I/O! 18

.............................................Laying Out The Modules In The Rack! 20.................................................................Assigning I/O Addresses! 21

..................................................................................Analog Inputs! 21...................................................................................Digital Inputs! 22

................................................................................Digital Outputs! 23...........................................................................Installing RSLogix! 24

....................................................................Installing RSLogix 500! 24............................................................................Running RSLogix! 25

.............................Configuring Colors, Fonts and Address Display ! 31.......................................................Adding Descriptors To Your I/O ! 31

........................................................................Writing the Program! 34...............................................Setting Up An Overall Control Rung! 34

....................................................................Starting a Batch Cycle! 37................................................................................Batching Steps! 42

.............................................................Step 1 – Adding City Water! 42..................................................................................Analog Inputs! 45

...................................Setting up an SCP to calculate Tank Weight! 48

...................................Setting Up An SCP To Calculate Tank Level! 50...............................................................Back to Batching – Step 1! 51

........................................................Step 2 – Adding Chemical KM! 54

........................................................Step 3 – Adding Chemical KM! 58............................................................................Step 4 – Blending! 59

........................................................Step 5 – Pump to Filling Lines! 64..............................................................................................Faults! 66

PLC Programming with RSLogix 500 Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 4: PLC Programming With RSLogix 500_shared

.......................................................................Valve Position Faults! 66.........................................Console Status Indicators – Pilot Lights! 75

.................................................................Adding Rung Comments! 79..............................................................Expanding the Data tables! 83

.....................................Connecting To The SLC And Going Online! 87.......................................................................................Run Mode! 100

........................................................................Editing in Run Mode! 108.....................................................A Final Note About Our Program! 116

................................................................................How Do I . . . ?! 117.........................................................Tips, Shortcuts and Warnings! 119

......................................................................................Conclusion! 124...............................................................................................Index! 126

PLC Programming with RSLogix 500 Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 5: PLC Programming With RSLogix 500_shared

IntroductionThe purpose of this book is to teach you how to set up, program and use an Allen-Bradley SLC 500 PLC. It will tell you what parts you need to buy for a common application.

It will tell you how to install RSLogix, how to write a ladder logic program, how to configure your computer and your SLC so that you can download your ladder logic program.

There is a sample project included that contains a Project Scope. The Project Scope (or Functional Specification, or whatever your company might call it) defines in detail how the system is to operate when the project is finished.

You will learn how to take a Project Scope and turn it into a working PLC program.

It will show you, step by step, how to go online with your SLC to monitor your program to verify your ladder logic and make sure it is functioning properly.

It will show you how to make changes to your program while you are online.

It will show you the keystrokes and mouse movements that you need to know to use RSLogix.

Finally, it provides a number of tips and a Frequently Ask Questions section that will save you hours of frustration.

This book assumes you have a little background with PLCs – perhaps you have worked with other PLCs from other manufacturers or you have helped to install and wire PLCs. Perhaps you are a Mechanical or Process Engineer and you need to learn how to use RSLogix.

If you need a more thorough understanding of basic PLC concepts, you might want to try the Beginner’s Guide to PLC Programming How to Program a PLC (Programmable Logic Controller). This ebook, along with the online tutorial, provides an example of how to automate a drill press, while explaining all the basic concepts of PLC programming that are necessary to write a solid PLC program.

The Beginner’s Guide to PLC Programming works well in conjunction with this book, in that it concentrates on basic PLC programming methods that are common to all types of PLCs. In addition, it provides an example of machine operation, whereas PLC Programming with RSLogix 500 uses the example of a chemical batching process.

Go to engineer-and-technician.com if you would like to learn more about this book.

PLC Programming with RSLogix 500 1Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 6: PLC Programming With RSLogix 500_shared

PLCsNearly all the industrial equipment that you find in a modern manufacturing facility shares one thing in common - computer control. The most commonly used controller is the PLC, or the Programmable Logic Controller, using a programming language called Ladder Logic. The language was developed to make programming easy for people who already understood how switches, relay contacts and coils work. Its format is similar to the electrical style of drawing known as the “ladder diagram”.

The most popular and most widely used manufacturer of PLCs is Rockwell Automation, who produces the Allen-Bradley MicroLogix and SLC series of PLCs. The MicroLogix and SLC families of processors and I/O modules are all programmed using Rockwell’s proprietary software known as RSLogix.

In the book, we will concentrate specifically on the SLCs, MicroLogix PLCs and RSLogix. We won’t talk about other manufacturers or other Rockwell software, as RSLogix will (and currently does) perform nearly all the programming requirements of a plant’s automation system.

When you are finished with this book, you will be able to sit down in front of any computer running RSLogix and create a new program. You will be able to edit existing programs. You will be able to professionally document any changes you have made.

Rockwell Automation Technical Support

Unfortunately, we can’t anticipate all the problems you might face as you are troubleshooting a program on the factory floor. There are just too many variables. This is why you must establish a relationship with your local Rockwell Automation technical support team. Get to know them before you are in the final stages of a start-up and you run into a problem. They are very helpful and they can save you hours of frustration.

The Rockwell reps are not just technical support personnel; they are skilled engineers that are responsible for running their own projects and writing and troubleshooting their own programs. If you run into a problem, more than likely they have already seen it and have come up with a solution.

PLC Programming with RSLogix 500 2Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 7: PLC Programming With RSLogix 500_shared

HardwareOne of the nice things about Allen-Bradley’s smaller PLCs is the relative simplicity of assembling the hardware to create a system.

First, let’s see what it takes to assemble an SLC 500 system. You only need to have a few components: a rack, a power supply, a processor and some I/O modules.

SLC RackThese come in four configurations, with varying capacity for installing the I/O modules.

1746-A4 4-Slot chassis1746-A7 7-Slot chassis1746-A10 10-Slot chassis1746-A13 13-Slot chassis

A rack is a frame that holds the modules of an SLC 500 system. It is similar to the motherboard and case in your personal computer. It provides a physical structure to hold the modules that create a system, like your computer’s case. It also provides an electronic back plane that allows modules to communicate and interact.

In an SLC system, the SLC 500 processor always resides in Slot 0, which is the first slot.

SLC Power SupplyPower supplies come in varying capacities.

1746-P1 1746-P21746-P3 1746-P4 1746-P5 1746-P7

SLC ProcessorsThere are five SLC 500 processors available:

SLC 5/01SLC 5/02SLC 5/03SLC 5/04SLC 5/05

PLC Programming with RSLogix 500 3Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 8: PLC Programming With RSLogix 500_shared

The 5/01 is the most basic processor, with each succeeding model having more capabilities. The most important difference is found in the SLC 5/05, which has the capability of Ethernet communications.

SLC I/O Modules

There are an incredible amount of I/O (input/output) modules available for the Allen-Bradley SLC family. There are 4-20mA and 0-10VDC analog modules. There are digital (also known as discrete) modules that work in a variety of voltage configurations and capacities.

Use the link below to download Allen-Bradley’s literature on the SLC 500 systems:http://literature.rockwellautomation.com/idc/groups/literature/documents/sg/1747-sg001_-en-p.pdf

Use this link to find manuals regarding Allen-Bradley PLCs:http://literature.rockwellautomation.com/idc/groups/public/documents/webassets/browse_category.hcst

Let’s see what it takes to assemble a MicroLogix System.

MicroLogix 1000

The MicroLogix 1000 is a self-contained unit that offers up to 20 digital I/O points and 5 analog I/O points. It differs from the SLC family in that it is just one physical unit.

MicroLogix 1200

The MicroLogix 1200 is a modular unit, allowing you to customize and expand your I/O. The highest capacity racks provide space for four additional I/O modules.

MicroLogix 1500

The 1500 continues in that theme with six expansion slots, providing over 256 I/O points and a couple of counters and outputs.

A full description of the MicroLogix family can be found on Rockwell’s site at the link below.

http://literature.rockwellautomation.com/idc/groups/literature/documents/br/1761-br006_-en-p.pdf

PLC Programming with RSLogix 500 4Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 9: PLC Programming With RSLogix 500_shared

Ladder LogicBefore we open RSLogix and start programming, there are a few things you need to know about PLCs in general. I have summarized the basic terms and techniques required to work with ladder logic. It isn’t a comprehensive summary, but if you are just starting out, the information presented here will be very helpful.

Every PLC programmer, no matter what skill level, must know the principles described in this section and the Equivalent Logic section. There is simply no way around it.

To effectively write a program, or even edit one, the programmer must know how to visualize the effects of the changes he will make.

In other words, you have to be able to look at the logic “on paper” and imagine how the logic will work when it is entered into the PLC.

The Dialect of PLCsLets' define some terms and symbols:

INSTRUCTION – RSLogix’s command language is comprised of “instructions”. An XIC (it looks like a normally open contact --] [-- ) is an instruction. A timer is an instruction. A few of the most common instructions are described below.

BIT - an address within the PLC. It can be an input, output or internal coil, among others.

In RSLogix, there are a couple of ways to show the address of a bit. The default is:

[type]:[word]/[bit]

For example, an address that references an output of an SLC 500 is O:5/0. That is:

O:5/0 means that it is a physical output.O:5/0 means that it uses Slot 5 (the 6th physical slot) in the rack. O:5/0 means that it is the first output on the card.

Remember that the first slot in an SLC 500 rack is Slot 0. That means a card that is installed in the 6th physical slot is addressed as Slot 5.

Allen-Bradley PLC slots, like many computer numbering systems, always start with 0.

PLC Programming with RSLogix 500 5Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 10: PLC Programming With RSLogix 500_shared

By the way, don’t get the capital “O’s” confused with zeroes.

RUNG - A section of the PLC ladder program that terminates in an output function of some type. Just like in an electrical ladder diagram, a rung has some type of output that is turned on or turned off by the preceding entities in the rung. The first rung in a ladder program is always 0000.

HARDWIRED INPUT - a physical connection to the PLC from an input device (switch or sensor, etc.).

Allen-Bradley uses the capital letter “I” to designate a hardwired input. An address that describes an input on an SLC 500 is I:4/0.

Similar to the output structure,

I:4/0 means that it is a physical input.I:4/0 means that it uses Slot 4 (the 5th slot in the rack).I:4/0 means that it is the first input on the card.

Don’t get the capital “I’s” confused with ones.

HARDWIRED OUTPUT - a physical connection from the PLC to an output device (relay or pilot light, etc.) As was said above, an address that references an output of an SLC 500 is O:5/0.

INTERNAL COIL This is a programmable bit used to simulate a relay within the PLC. The internal coil has no connection to the outside world. It does not connect to an output card. Internal coils are used to store information. The “contacts” of this “relay” can then be used multiple times in other parts of the program.

In RSLogix, the “B3” (binary) file is commonly used for all the internal coils. There are many other words in other files that have bits you can use as internal coils, but we are going to stick with the B3 file for our application.

B3:0/0 means that it references an internal Binary fileB3:0/0 means that it uses the first word in the tableB3:0/0 means that it is the first bit in the word.

Note that, unlike the Output and Input files, you have to use the file number in the address. In this case, the default file number is 3.

TIMERA timer is a programmable instruction that lets you turn on or turn off bits after a preset time.

PLC Programming with RSLogix 500 6Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 11: PLC Programming With RSLogix 500_shared

The two primary types of timers are TON for “timer on delay” and TOF for “timer off delay”.

Timers in A-B SLC and MicroLogix processors use file 4 for their timers.

T4:0 means that it references an internal Timer fileT4:0 means that it uses the first timer in the table

The address T4:0 simply refers to the timer. Each timer has bits that turn on after the timing function is complete. You can address this bit by simply putting a “/DN” after the timer address. DN stands for “done”.

For example, if timer T4:0 is a TON (timer on delay), then the bit T4:0/DN will turn on after the timer has reached its preset value.

COUNTERA counter is a programmable instruction that lets you turn on or turn off bits after a preset count has been reached.

There are different types of counters available in the RSLogix, but the CTU (counter up) instruction covers everything we will talk about here.

Counters in A-B SLC and MicroLogix processors use file 5.

C5:0 means that it references an internal Counter fileC5:0 means that it uses the first counter in the table

The address C5:0 simply refers to the counter. Each counter has bits that turn on after the counting function is complete. You can address this bit by simply putting a “/DN” after the counter address. DN stands for “done”.

For example, if counter C5:0 is a CTU (counter up), then the bit C5:0/DN will turn on after the counter has reached its preset value.

--] [-- Normally Open ContactWhen used with a hardwired input, this instruction is off until there is a voltage applied to the input. The bit address then goes high, or on, and the instruction becomes “true.” It works the same way when it has the same address as an internal coil, except that the coil must be turned on by logic in the program.

Allen-Bradley calls these normally open contacts “XIC”, or “eXamine If Closed” instruction.

An XIC instruction can reference a hardwired input, a hardwired output, an internal coil or a timer done bit, among others.

PLC Programming with RSLogix 500 7Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 12: PLC Programming With RSLogix 500_shared

--]/[-- Normally Closed ContactThis is an inverted normally open contact.

When used with a hardwired input, this instruction is "true" until there is a voltage applied to the input. It then goes low, or off, and becomes “false.”

It also can be used with an internal coil, becoming true when the coil is off and becoming false when the coil is on.

Allen-Bradley calls these normally closed contacts “XIO”, or “eXamine If Open” instructions.

-( )- Output CoilWhen used with a hardwired output, this function is off until the logic in the program allows it to turn on. It then becomes “true”, and will energize the device that is wired to the respective output.

If it is used as an internal coil, it will toggle the instructions associated with it. That is, it will close a normally open instruction and open a normally closed instruction.

Allen-Bradley calls these outputs “OTE”, or “OutpuT Energize”.

An OTE may be used with a hardwired output or an internal coil.

TRUE - A state that indicates an instruction is allowing logic to “flow” through it.

Also, if the logic in a rung turns on the output of the rung, then the rung is said to be true.

FALSE - Without stating the obvious, this is the opposite of true.

OK, that was a lot to cover and for you to understand – don’t worry, this will start getting easier.

PLC Programming with RSLogix 500 8Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 13: PLC Programming With RSLogix 500_shared

Equivalent LogicSuppose we want to use a PLC to operate a pilot light. In its elementary form, PLC logic is very similar to the hard-wired logic you would find in an electrical ladder diagram.

For example, if you wanted to turn on a light with a momentary pushbutton, you would wire it like the circuit below. When you press PB1, the pilot light PL1 lights up.

H N | PILOT | | LIGHT | | PB1 PL1 | |---] [---------------------------------------(L)----| | | |

Now let's do the same thing in an SLC. To duplicate the hardwired circuit on a PLC, you would wire the switch PB1 to input I:4/0 and wire the light PL1 to output O:5/0.

The I/O (hardwired inputs and outputs) is set up like this:

- There is a “PB1” pushbutton switch wired to I:4/0 of the PLC.- There is a “PL1” pilot light wired to O:5/0 of the PLC.

In RSLogix 500, the screen would look like this.

Now let’s examine the sequence of events. When you first turn on the PLC, the PB1 pushbutton is off, or false. Therefore, the PL1 output is off. Pressing PB1 will make I:4/0 true, O:5/0 will come on and the light will be energized. It will stay on only as long as you hold the button in.

Just like electrical current has to flow through the switch to turn on the light in the hardwired circuit, the logic has to "flow" through the normally open instruction (which is “closed” when you press the switch) of I:4/0 to energize the output that turns on PL1.

PLC Programming with RSLogix 500 9Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 14: PLC Programming With RSLogix 500_shared

The green highlight indicates the instruction is “on” or “true”.

One nice feature of Allen-Bradley PLCs is that you can document each bit in the program. In the example above, “INPUT1” is somewhat meaningless on its own. After you add the descriptive text “Start Motor PB1”, things make more sense.

Scan Time

One critical difference between a PLC program and the equivalent electrical circuit is the issue of scanning. It works like this:

The PLC looks at the state of the inputs, and stores that information in a temporary buffer. Then, it ignores what is happening electrically at the inputs. The PLC will use the information in the temporary buffer to execute the logic in the program. It will solve the logic from top to bottom, determining the truth of each rung, and turn on or turn off the appropriate addresses in the temporary buffer.

When it reaches the last rung in the program, the PLC will use the data in the temporary buffer to turn on or turn off the corresponding outputs. The scan cycle is complete, and the PLC will once again look at the inputs. The amount of time this takes is called scan time, and is measured in milliseconds.

Stated more simply, the PLC reads the inputs, performs the logic and adjusts the outputs as needed.

Here’s the difference: An electrical circuit has events occurring simultaneously – a PLC performs its logic in steps.

The very best way to learn a programming language is to see a real world application of a working program. You can see how things are done and refer to the program in the future as you write or edit your own programs.

PLC Programming with RSLogix 500 10Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 15: PLC Programming With RSLogix 500_shared

Project ScopeWe will use a batching operation as an example. Batching, as you may know, is the term that describes the mixing of assorted ingredients to make a finished product.

There are techniques that are common to batching, whether you are making soap or cake mix. We are going to write a program that mixes a hypothetical window cleaner.

Someone has to define the batching procedure. Usually, this is done by a process engineer or a chemical engineer. If the job of defining the project is done well, a document called a Project Scope (or something similar) is generated.

It is extremely important that you clearly understand the entire process that is defined in the scope. If you have any questions or concerns, you need to resolve those before you begin programming. If you don’t, then the responsibility of errors and omissions, and perhaps the blame, may be placed on you.

If you bring up questions that result in changes to the defined sequence of operations, ask the originator to revise the Project Scope. In fact, it is not uncommon for a Project Scope to undergo a number of revisions.

If there is a change that is not documented in the scope, you should document it by getting an email from the originator that explains the change. If nothing else, you want to make sure you understand what the change involves.

For our project, the project scope is as follows.

PLC Programming with RSLogix 500 11Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 16: PLC Programming With RSLogix 500_shared

Hyper-Glass CleanerBatching Project Scope

GoalThe goal of this project is to install a new automated batching system for mixing Hyper-Glass Cleaner.

Overview

Three ingredients (city water, ingredient QR and ingredient KM) are added in specified amounts by weight to the Mixing Tank. After all the ingredients have been added to the Mixing Tank, the mixture is blended by running the agitator for a given time. When the blending time is complete, the finished product is pumped to the Filling Lines for bottling and final packaging.

PLC Programming with RSLogix 500 12Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 17: PLC Programming With RSLogix 500_shared

Component FunctionValve AV-CW Supplies city water to the Mixing Tank

Limit Switch LS-CW1 Indicates when valve AV-CW is closed

Limit Switch LS-CW2 Indicates when valve AV-CW is open

Pump PUMP-QR Pumps ingredient QR to the Mixing Tank

Valve AV-QR Supplies QR to the Mixing Tank

Limit Switch LS-QR1 Indicates when valve AV-QR is closed

Limit Switch LS-QR2 Indicates when valve AV-QR is open

Pump PUMP-KM Pumps ingredient KM to the Mixing Tank

Valve AV-KM Supplies KM to the Mixing Tank

Limit Switch LS-KM1 Indicates when valve AV-KM is closed

Limit Switch LS-KM2 Indicates when valve AV-KM is open

Scales Provides the current weight of the ingredients in the tank to the PLC

Agitator MTR-MTA Blends the ingredients in the Mixing Tank

Pump PUMP-MT Pumps ingredient MT from the Mixing Tank

Valve AV-MT Supplies the finished product to the Filling Lines

Limit Switch LS-MT1 Indicates when valve AV-MT is closed

Limit Switch LS-MT2 Indicates when valve AV-MT is open

Ultrasonic Level Sensor ULS-1 Indicates the level in the Mixing tankSystem Components

PLC Programming with RSLogix 500 13Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 18: PLC Programming With RSLogix 500_shared

Operator Panel Layout

PLC Programming with RSLogix 500 14Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 19: PLC Programming With RSLogix 500_shared

Operator Panel ComponentsComponent FunctionSYSTEM READY pilot light PL1 Indicates the system is ready for batchingSYSTEM FAULT pilot light PL2 Indicates the system has a fault and is

stoppedSTART BATCH pushbutton switch PB1 Starts a new batchSTOP BATCH pushbutton switch PB2 Stops the batching processADDING WATER pilot light PL3 Indicates the system adding water to the

Mixing TankADDING QR pilot light PL4 Indicates the system adding ingredient QR

to the Mixing TankADDING KM pilot light PL5 Indicates the system adding ingredient KM

to the Mixing TankBLENDING pilot light PL6 Indicates the system is blending the

ingredientsPUMPING TO LINES pilot light PL7 Indicates the system is pumping the batch

to the Filling LinesE-STOP PB3 Immediately stops the entire system

Electrical Specifications

The Ultrasonic Level Sensor ULS-1 provides a 0-10VDC signal to the PLC.

The Scales provide a 0-10VDC signal to the PLC.

All other input signals are 120VAC.

All output signals are 120VAC. A “dry contact” type of output module is required.

Detailed Sequence of Operations

There are 5 steps in the Batching process:

1. Add City Water2. Add Ingredient QR3. Add Ingredient KM4. Mix the batch5. Pump the batch to the filling lines

To begin a new batch, the operator will verify that the “SYSTEM READY” pilot light is on and that the Mixing Tank is ready to receive ingredients.

PLC Programming with RSLogix 500 15Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 20: PLC Programming With RSLogix 500_shared

The operator will then press the “START BATCH” pushbutton to begin the batching process. The “SYSTEM READY” pilot light will turn off. No further operator input is required.

Step 1 – City WaterAutomatic valve AV-CW will open. The “ADDING WATER” pilot light will illuminate.

Valve AV-CW will remain open until 1275 lbs. of City Water is in the Mixing Tank. Valve AV-CV will close.

The state of AV-CW will be verified by limit switch LS-CW2. If LS-CW2 is not made within 2 seconds after the valve was told to open, a fault will be generated and the system will shut down. The pilot light “SYSTEM FAULT” PL2 will illuminate indicating that a fault has occurred.

LS-CW1 will verify that the valve is closed within 2 seconds after the valve was told to close. If the valve closure is not verified within 2 seconds, a fault will be generated, the system will shut down and PL2 will illuminate.

All valves and their respective limit switches will work in the manner described above.

After the City Water has been added, valve AV-CW will close and the “ADDING WATER” pilot light will turn off.

Step 2 – Ingredient QRValve AV-QR will be opened. After the valve position has been verified by LS-QR2, PUMP-QR will pump 390 lbs. of ingredient QR into the Mixing Tank. The “ADDING QR” pilot light will be illuminated while the pump is running.

After the ingredient QR has been added to the Mixing Tank, PUMP-QR stops and the “ADDING QR” pilot light will turn off. Valve AV-QR will close.

Step 3 – Ingredient KMValve AV-KM will be opened. After the valve position has been verified by LS-KM2, PUMP-KM will pump 173 lbs. of ingredient KM into the mixing tank. The “ADDING KM” pilot light will be illuminated while the pump is running.

After the ingredient KM has been added to the Mixing Tank, valve AV-KM will close. PUMP-KM will stop. The “ADDING KM” pilot light will turn off.

After LS-KM1 indicates the valve has been closed, the agitator motor MTR-MTA will start. The “BLENDING” pilot light will illuminate.

Step 4 – MixingThe agitator will run for 3 minutes. The “BLENDING” pilot light will illuminate.

After the agitator is finished, the “BLENDING” pilot light will turn off.

PLC Programming with RSLogix 500 16Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 21: PLC Programming With RSLogix 500_shared

Step 5 – Pump to filling linesValve AV-MT will open. After LS-MT1 indicates the valve is open, the “PUMPING TO LINES” pilot light will illuminate.

PUMP-MT will pump the entire batch to the filling lines. When the Ultrasonic Level Sensor ULS-1 indicates that the tank is empty, PUMP-MT will turn off, valve AV-MT will close and the batching cycle is complete. The “PUMPING TO LINES” pilot light will turn off and the “SYSTEM READY” pilot light will illuminate.

During every phase of the batching process, the liquid level must be monitored by the PLC. If the level rises to greater than 95% of that Mixing tank’s capacity, the system will generate a fault and the batching process must be halted.

The operator may press the “E-STOP” pushbutton PB3 to stop the process at any time.

END OF HYPER-GLASS CLEANER BATCHING PROJECT SCOPE

Summarizing the ScopeSo, what did we get from the scope? Let’s summarize:

First, 1275 lbs. of water will be added to the Mixing Tank. Then, 390 lbs. of QR will be added. The last ingredient is KM, of which we will add 173 lbs.

After all the ingredients are in the Mixing Tank, we have to blend it for 3 minutes.

After the batch is blended, we will pump the finished product in the tank to the filling lines.

We have to make sure all the valves open or close in less than 2 seconds. If they do not, then we need to shut down the process.

We need to turn on the appropriate pilot lights to indicate what stage the batching process is in.

We need to make sure the level in the Mixing Tank doesn’t get too high. If it does, we must shut down everything.

We need to make sure that the respective valves for the pumps are open before we turn on the pumps.

PLC Programming with RSLogix 500 17Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 22: PLC Programming With RSLogix 500_shared

Which PLC?There are certainly a number of factors that will determine which PLC you need. Without getting into all of those, let’s just say that an SLC 5/03 has plenty of processing power for this project and the cost is reasonable, so we will use one.

Before you can determine what modules, rack or power supply you need to buy, you will have to know what your I/O requirements are. This involves the very critical step of laying out your I/O.

A bit of advice here: Don’t skimp on this step. Make sure the I/O is right before you begin programming. A mistake or omission here will cost you ten-fold further down the road.

Lay Out The I/ONow we need to layout the I/O. This will tell us the addresses for the I/O points, what PLC modules we need and how the PLC modules need to be wired.

There are three types of signals in the batching system: 120VAC digital inputs (limit switches and pushbutton switches) 120VAC digital outputs1 (valves, motors and pilot lights) and analog 0-10VDC inputs.

List all of the components in the system that are connected to the PLC. Categorize each component according its type (digital input, digital output or analog 0-10VDC). It is best to do this in an Excel spreadsheet. I have provided one for this project – it is called IO_List.xls and is included in the files you downloaded.

Try to keep associated devices together. For example, the “ADDING WATER” pilot light should be near Valve AV-CW. This will make the electrical prints easier to read and also help to keep the PLC program organized.

This is a good time to call your local Allen-Bradley

representative and have him assist you in selecting the parts you need. He can work directly from your I/O listing and probably save you a bunch of time.

PLC Programming with RSLogix 500 18Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

1 Technically, the valves themselves are not 120VAC devices, but in this case, the solenoids that subsequently drive the valves are. Likewise, the motors that run the pumps and the agitators may not be 120VAC, but the control circuitry that operates the motors is 120VAC.

Page 23: PLC Programming With RSLogix 500_shared

Notice the “Descriptor” column. This is a statement providing a shorthand description of the device when the associated input is on, or true. We will use these descriptors in the actual PLC program.

Descriptors look like this in RSLogix 500.

I can’t stress how important it is to get the verbiage right in a descriptor. For example, let’s look at LS-CW1. This particular limit switch is normally open, but held closed when the valve is closed.

When the limit switch is closed, the input to the PLC will be on, or true.

If we used the descriptor

Limit SwitchLS-CW1

that wouldn’t tell us too much without referring to the prints. Plus, it is a little redundant, as we know it is a limit switch based on the “LS” prefix in the device name.

If, however, we use the descriptor

City WaterValve AV-CW

ClosedLS-CW1

then that tells us immediately, without referring to the prints, that the City Water valve is closed as indicated by the limit switch LS-CW1.

After you go online with a PLC, if an input is on, the symbol for the bit is highlighted. You can quickly realize the descriptor statement is currently true, as shown below.

PLC Programming with RSLogix 500 19Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 24: PLC Programming With RSLogix 500_shared

Now we must determine what input and output modules we need.

The Project Scope said that the Scales and the Ultrasonic Level Sensor provide 0-10VDC signals. We can use an Allen-Bradley 1746-NI4 Analog 4 channel Input Module. Make sure that the DIP switch on the module is set for 0-10VDC (the same module can be configured to read 4-20mA signals).

For the inputs, we can use the 1746-IA16 120VAC Input module. Since 11 inputs are needed for the system, this card will provide 5 spares.

You might recall from the Project Scope that contact output modules are required. We will use the 1746-OW16 16-output relay module here. However, since 15 outputs are required by the system, that only leaves us one spare. It is best to buy and install two modules.

Now we can see that four modules will provide the I/O we need to operate the system. The next part we need to determine is the rack. SLC racks come with 4, 7, 10 or 13 slots. Since the processor consumes one slot, the best choice is the 1746-A7 7-slot rack. That will give us two spare slots.

The final choice is the rack power supply. RSLogix will help you determine what power supply is needed, but it would be best to consult with your A-B rep on this – again, save time and hassles.

Laying Out The Modules In The RackThe processor must go in Slot 0. It seems logical to put the analog card in the next slot.

Most engineers like to put the output cards to the far right, so we will put the OW16s in Slot 6 and Slot 7.

That leaves a gap of three slots in the middle of the rack. Since there is a good chance that additional analog card might be needed in the future, we will put the remaining IA-16 in Slot 5, next to the outputs.

The bottom line here is that, with the exception of the processor, it really does not matter where you place the modules. It is more a matter of personal taste, and what layout you think will be easiest to troubleshoot while allowing for future expansion.

PLC Programming with RSLogix 500 20Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 25: PLC Programming With RSLogix 500_shared

Assigning I/O AddressesHere is the final layout for the cards in the rack:

Slot 0 – SLC 5/03Slot 1 – 1746-NI4 Analog 4 Channel Input ModuleSlot 2 – emptySlot 3 – emptySlot 4 – 1746-IA16 120VAC Input ModuleSlot 5 – 1746-OW16 Relay Output ModuleSlot 6 – 1746-OW16 Relay Output Module

Look at the I/O List spreadsheet. The first address we need to assign is the input for the Scales.

Analog InputsAddressing some analog modules is a little different from addressing digital modules.

The NI4 has four inputs and uses one word for each input. The first input starts with 0 and the module is in Slot 1, so the address for the first input is I:1.0.

I:1.0 means that it is a physical inputI:1.0 means that it uses Slot 1 (the 2nd slot) in the rackI:1.0 means that it is the first input on the card.

The Ultrasonic Level Sensor uses the second input. Its address is I:1.1.

The address for the third input is I:1.2. The fourth input is I:1.3. Since we don’t need those for this project, they are labeled as spares.

The analog inputs for this project are as follows:

Component Signal/Module Type Slot AddressScales 0-10VDC Input 1 I:1.0Ultrasonic Level Sensor ULS-1 0-10VDC Input 1 I:1.1spare 1 I:1.2spare 1 I:1.3

PLC Programming with RSLogix 500 21Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 26: PLC Programming With RSLogix 500_shared

Digital Inputs

Our first digital input starts in Slot 4. Therefore, our first input will be I:4/0.

I:4/0 means that it is a physical inputI:4/0 means that it uses Slot 4 in the rackI:4/0 means that it is the first input on the card.

Don’t confuse capital “I” with “1”.

As a side note, RSLogix 500 lets you display the same address in a couple of different ways. You can display the first bit in Slot 4 as:

I:4/0 (known as slot/bit)

or

I:4.0/0 (known as slot word/bit)

This is configurable in RSLogix. We will see how to do that in a few moments.

Most people prefer the slot/bit method of displaying I/O addresses, so that is what we will use.

The digital inputs for this project are as follows:

Component Signal/Module Type Slot AddressSTART BATCH pushbutton switch PB1 120VAC Input 4 I:4/0STOP BATCH pushbutton switch PB2 120VAC Input 4 I:4/1Limit Switch LS-CW1 120VAC Input 4 I:4/2Limit Switch LS-CW2 120VAC Input 4 I:4/3Limit Switch LS-QR1 120VAC Input 4 I:4/4Limit Switch LS-QR2 120VAC Input 4 I:4/5Limit Switch LS-KM1 120VAC Input 4 I:4/6Limit Switch LS-KM2 120VAC Input 4 I:4/7Limit Switch LS-MT1 120VAC Input 4 I:4/8Limit Switch LS-MT2 120VAC Input 4 I:4/9spare 120VAC Input 4 I:4/10spare 120VAC Input 4 I:4/11spare 120VAC Input 4 I:4/12spare 120VAC Input 4 I:4/13spare 120VAC Input 4 I:4/14

PLC Programming with RSLogix 500 22Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 27: PLC Programming With RSLogix 500_shared

E-STOP PB3 120VAC Input 4 I:4/15

Digital Outputs

Our first digital output is in Slot 5. That makes the first output O:5/0.

O:5/0 means that it is a physical outputO:5/0 means that it uses Slot 5 in the rackO:5/0 means that it is the first output on the card.

Don’t confuse capital “O” with “0”.

In our project, the first output is for the SYSTEM READY pilot light PL1. Its address is O:5/0.

The digital outputs for this project are as follows:

Component Signal/Module Type Slot AddressSYSTEM READY pilot light PL1 120VAC Output 5 O:5/0Valve AV-CW 120VAC Output 5 O:5/1ADDING WATER pilot light PL3 120VAC Output 5 O:5/2Valve AV-QR 120VAC Output 5 O:5/3Pump PUMP-QR 120VAC Output 5 O:5/4ADDING QR pilot light PL4 120VAC Output 5 O:5/5Valve AV- KM 120VAC Output 5 O:5/6Pump PUMP-KM 120VAC Output 5 O:5/7ADDING KM pilot light PL4 120VAC Output 5 O:5/8Agitator MTR-MTA 120VAC Output 5 O:5/9BLENDING pilot light PL6 120VAC Output 5 O:5/10Pump PUMP-MT 120VAC Output 5 O:5/11PUMPING TO LINES pilot light PL6 120VAC Output 5 O:5/12Valve AV-MT 120VAC Output 5 O:5/13spare 120VAC Output 5 O:5/14SYSTEM FAULT pilot light PL2 120VAC Output 5 O:5/15

A final note about the I/O list – take the time to do it right and keep it updated as the project progresses.

PLC Programming with RSLogix 500 23Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 28: PLC Programming With RSLogix 500_shared

Installing RSLogixThere are a number of versions of RSLogix that are used with the many PLCs Rockwell offers. We are going to reference RSLogix 500 in this book, as that is the software used to program the SLC 500 PLCs.

Most Rockwell software uses a copy protection scheme that involves the use of an “activation file”. RSLogix 500 uses this. You can install the software, but functions will be limited without the activation file.

Activation files are first installed from the master disk supplied by Rockwell. They can be moved from computer to computer, or back to the original master disk. The idea is that Rockwell knows that hardware changes, so that if you want to replace an old computer that you use for programming, you can move the activation file from the old computer to your new one without buying a new activation file.

An alternative is to download the RSLogix Starter Kit. This software applies only to the MicroLogix series, but it is very similar to the software used to program the SLCs.

Installing RSLogix 500

The installation of the software is straightforward. Put the disk in the drive and follow the prompts. The only catch is that it will ask you for a serial number. Though any 10-digit number will work, you should use the number assigned to your company by Rockwell. This is the number that Rockwell Technical Support will reference if you call them with a question.

PLC Programming with RSLogix 500 24Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 29: PLC Programming With RSLogix 500_shared

Running RSLogixTo run RSLogix, click:

Start > All Programs > Rockwell Software > RSLogix 500 English > RSLogix 500 English

A quick side note about conventions used in this book:

We are going to use the format shown above to indicate what menu items you should click on as you navigate the menus and sub-menus.

For example, the line above means:

Click on “Start”.

Click on “All Programs”.

Click on “Rockwell Software”.

Click on “RSLogix 500 English”.

Click on “RSLogix 500 English”.

PLC Programming with RSLogix 500 25Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 30: PLC Programming With RSLogix 500_shared

You will see this on your monitor.

Now choose

File > New

In the Processor Name field, type in “BATCHING”.

PLC Programming with RSLogix 500 26Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 31: PLC Programming With RSLogix 500_shared

Scroll down in the window and select “1747-L532C/D 5/03 CPU – 16K Mem. OS302”.

PLC Programming with RSLogix 500 27Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 32: PLC Programming With RSLogix 500_shared

Click “OK” and this screen will appear.

On the left, you see an explorer-type menu. This is called the Project tree. All of these folders and files allow you to configure or view properties of the PLC or data files within the PLC.

PLC Programming with RSLogix 500 28Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 33: PLC Programming With RSLogix 500_shared

The first thing we need to do is configure the I/O. Double-click on “IO Configuration”.

In the first “Racks” drop-down menu, choose “1746-A7 7-Slot Rack”.

Now, we need to define what I/O modules we are using. The box on the left shows the 7 slots that are available in our rack. Slot 0 (the first slot) is used by the processor.

In referring to our I/O spreadsheet, Slot 1 is reserved for the analog input module. In the Current Cards Available window to the right, scroll down until you find “1746-Ni4 Analog 4 Channel Input Module”. Double-click on it and you will see that it has been moved to the window on the left and now occupies Slot 1.

Again, looking at our I/O spreadsheet, we see that Slots 2 and 3 are not used.

Click on Slot 4 so that it is highlighted. In the Current Cards Available window, scroll until you find “1746-I*16 Any 16pt Discrete Input Module”. Double-click on it and it is shown in Slot 4.

Make sure Slot 5 is highlighted and find “1746-O*16 Any16pt Output Module”. Double-click on it so that it shows up in Slot 5.

Double-click on it again and it will appear in Slot 6.

If you want to remove a card, highlight the card and press the “Delete” key,

PLC Programming with RSLogix 500 29Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 34: PLC Programming With RSLogix 500_shared

When you are finished, your configuration should look like this:

The “Power Supply” button will help you select the right power supply for the rack based on the modules you have specified, but it is best to contact your Rockwell representative to help you with this.

If you are online for the first time with a PLC, the “Read IO Config” button will tell you how the PLC’s I/O is configured.

The “Adv Config” button allows you to perform advanced configuration functions for each card. In this case with our modules, there is no need to change any of the default values.

When you are done with the I/O configuration, close the window. Your settings will be saved and you will see the main programming screen.

PLC Programming with RSLogix 500 30Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 35: PLC Programming With RSLogix 500_shared

Configuring Colors, Fonts and Address Display

This is something that you can certainly configure to your own liking. However, I prefer to change the defaults as follows to make the display easier to read when I am online.

Select

View > Properties > Colors

In the “Set Colors for:” window, click on “Descriptions”. Choose white as a background color.

Select the “Fonts” tab. Depending on your monitor, you may prefer something else, but I like Arial. Select the font size of your choice and click “OK”.

Select the “Address Display” tab.

Choose “Single Line” for “Bit Address Format”.

Choose “Word/Bit” for “Binary Bit Display Mode”.

Choose “Slot/Bit” for “I/O Bit Display Mode”.

Adding Descriptors To Your I/O

A descriptor is the text that is associated with any instruction, such as an XIO, XIC, timer or counter. These are essential when you are writing or trouble-shooting a program.

In RSLogix, find the output file O0 – OUTPUT in the Data Files folder and double-click on it. The screen below will appear.

PLC Programming with RSLogix 500 31Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 36: PLC Programming With RSLogix 500_shared

Scrolling to the right or stretching out the window will reveal what type of card is configured for each slot.

Output O:5/0 is highlighted, so you can double click on the “Desc:” box to type in the description.

However, since you did your work in advance, there is an easier and more accurate method.

Open your I/O List spreadsheet.

Copy the descriptor for the spreadsheet for O:5/0. You may need to put a return in to get the device name to appear by itself on the bottom line.

Click “OK”.

Now click on the next position to the left in the Data File. This is output O:5/1, and is indicated in the field just below the scroll bar.

Double-click on the “Desc:” field and copy and paste the descriptor for O:5/1 from your spreadsheet into the box. Again, you may have to insert a hard return here or there to get it to appear the way you would like.

Continue in this manner until you have entered all the descriptions for the outputs. Close the window.

If the windows on the main screen are

rearranged accidentally, choose:

Window > Arrange > Default Project > OK

and the normal view will be restored.

PLC Programming with RSLogix 500 32Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 37: PLC Programming With RSLogix 500_shared

Now find the input file I1 – INPUT in the Data Files folder and double-click on it.

This looks a little different from the output file. It is because we have an analog input card. Again, scrolling to the right or stretching out the window will reveal what type of card is configured for each slot.

The first line showing address I:1.0 is for the first channel of the Analog NI4 card. In our case, this is where the Scales for the Mixing Tank will be wired. Since it is a word we will be seeing, and not just one bit, we want to add the descriptor to the entire word.

In the “Offset” column, click on “I:1.0”. The whole line will be highlighted. Now double-click on the “Desc:” field and paste the description from the spreadsheet for the Scales. Click “OK”.

Click on “I:1.1” to add the description for the Ultrasonic Level Sensor.

We are not using channels 3 and 4, so we can go to the discrete inputs.

Click on the “0” in the lower right of the table so that I:4/0 shows up in the box. Add the descriptor just like you did for the outputs. Continue until you have all the inputs labeled. Close the window.

You can enter descriptors for Binary (B3) files, Timer (T4) files, Counters (C5) and so in the same way. If you know how these files are going to be laid out then it is a good idea to add descriptors now. In our case, we will add descriptors to these bits and files as we program.

PLC Programming with RSLogix 500 33Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 38: PLC Programming With RSLogix 500_shared

Writing the Program

Setting Up An Overall Control Rung

Typically, a program will start with some kind of overall or master control rung. This rung will define a bit that must be on for the entire system to operate, and we include bits that we know must be true for the whole system to run.

In this project, we certainly want the E-Stop to be part of this logic. Our E-Stop (or, emergency stop) pushbutton switch is wired in such a way that the input must be on for the system to operate.

Make sure you have the default view displayed in RSLogix. It will show one rung with the (END) instruction all the way to the right. This rung cannot be deleted or edited.

We need to insert a new rung. Right-click in the LAD 2 window on the rung number 0000. A menu will appear. Choose “Insert Rung”.Your screen should look like this:

We want to use the E-Stop input in this rung. Find the XIC (examine if closed) tool button in the User menu.

Click and drag it toward the new rung you just created. You will see that as you get near the rung, two red squares will appear. These are possible landing points for your instruction. Move

PLC Programming with RSLogix 500 34Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 39: PLC Programming With RSLogix 500_shared

your pointer toward the one on the left. As you get near it, the square will change color from red to green. Release the mouse button and your screen should look like this.

Press the enter key on your keyboard. Type in the address of the E-Stop pushbutton input, which is I:4/15. Your screen now looks like this.

Notice how the instruction descriptor appeared automatically.

Remember that we want to create the logic for a bit that must be on if the system is to run. We will use an internal bit from the B3 file.

Click and drag the OTE (output energize) tool button from the User menu down to the new rung. Place it on the marker at the far right.

PLC Programming with RSLogix 500 35Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 40: PLC Programming With RSLogix 500_shared

Press enter. Type the address B3:0/0 and press enter. This is the first bit in the B3 file, and since this bit has a lot of importance in our program, that is appropriate.

The address description box appears automatically. Type “System Enable” into the box.

We know from the Project Scope that the system must stop if there is a fault. We are not sure of the details of all those faults yet, but we do know that we will summarize those faults somewhere in the program. It will result in a bit. We will use the address B3:0/1 for that bit. We also know that we want the “System Enable” to be on if we do not have a fault.

Bear with me here and it will make sense. Click and drag the XIO (examine if open) tool button

from the User menu down to the new rung. Place it just to the right of the E-stop input. Press enter and type B3:0/1. Press enter and type “System Fault” in the descriptor box.

It should look like this:

Let’s see what we have. The logic of the rung works just like an electrical circuit. If the E-Stop is cleared and there is not a System Fault, the System Enable bit will be on. That is exactly what we want. We will work out the fault logic later.

Notice that the System Fault bit is highlighted. That means the XIO instruction is true; that is, there is currently no system fault.

PLC Programming with RSLogix 500 36Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 41: PLC Programming With RSLogix 500_shared

The last thing we need to do is verify the rung. Right-click on the rung number and choose “Verify Rung”. Notice that the lower case “e” will disappear.

Starting a Batch Cycle

The Project Scope said that the operator may start a batch by pressing the “Start Batch” pushbutton on his console. Let’s start with that input.

Right-click on the last rung and choose “Insert Rung”. Click

and drag the XIC (examine if closed) tool button from the User menu to the left side of the new rung. Enter the address I:4/0.

Click and drag the OTE (output energize) tool button from the User menu down to the new rung. Place it on the marker at the far right. We are creating a new bit that indicates the system is currently batching. Enter the address B3:0/2. Label this bit “System Batching”.

If the operator chooses, he may stop the batch. We will make use of the “Stop Batch” pushbutton. Click and drag the XIO (examine if

open) tool button from the User menu down to the new rung. Enter the address I:4/1.

We don’t want the operator to be able to start a batch if the System Enable bit is not on. We will add that by dragging the XIC (examine if closed)

tool button to the left side of the new rung. Enter the address B3:0/0.

This rung will work much like a traditional motor starter circuit that uses a contact from the motor starter wired in parallel with the start button to hold in the coil. In the PLC, the “contact” is an XIO with the same address as the “coil”, which is B3:0/2.

We need to “wire the contact” in parallel with the start button. We do this with a branch

instruction. Drag the Branch tool button and place it on the marker between the System Enable bit and the Start Batch bit.

It is a good idea to save

your work frequently.

This is done in RSLogix

like it is in any other Windows

program, CTRL-S or File > Save

You can also insert a rung by clicking on the rung number and pressing the “insert” key. You can

select a rung and choose

Edit > Insert Rung.

There are a number of ways to perform many functions in RSLogix. Throughout the remainder of this book, I will use what I believe is the easiest method for you to understand and remember.

PLC Programming with RSLogix 500 37Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 42: PLC Programming With RSLogix 500_shared

It will look like this.

We want the branch to go around the Start Batch bit. Now click and drag the right side of the branch to marker just to the right of the Start Batch bit.

PLC Programming with RSLogix 500 38Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 43: PLC Programming With RSLogix 500_shared

Release the mouse button and the branch will appear around the Start Batch bit.

PLC Programming with RSLogix 500 39Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 44: PLC Programming With RSLogix 500_shared

Click and drag the XIC (examine if closed) tool button from the User menu to the left side of the new branch. Type in the address B3:0/2.

This is called a latching rung. If the System Enable bit is on, the System Batching bit can be latched by momentarily pressing the Start Batch pushbutton. The System Batching bit will stay on and the rung will remain latched until the Stop Batch pushbutton is pressed or the System Enable bit goes off.

Thinking ahead, though, we know that the system will stop the batch automatically after it has pumped all the finished product to the filling lines. We are not sure how we will know that yet, but we know we need a bit to unlatch the rung.

Click and drag the XIO (examine if open) tool button from the User menu down to the marker just in front of the System Batching OTE instruction. Address it as B3:0/3 and type in the descriptor “Batch Complete”.

PLC Programming with RSLogix 500 40Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 45: PLC Programming With RSLogix 500_shared

Right-click on the rung number and verify the rung. It should appear like this.

PLC Programming with RSLogix 500 41Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 46: PLC Programming With RSLogix 500_shared

Batching StepsAs you recall from the project scope, there are a number of steps needed to create the finished product. They are:

1. Adding City water2. Adding chemical QR3. Adding chemical KM4. Blending the mixture with the agitator5. Pumping the finished product to the filling lines.

Step 1 – Adding City Water

We need to initiate Step 1. Before we do that, thought, we need to add another permissive bit. We will call that bit “System Ready”.

We know that if the system is enabled but not currently batching, it is ready to begin a batch. We need insert a new rung and create a “System Batching” and “System Ready” bit.

Insert a new rung and program it as shown in Rung 0002.

You can see how Rung 0002 should look in the picture below. The “System Ready” bit will be on when the system is enabled, but not batching.

PLC Programming with RSLogix 500 42Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 47: PLC Programming With RSLogix 500_shared

To actually initiate the batch and hold the batch in Step 1, we are going to use the Output Latch (OTL) instruction. This instruction works in conjunction with the Output Unlatch (OTU) instruction. The instructions will work on the same bit address, but are typically found on different rungs.

The batch will be started when the operator pushes the Start Batch button. We will latch that bit and label it Step 1.

As a side note, I am going to skip a few addresses in the B3 file. It is always a good idea to leave a gap here and there in the event that you need to add a bit later. It doesn’t affect the operation of the program, but it makes the data files more organized and easier to troubleshoot.

Insert a new rung at the bottom of the ladder. We need an XIC for the System Ready bit and an XIC for the Start Batch pushbutton at the beginning of the new rung.

Click and drag the XIC (examine if closed) tool button from the User menu to the left side of the new branch. Type in the address B3:0/2 and press enter.

To save some typing, you can copy and paste instructions. Highlight the Start Batch instruction in Rung 0001.

Press CTRL-C.

Click on the rung number for Rung 0003.

Press CTRL-V. The instruction is duplicated on Rung 0003. Copy and paste bit in the same way

Click and drag the OTL (output latch) tool button from the User menu to the right side of the new branch. Type in the address B3:0/10 and add the descriptor “Batch Step 1”.

PLC Programming with RSLogix 500 43Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 48: PLC Programming With RSLogix 500_shared

However, what if the button is pressed if the system is already batching and in another step? To prevent that from happening, we will make sure that the only way the system can enter Step 1 is if it is not in another step already. Add a series of XIO instructions. Address them from B3:0/11 to B3:0/14. Type in the appropriate descriptors. Verify the rung.

PLC Programming with RSLogix 500 44Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 49: PLC Programming With RSLogix 500_shared

You can see how RSLogix handles rungs that are too long to be displayed on one side. You can compensate for this by maximizing the LAD 2 window, or stretching it to the left. Remember that if you want to return to the default view, choose Window > Arrange > Default Project.

You may wonder why we chose not to use the OTL output latch instruction in Rung 0001. Many times, it is a matter of personal choice; sometimes a “traditional” latch rung is better than using an OTL. In Rung 0001, we were able to keep all the logic affecting the System Batching bit on one rung. This makes it easier to read and a little more condensed. Some people view a traditional latch as a bit safer. It’s your call, though.

Analog Inputs

Before we continue with Step 1, we need to program the Mixing Tank Scales and the Ultrasonic Level Sensor. Since the logic associated with these devices is not necessary tied to Step 1, but common to the entire program, let’s put them in a sub-routine.

PLC Programming with RSLogix 500 45Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 50: PLC Programming With RSLogix 500_shared

We do this by right-clicking on “Program Files” in the Project menu on the left and choosing “New”. The Name is limited to 11 characters, so we will call it ANALOG. The description will be “Mixing Tank Scales and Level Sensor”. Click OK.

That reminds us that we did not name LAD 2. Let’s do that right now. Right-click on LAD 2 and choose Rename. We will call it MAIN.

LAD 2 is, by default, the program that will run when the SLC is first powered up. Like subroutines in other programs like Visual Basic or C, we need to tell the main program to execute the sub-routine.

We need to put a JSR (jump to subroutine) instruction in LAD 2. In this case, it really doesn’t matter where it is placed, but putting it at the top makes sense.

Insert a rung at the top of the ladder. In the Instruction menu, click on the right arrow until the “Program Control” tab is shown. Click on the tab.

Drag the Jump to Subroutine (JSR) tool button to your new rung. Type in a “3” to tell the instruction to go to LAD 3.

Add the descriptor “Mixing Tank Scales and Level Sensor”. Verify the rung.

In the Project menu, double-click on LAD 3 – ANALOG. This opens the new ladder file you just created. Insert a new rung.

PLC Programming with RSLogix 500 46Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 51: PLC Programming With RSLogix 500_shared

We are going to enter an instruction in a new way. Double-click on 0000 for Rung 0000. This opens up the ASCII editor.

Type SCP in the box and press enter. SCP stands for “Scale with Parameters”. It allows you to take an analog input from a sensor and scale it to the output units you want.

Before we start scaling, let’s take a moment to see how the Allen-Bradley NI4 converts a 0-10VDC signal to a number. The NI4 is an analog-to-digital processor that takes the 0-10VDC signal and converts it to a number between 0 and 16384.

The NI4 will yield a number from 0 to 16384 that is directly proportional to the 0 to 10VDC signal that is applied at the input.

In other words, zero volts on the input of the NI4 means that the NI4 will provide 0 as a value to the PLC. Ten volts on the input will yield 16384. Five volts on the input will yield half of 16384, or 8192, and so on.

PLC Programming with RSLogix 500 47Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 52: PLC Programming With RSLogix 500_shared

The SCP instruction starts out looking like this.

Each of the six parameters (Input, Input Min., Input Max., Scaled Min., Scaled Max. and Output) has two fields associated with them. Each field is currently filled with a question mark. The first field is a value that you assign. The second field is the actual value returned by the processor.

Setting up an SCP to calculate Tank WeightThe Input parameter is the value that will be scaled. Let’s use this SCP instruction for the Scales. The input we will use is the address we assigned to the analog input card; that is, I:1.0.

The Input Min parameter is the value that is read by the analog card when there is no liquid in the tank. With our scales, this value is 0.

The Input Max is the value that is read by the card when the tank is full. Our Mixing tank weighs 2000 lbs. when it is full of liquid. We measured the voltage that the Scale put out when the tank was full and found it to be 10 volts.

So, in this case, 2000 lbs. in the tank equals 10 volts, which means the NI4 will read out 16384 when the tank has 2000 lbs. of liquid in it.

The Scaled Min parameter is the lowest value you want the SCP to calculate in the units you want. In this case, it is 0, and we are using pounds as our units.

PLC Programming with RSLogix 500 48Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 53: PLC Programming With RSLogix 500_shared

The Scaled Max parameter is the highest value you want the SCP to calculate. For the Scales in our project, it is 2000.

The Output parameter is typically an address where you want to store the result of the SCP. We are going to put it in the N7 file (integer). We will store it specifically in N7:0.

Here is how the SCP instruction for our Scales looks.

Admittedly, the numbers rarely work out like this, but for simplicity’s sake, I made them easy to work with.

The real beauty of the SCP is apparent after you go online. Let’s say that you couldn’t really calibrate the scales previously by using voltmeter.

After you go online, and you are getting live data from the SCP instruction, you can visually verify that the tank is empty.

Hoverer, you are reading 133 from the NI4. You simply enter 133 as the Input Min parameter.

When the tank is full, you see that the reading is 14733. Enter 14733 as the Input Max parameter and the SCP will calculate the rest for you.

The important thing to remember is that the value in N7:0 is the actual weight of the tank in pounds. We will use that when we program the setpoint logic.

PLC Programming with RSLogix 500 49Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 54: PLC Programming With RSLogix 500_shared

Setting Up An SCP To Calculate Tank Level

First, let’s insert a new rung and create an SCP the same way we did the first time.

This time, the Input will be I:1.1

The Input Min will be 0.

The Input Max will be 16384.

The Scaled Min is 0.

The Scaled Max is 100. We want to read the level of the tank as a percent of full.

The Output is stored in N7:1, with the descriptor “Liquid Level of Mixing Tank (%)”.

It looks like this.

There is one more rung we need to add to this ladder file. Do you remember the JSR instruction we used to get the program here? We have to tell it to go back.

PLC Programming with RSLogix 500 50Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 55: PLC Programming With RSLogix 500_shared

Insert a new rung and the RET (return) instruction.

Back to Batching – Step 1Click on the “Main” tab at the bottom on the Ladder window to return to the LAD 2 – MAIN file.

Now that we have our Scales working, we can add some water.

Insert a new rung at the bottom of the ladder.

We will open the city water valve in this rung, so we want to make sure that it is still safe and desirable to open the valve. That is, make sure that there are no faults, the E-Stop button has not been pressed and the Stop Batch pushbutton has not been pressed. Using an XIC with the System Batching bit will confirm all of that. Insert an XIC with the address B3:0/2.

Since we only want to open this valve and add city water in Step 1, insert an XIC with the address B3:0/10.

Insert an OTE for the city water valve (O:5/1).

Remember that we want to put 1275 lbs. of water in the Mixing Tank. We will use the LEQ (Less than or Equal To) instruction to accomplish that.

PLC Programming with RSLogix 500 51Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 56: PLC Programming With RSLogix 500_shared

Select the “Compare” tab on the instruction tool menu. Click and drag the LEQ tool button to the marker just to the left of the OTE.

Source A in the instruction is the Tank Weight, which is N7:0. Enter that address. Source B is our setpoint, which as you recall from the Project Scope is 1275 lbs. Enter 1275 for Source B.

The LEQ instruction will remain true as long as the tank weight does not exceed 1275 lbs.

After the correct amount of city water has been added, we need to proceed to Step 2.

PLC Programming with RSLogix 500 52Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 57: PLC Programming With RSLogix 500_shared

We will make use of the fact that we know the system is currently in Step 1, but the Mixing Tank has enough water (1275 lbs) to go to the next step.

We will use the OTU (Output Unlatch) instruction to turn off the bit we latched in Rung 0004.

Rung 0006 works like this:

The XIC instruction B3:0/10 Batch Step 1 is on. The Mixing Tank weight has reached the setpoint of 1275, so the GEQ (Greater Than or Equal To) instruction is also true. As a result, the bit B3:0/10 Batch Step 1 is unlatched (turned off) and B3:0/11 Batch Step 2 is latched (turned on).

Take a moment to make sure you understand how as the weight in the tank rises past 1275, the City Water valve is turned off and the system transitions to Step 2.

PLC Programming with RSLogix 500 53Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 58: PLC Programming With RSLogix 500_shared

Step 2 – Adding Chemical KM

Step 2 will be similar to Step 1, so rather than creating new rungs from scratch, we are going to copy and paste the rungs from Step 1.

Click on the rung number for Rung 0005. Hold the SHIFT key and click on the rung number for Rung 0006. Both rungs will be highlighted in red.

PLC Programming with RSLogix 500 54Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 59: PLC Programming With RSLogix 500_shared

Press CTRL-C.

Click on Rung 0007.

Press CTRL-V. You now have new rungs, 0007 and 0008.

We will start with rung 0007.

Change B3:0/10 to B3:0/11.

We will be looking for a setpoint of 1275 + 390, since there is already 1275 lbs. of water in the Mixing Tank and we need to add 390 lbs. of QR. Change Source B in the LEQ instruction to 1665.

Refer to your I/O list spreadsheet and note that the QR automatic valve is addressed as O:5/3. Change the OTE from O:5/1 to O:5/3.

In Rung 0008, change B3:0/10 to B3:0/11.

Change Source B in the GEQ instruction to 1665.

PLC Programming with RSLogix 500 55Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 60: PLC Programming With RSLogix 500_shared

Change the OTU (Output Unlatch) instruction from B3:0/10 to B3:0/11.

Change the OTL (Output Latch) instruction from B3:0/11 to B3:0/12.

It should look like this.

There is a major process difference between adding City Water and adding QR – the QR chemical needs to be pumped. This means that not only do we have to open a valve, but also we have to turn on a pump.

First, we want to make sure the valve is being instructed to open, so we will use an XIC from pump AV-QR in the logic. Next, we will wait to turn on the pump until the valve is verified to be open by limit switch LS-QR2. As a failsafe, we will look at limit switch LS-QR1 to make sure it is not indicating the valve is closed.

Right-click on Rung 0008 and choose “Insert Rung”.

So that you can learn a bit more about ASCII editing, we will construct the entire rung from the ASCII command line.

PLC Programming with RSLogix 500 56Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 61: PLC Programming With RSLogix 500_shared

Double-click on Rung 0008. The ASCII string input box appears. Type in the following string:

XIC O:5.0/3 XIO I:4.0/4 XIC I:4.0/5 OTE O:5.0/4

PLC Programming with RSLogix 500 57Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 62: PLC Programming With RSLogix 500_shared

Press enter and the instructions appear.

Verify the rungs.

Step 3 – Adding Chemical KM

Step 3 will have the same logic as Step 2, so will cut and paste to create new rungs.

Click on Rung 0007, hold down the SHIFT key and click on Rung 0009 to select the new rungs. Press CTRL-C. Click on the last rung and press CTRL-V.

Change all the addresses for the XIO and XIC instructions to match the new step.

We will be looking for a setpoint of 1665 + 173, since there is already 1665 lbs. of water in the Mixing Tank and we need to add 173 lbs. of KM. Change Source B in the LEQ instruction to 1838.

Change Source B in the GEQ instruction to 1838.

PLC Programming with RSLogix 500 58Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 63: PLC Programming With RSLogix 500_shared

Change the latch and unlatch outputs to increment the system to Step 4.

It should look like this after you have made the changes and verified the rungs.

Step 4 – BlendingAfter all the ingredients are in the Mixing Tank, we have to run the Agitator for 3 minutes.

We will set up a timer to run for 3 minutes. When the timer is done, we will increment the system to Step 5. That will turn off the Agitator.

Start by inserting a new rung at the bottom.

Insert an XIC instruction with the address of B3:0/2.

Insert an XIC instruction with the address B3:0/13.

PLC Programming with RSLogix 500 59Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 64: PLC Programming With RSLogix 500_shared

Click the “Timer/Counter” tab on the instruction tool menu. Click and drag the TON tool button

down to the right side of the new rung.

This type of timer is called a Timer On Delay. As soon as the instructions preceding it are true, it will begin timing. The Enable bit (EN) will turn on. After it reaches its Preset value, the Done bit (DN) will turn on.

First, we have to assign an address to the timer. All timers in RSLogix 500 use the T4 data file. They start with 0 and continue up until they reach they end of the data file. We will address this timer as T4:0.

Press enter and type T4:0.

Type “Agitator Run Time” for the descriptor.

There are a number of time bases available that interact with the preset and accumulated values. To find the total time that a timer will be timing, multiply the time base by the preset value.

We want to time for 3 minutes, or 180 seconds, so we will choose a Time Base of 1.0 and enter a preset of 180.

Select a Time Base of 1.0.

Double-click on the Preset field and type 180. Press enter.

Leave the accumulated value at 0, as this will be changed as the timer begins timing. The completed rung looks like this.

PLC Programming with RSLogix 500 60Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 65: PLC Programming With RSLogix 500_shared

To run the Agitator, insert a new rung at the bottom.

Click on the “User” tab of the tool button menu and drag an XIC instruction to the first marker of the new rung. We will use the Enable bit (EN) of the timer for the address.

To assign a timer’s enable bit, simply add the suffix /EN to the address. For this instruction, the address is T4:0/EN. Now add an OTE instruction with the agitator motor’s address, which is O:5/9.

The enable bit of a timer is on only when the timer is enabled. In Rung 0013, for example, if the System Batching bit turns off, or the Batch Step 4 bit turns off, the timer will no longer be enabled. Consequently, its enable bit, T4:0/EN will turn off.

PLC Programming with RSLogix 500 61Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 66: PLC Programming With RSLogix 500_shared

We will turn off the timer by incrementing the system to the next step when the timer is done.

PLC Programming with RSLogix 500 62Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 67: PLC Programming With RSLogix 500_shared

Insert a new rung at the bottom and drag an XIC to the first marker. We will assign the Done bit (DN) of the timer to this instruction. It is formatted just like the Enable bit, except you use /DN as the suffix. Address this instruction as T4:0/DN.

We will use the same method to increment the system to Step 5 that we have used previously.

Drag an OTU instruction to the last marker in the rung. Address the instruction to be Step 4, which is B3:0/13.

Insert a new branch around the OTU by dragging a Branch tool button to the marker in front of the output. Grab the right leg of the branch and move it to the marker after the output.

Insert an OTL instruction on the bottom of the branch and address it as B3:0/14.

Verify the rungs.

Now, when the timer is done and T4:0/DN turns on, it will unlatch Step 4 and start Step 5.

PLC Programming with RSLogix 500 63Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 68: PLC Programming With RSLogix 500_shared

Step 5 – Pump to Filling Lines

Since this step involves a pump, it will be similar to Step 3. Let’s save ourselves some typing and copy all of Step 3.

Click on Rung 0010. Hold down the SHIFT key and click on Rung 0012.

Press CTRL-C.

Click on Rung 0016 (the last rung). Press CTRL-V.

In Rung 0016, change B3:0/12 to B3:0/14.

Change the address of the output instruction to O:5/13.

We want to pump until the Mixing tank is empty.

We will use the Ultrasonic Level Sensor to determine if the tank has liquid in it. We will use a GEQ instruction to accomplish this.

Double-click on the “LEQ” text in the LEQ instruction. Type GEQ (for Greater than or equal to) in that space. Change Source A of the instruction to N7:1. This is the address of the scaled level sensor.

We may be tempted to put a value of 0 into Source B, but that could be risky. First, pumping the tank dry might be hard on the pump. Second, because of drift in the level sensor, we might never get a reading of zero in some instances.

The Process engineers have told us that emptying the tank to 3% is desirable. Put a 3 in for the value of Source B.

Change Rung 0017 to show the correct valve, limit switches and pump addresses.

Since this is the last step in the batching process, we will use Rung 0018 to increment out of Step 5 and complete the batching cycle.

Change the first XIC in Rung 0018 to B3:0/14.

Copy the GEQ instruction from Rung 0016. Click on the instruction, press CTRL-C and click on the GEQ instruction in Rung 0018. Press CTRL-V.

Delete the other GEQ from Rung 0018 (the one that references the tank weight).

PLC Programming with RSLogix 500 64Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 69: PLC Programming With RSLogix 500_shared

Change the remaining GEQ in Rung 0018 to a LEQ.

Change B3:0/12 to B3:0/14.

Right-click on the OTL (L) instruction in the bottom branch. Choose “Change Instruction Type” and make it an OTE. Change the address to B3:0/3. This is the “Batch Complete” bit.

Verify all the rungs and it should look like this.

When the system enters Step 5, the Mixing Tank will be nearly full. The GEQ instruction will be true and open the Mixing Tank valve.

When the valve has been opened and verified by the limit switches, the pump will run.

When the level in the tank drops to 3%, the valve will close and the Mixing Tank pump will stop.

PLC Programming with RSLogix 500 65Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 70: PLC Programming With RSLogix 500_shared

Simultaneously, the Batch Step 5 bit will be unlatched and the Batch Complete OTE instruction will be turned on. It will trip the latch in Rung 0002 and turn off the System Batching bit.

The system returns to its idle state and is ready to begin a new batch.

FaultsThe program may be complete in an operational sense, but we need to add the logic to detect faults.

Let’s create a new ladder file to do that.

Right-click on “Program Files” in the Project menu and choose “New”. Name the file “FAULTS” and enter “System Faults” as the description.

Double-click on the new ladder file.

Valve Position Faults

We were told in the Project Scope that the valve position must be verified by the limit switches within 2 seconds.

We will use an individual timer for each valve to accomplish this.

PLC Programming with RSLogix 500 66Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 71: PLC Programming With RSLogix 500_shared

Type in the logic as shown below.

We must accommodate the two conditions that indicate a fault. The first is that the valve was told to open, but did not open. The second fault condition is that the valve was told to close, but did not close.

Remember that the limit switches on the valves are electrically normally open and will be physically held closed by the valve when it is in position.

When the valve is open, we should not get a signal to the input I:4/2, as limit switch LS-CW1 is not activated by the valve.

PLC Programming with RSLogix 500 67Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 72: PLC Programming With RSLogix 500_shared

When the valve is closed, we should not get a signal to the input I:4/3, as limit switch LS-CW2 is not activated by the valve.

We use the XIO (examine if open) instruction. We want to know if we do not get a signal from the limit switches when we should. An XIO instruction used on an input will always be true if there is no signal on the input.

Let’s look at how it handles the first fault condition (the valve was told to open, but did not open).

The City Water valve output (O:5/1) is on but the limit switch LS-CW2 is electrically open. That means the XIO instruction for LS-CW2 in Rung 0000 is true. This creates an undesirable condition and the timer will begin timing.

PLC Programming with RSLogix 500 68Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 73: PLC Programming With RSLogix 500_shared

The screenshot below shows what the state of the instructions would be after 1 second of the valve being instructed to open, but LS-CW2 not yet being activated.

You can see that the City Water valve is being told to open, as O:5/1 is highlighted. You can also see that LS-CW2 says that the City Water valve is not open, as it is also highlighted. The timer has begun timing and has reached, or accumulated, 1 second.

If the timer reaches 2 seconds, the timer done bit T4:1/DN will come on and turn on the System Fault bit B3:0/1 in Rung 0001.

Since we used the System Fault bit B3:0/1 in Rung 0001 of the MAIN ladder, this will cause the “System Enable” bit to turn off.

Consequently, Rungs 0002 and 0003 of the MAIN ladder will become false and the system will stop batching.

Let’s look at the other condition; that is, the valve was told to close, but did not close.

PLC Programming with RSLogix 500 69Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 74: PLC Programming With RSLogix 500_shared

That is what is accomplished in the branch in Rung 0001. If the valve output (O:5/1) is not on but the limit switch is not activated, then the timer will begin and generate a fault.

Sometimes it gets confusing when you are working with the XIO instruction . The logic is inverted and you have to flip some things around in your head.

The logic we have used here to detect a valve fault is fairly standard and its use is widespread. The nice part about this logic is that it is pretty easy to troubleshoot. You can physically look at the valve to see if it is open or closed. Then, you can look at the input you are receiving from the limit switch. If you are getting a fault when you should not, then just invert the instruction for the limit switch. Change it from an XIO to an XIC, or vice versa.

Let’s create the fault timers for the remaining valves. This is the screenshot for the QR valve and KM valve fault logic.

PLC Programming with RSLogix 500 70Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 75: PLC Programming With RSLogix 500_shared

This is the screenshot for the Mixing Tank valve fault logic.

PLC Programming with RSLogix 500 71Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 76: PLC Programming With RSLogix 500_shared

Notice how the System Fault rung has grown.

PLC Programming with RSLogix 500 72Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 77: PLC Programming With RSLogix 500_shared

To complete our fault logic, we need to add the Liquid High Level alarm. We can achieve this with one GRT instruction in the System Fault rung. It is agreed that if the liquid level reaches 95% of the tank’s capacity, it will fault.

PLC Programming with RSLogix 500 73Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 78: PLC Programming With RSLogix 500_shared

Adding a return (RET) instruction completes the ladder.

Don’t forget to add a JSR instruction to the main ladder.

PLC Programming with RSLogix 500 74Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 79: PLC Programming With RSLogix 500_shared

Console Status Indicators – Pilot LightsI have held off putting the logic in for the Pilot Lights in an effort to keep the text as simple as possible. Now that you understand how the system operates, we can go back through the program and add the pilot lights.

The first is the System Ready PL1 pilot light. Find Rung 0003 in the MAIN ladder. Clicking twice on the rung number will open the rung for editing.

Insert a branch around the B3:0/4 System Ready output. Put an OTE instruction on the bottom rung of the new branch and address it O:5/0. With this logic, the light will come on when the System Ready bit is on.

We will add the remaining pilot lights in a similar fashion.

PLC Programming with RSLogix 500 75Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 80: PLC Programming With RSLogix 500_shared

Adding water

PLC Programming with RSLogix 500 76Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 81: PLC Programming With RSLogix 500_shared

Adding QR

Adding KM

PLC Programming with RSLogix 500 77Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 82: PLC Programming With RSLogix 500_shared

Blending

Pumping to Lines

PLC Programming with RSLogix 500 78Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 83: PLC Programming With RSLogix 500_shared

System FaultWe need to add a little logic to the System Fault pilot light. This light needs to stay on after it detects a fault; otherwise, the system will stop and the operator won’t know there was a fault.

We are using the STOP BATCH pushbutton to reset the fault light.

Add the rung as shown below.

Adding Rung CommentsA good rung comment explains in plain language what the rung is supposed to do. These are very valuable. First, it is a way to double-check your own work. I have been surprised at the number of times I have found a mistake in my logic as I was writing the rung comments!

Second, it helps a person who is unfamiliar with the program quickly learn how the program is supposed to work.

Finally, it adds value to your finished program. A well-documented program is worth more money to a client (or your company) than a program that is not documented.

PLC Programming with RSLogix 500 79Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 84: PLC Programming With RSLogix 500_shared

They can even get you out of a jam. If you have to troubleshoot a system 6 months after you first programmed it, I can guarantee that you will not remember every reason for every line of code you wrote. If you have written code in some other language before, you certainly can understand the value of documenting your work.

The default for RSLogix is to attach the rung comment to the rung number. This is fine until a rung is inserted above that rung. It is a much better practice to set the rung comment to be attached to the Output Address.Choose

Tools > Options... > System Preferences

and select “Output Address” for “Default Rung Comment/Page Title Attachment”.

PLC Programming with RSLogix 500 80Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 85: PLC Programming With RSLogix 500_shared

Let’s use a rung from our program as an example.

Right-click on the rung number 0008 and choose “Edit Comment”. This box will appear.

Make sure the “Attach To” selection shows “Output Address”.

PLC Programming with RSLogix 500 81Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 86: PLC Programming With RSLogix 500_shared

Type this in the Rung Comment field:

Run QR pump PUMP-QR after the QR valve is opened and the valve position is verified by both valve limit switches. Turn on the "Adding QR" pilot light.

Notice that you don’t have to put details such as PLC addresses in the rung comment – just document the concept of the rung.

PLC Programming with RSLogix 500 82Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 87: PLC Programming With RSLogix 500_shared

Expanding the Data tablesBefore we go online and download the program, we should expand our data tables in case we need to add a timer or a new integer after we go online. RSLogix 500 only allows you to expand data tables if you are off line in program mode. This means the process system must be shut down.

Let’s start with the B3 file. Right click on the B3-BINARY file in the Project tree. Choose “Properties”. It will initially show 1 element, which means we have one word of 16 bits. That means that we will only be able to use bits up to B3:15.

Change the number of elements to 4. This will give us 48 bits to work with; that should be plenty for this project, and we still have more than enough memory in the PLC.

PLC Programming with RSLogix 500 83Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 88: PLC Programming With RSLogix 500_shared

We will do the same with the Timers. In the case of timers, counters, integers and floating point decimals, 1 element means 1 word.

That is, if we want to be able to use 16 timers, we have to make sure the data table contains 16 elements.

You will notice that 16 elements gives us 16 timers (T4:0 ~ T4:15).

PLC Programming with RSLogix 500 84Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 89: PLC Programming With RSLogix 500_shared

Do the same with the C5 counter file. We don’t have any counters in the program yet, but we might need one or two before we are done.

PLC Programming with RSLogix 500 85Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 90: PLC Programming With RSLogix 500_shared

Do the same with the N7 integer file.

PLC Programming with RSLogix 500 86Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 91: PLC Programming With RSLogix 500_shared

Connecting To The SLC And Going OnlineYou have written your program and now you are ready to download, or send, the Batching program to the computer.

First, backup up your original file and put it in a safe place.

Check the serial port settings of your computer in Control Panel. Make sure the baud rate (or bits per second) of your COM port is set as high as possible 57600 should work there.

Allen-Bradley provides a cable to connect the serial port of your computer to the 9-pin serial port on the SLC 500 processor. Connect the cable and turn power on to the PLC.

Turn the key operated switch on the processor to the center position PROG (program).

If you do not have RSLinx installed, you will have to do that now.

After you install RSLinx, you will have to configure it for your computer and your PLC.

To do that,

Choose Start > Programs > Rockwell Software > RSLinx > RSLinx

In the Notification are of your Taskbar (the lower right of your Windows screen) that looks like this.

The one on the left is the RSLinx Communications Service. The other one is for the RSI Directory Service.

Click on the left one, the RSLinx Communications Service. The RSLinx screen will appear.

PLC Programming with RSLogix 500 87Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 92: PLC Programming With RSLogix 500_shared

Choose

Communications > Configure Drivers

The driver screen appears.

Choose RS-232 DF1 devices from the “Available Driver Types” drop-down menu.

PLC Programming with RSLogix 500 88Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 93: PLC Programming With RSLogix 500_shared

Click “Add New”.

Click “OK”.

You probably have your cable connected to COM1 of your computer. Click “Auto-Configure”.

PLC Programming with RSLogix 500 89Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 94: PLC Programming With RSLogix 500_shared

In the box to the right of the “Auto-Configure” button, you should see a message that says “Auto Configuration Successful”. In addition, the “Device:” box should show “SLC-CH0/Micro/PanelView”.

PLC Programming with RSLogix 500 90Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 95: PLC Programming With RSLogix 500_shared

Click “OK”. You should see a screen like this.

Click “Close”. You may close the RSLinx screen – RSLinx will still run, as indicated by the icon in the Notification area of your taskbar.

Open RSLogix.

WARNING

There are dangerous voltages present on terminals of the PLC. Follow all warnings and instructions from the Allen-Bradley manual for connecting power to the PLC. If you are not

familiar with hazards and the potential dangers of these voltages, please STOP RIGHT NOW. Consult a trained professional who is able to

assist you.

PLC Programming with RSLogix 500 91Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 96: PLC Programming With RSLogix 500_shared

Choose Comms > System Comm… from the menu. You will see a screen like this. You may have to maximize the screen and resize the panels to get the right view.

In the explorer panel on the left, click on the “+” next to “AB_DF1-1, DH-485”. You should see animation in the icon, as the tiny blue square moves around the little network symbol. The computer icon for address 00 indicates your computer. The icon for address 01 indicated the PLC. In our case, it is an SLC-5/03.

PLC Programming with RSLogix 500 92Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 97: PLC Programming With RSLogix 500_shared

Select the SLC in the left window and click “OK”. The communications window will close.

In the RSLogix 500 main screen, choose File. Select your program from the Recent File List (it is probably 1).

PLC Programming with RSLogix 500 93Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 98: PLC Programming With RSLogix 500_shared

Choose “Controller Properties” from the Project tree. Click on the “Controller Communications” tab.

Click on the “Driver” dropdown box and select “AB_DF-1-1”.

Click “Apply” then “OK”.

Choose Comms > Download

PLC Programming with RSLogix 500 94Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 99: PLC Programming With RSLogix 500_shared

You should get a screen similar to this.

Choose “Yes”.

The program will begin downloading.

PLC Programming with RSLogix 500 95Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 100: PLC Programming With RSLogix 500_shared

Since we are downloading a new configuration, this screen will appear.

Choose “Apply”. The program is now in the PLC.

If things go well, you may be able to go online right away.

Choose Comms > Go Online

PLC Programming with RSLogix 500 96Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 101: PLC Programming With RSLogix 500_shared

Choose “Browse” and find the folder where you file is located. Click “OK”.

The file name will show in the bottom box. Click on it to select it, then click “Upload Use File”.

PLC Programming with RSLogix 500 97Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 102: PLC Programming With RSLogix 500_shared

You may need to change the Baud Rate of the PLC. Click “Channel Configuration” in the Project tree and click on the “Chan. 0 – System” tab. Choose “19200” from the Baud dropdown menu. Click “Apply” and “OK”.

PLC Programming with RSLogix 500 98Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 103: PLC Programming With RSLogix 500_shared

You will now see a screen like this. Notice that the ladder icon is animated to indicate you are online.

PLC Programming with RSLogix 500 99Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 104: PLC Programming With RSLogix 500_shared

Run ModeBefore you go into Run Mode, make sure that the E-stop button works properly. I have not included wiring diagrams in this book, but most codes state that all control power is removed if the E-Stop button is pressed.

NFPA 79 Electrical Standard for Industrial Machinery states the following:

“9.2.2* Stop Functions. The three categories of stop functionsshall be as follows:

(1) Category 0 is an uncontrolled stop by immediately removingpower to the machine actuators . . .

9.2.5.4.1 Emergency Stop. Emergency stop functions providedin accordance with 9.2.5.3 shall be designed to be initiatedby a single human action.

9.2.5.4.1.1 In addition to the requirements for stop, theemergency stop shall have the following requirements:

(1) It shall override all other functions and operations in allmodes.

(2) Power to the machine actuators, which causes a hazardouscondition(s), shall be removed as quickly as possiblewithout creating other hazards . . .

(3) Reset of an emergency stop circuit shall not initiate a restart.” (National Fire Protection Association, 79-22, 79-23)

Make sure you follow your company’s start-up procedures as you begin testing the system.

The next step is to put the processor in Run Mode. Do not enter this step lightly; you MUST keep the safety of your co-workers in mind. Look around the machine and make sure everyone is safely located.

Find the mode drop-down menu in the upper left. It currently says “PROGRAM”. This means that the PLC is not currently running the program.

PLC Programming with RSLogix 500 100Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 105: PLC Programming With RSLogix 500_shared

The key switch in the PLC has 3 positions: RUN (run mode), REM (remote run mode, meaning that the mode can be selected from RSLogix) and PROG (program mode).

Carefully switch to REM. This puts the processor in remote run mode. Notice what the dropdown menu indicates.

PLC Programming with RSLogix 500 101Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 106: PLC Programming With RSLogix 500_shared

Click on the dropdown and choose “Test Continuous”. This is a special mode that allows the program to run, but disables all outputs.

Scroll through the program using the scrollbar to the right in the LAD 2 – MAIN window.

Looking at Rung 0003, for example, you can see that the System Enable bit B3:0/0 XIC is true, as indicated by the green highlight on the instruction.

Any XIC instruction tells the PLC to look at a bit, and if the bit is ON, then the instruction is true.

The system is not batching as shown by the XIO instruction used for B3:0/2. An XIO instruction tells the PLC to look at a bit, and if the bit is OFF, then the instruction is true. The XIO instruction in Rung 0003 is true because bit B3:0/2 is off.

Because all of the preceding instructions before the B3:0/4 System Ready bit are true, the OTE is true. Again, it is highlighted.

Sometimes it is necessary to cycle power on your computer.

Making the first connection to a PLC can be tricky. Prepare yourself by having the phone number for your Rockwell rep handy.

PLC Programming with RSLogix 500 102Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 107: PLC Programming With RSLogix 500_shared

Think of the equivalent hardwired relay circuit that would generate the same function as Rung 0003. Imagine that we have 3 relays, labeled B3:0/0, B3:0/2 and B3:0/4. We have wired a normally open contact of B3:0/0 in series to a normally closed contact of B3:0/2 and to the coil of B3:0/4. We have also wired a pilot light in parallel with the coil of our imaginary relay B3:0/4.

The coil for relay B3:0/0 is energized, so the normally open contact is closed. The coil for relay B3:0/2 is not energized, so the normally closed contact of B3:0/2 remains closed. The coil of B3:0/4 is now energized. The pilot light is illuminated.

Getting back to our PLC rung, you can see that the branch that contains the pilot light output shows that OTE is true also. However, since we are in TESTCONT mode, the output on the module is not electrically energized. You can look at the card and see that the LED for this output is off.

Look at Rung 0007. The first two instructions look right, as the system is not batching and we are not in Batch Step 2. Neither of these is highlighted. However, the LEQ (less than or equal to) is true; Source A is 0, which is certainly less than the value of 1665 in Source B.

PLC Programming with RSLogix 500 103Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 108: PLC Programming With RSLogix 500_shared

RSLogix does not highlight some instructions, such as an LEQ. You have to mentally compare the numbers yourself to see if the instruction is true.

In Allen-Bradley PLC vernacular, upload means get the program from the PLC and

load it in RSLogix on your computer.

Download means send the program from RSLogix on your computer to the PLC.

PLC Programming with RSLogix 500 104Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 109: PLC Programming With RSLogix 500_shared

We need to check our analog inputs. Double-click on “LAD 3 – ANALOG” in the Project tree.

There is no liquid in the tank, so our input reads 0. The SCP instruction puts a value of 0 in the output register N7:0.

Rung 0001 of the analog ladder also reads correctly. Click on the “MAIN” tab at the bottom of the ladder window to return to the main ladder.

After you are convinced that all of your logic is working properly, click on the mode dropdown and select “Run”. A screen will appear asking you to verify the mode change to Run. If you choose “Yes”, the outputs on the PLC will be energized, so be ready with the E-Stop switch. Choose “Yes”.

PLC Programming with RSLogix 500 105Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 110: PLC Programming With RSLogix 500_shared

The dropdown menu will now display “REMOTE RUN”.

You can look at the LED on the PLC for output O:5.0/0 and see that it is on. This output is for the System Ready pilot light.

Scroll to Rung 0004. Press the Start Batch pushbutton and you should see the XIC instruction for I:4/0 highlighted. This makes the rung true, and B3:0/10 is turned on. Release the pushbutton and the rung will look like this.

Notice that even though the rung is no longer true, B3:0/10 is on. This is because it is a latch instruction and will remain on until the corresponding unlatch instruction is true.

PLC Programming with RSLogix 500 106Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 111: PLC Programming With RSLogix 500_shared

Scroll to Rung 0005. You can see that system is in Batch Step 1 and that the City Water valve is open. The pilot light is on. The liquid weight in the tank is rising as shown in the LEQ instruction.

The sequence continues as the specified weight for each ingredient is reached.

As the ingredients are added, the tank weight rises. When all the ingredients have been added, the batch is blended and sent to the filling lines. The program functions as specified in the original Project Scope.

Test your E-Stop circuit thoroughly, even if you are working on a system that has been running for months or years. Be ready to hit the E-Stop button if you see a hazardous situation developing.

PLC Programming with RSLogix 500 107Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 112: PLC Programming With RSLogix 500_shared

Editing in Run ModeAs happens many times, though, there is a change in the project procedure.

There is a storage tank on the filling lines that Mixing Tank Pump PUMP-MT feeds. The Process Engineer indicates that there may be a possibility of supplying too much finished product to this tank and that it could overflow. He decides the storage tank should have a high level switch mounted in it. If the level in the storage tank gets too high, he wants you to disable the Mixing Tank pump.

We still have spare inputs available. Let’s use I:4/14. It is decided that the high level switch will be wired in the failsafe mode; that is, the level switch will be closed until a high level is reach. When wired in that fashion, if the wiring to the switch fails, you will not receive a signal from the storage tank pump and the PLC will stop the Mixing Tank Pump. The system will not run until the problem is corrected.

Scroll to Rung 0017. Double-click on the rung number. A column of “e’s” will appear. The rung is now open for editing.

Click and drag the XIC tool button to the first marker after I:4/9. When the marker turns green, release the mouse button.

PLC Programming with RSLogix 500 108Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 113: PLC Programming With RSLogix 500_shared

Type I:4/14 and press enter. Add the descriptor “Filling Line Storage Tank Ready” and click “OK”.

PLC Programming with RSLogix 500 109Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 114: PLC Programming With RSLogix 500_shared

Up to this point, your changes have not been integrated into the sequence of the program. You will notice that just below the rung you are editing the original version of the rung is displayed.

To get your changes into the sequence, you must perform 3 steps:

1. Accept the current rung edits

2. Test the edits

3. Assemble the edits.

PLC Programming with RSLogix 500 110Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 115: PLC Programming With RSLogix 500_shared

Make sure the rung number area is still highlighted in red. Locate the “Accept Current Rung Edit” tool in the ladder window.

By the way, if you want to cancel your current edits, click the tool to the immediate right of the “Accept Current Rung Edit” tool. This is called “Cancel Current Rung Edits” .

Click on the “Accept Current Rung Edit” tool .

The tool will be now grayed out and the “Test Edits” tool now becomes available. In addition, the “Cancel Edits” tool is available. You can click this if you want to cancel your edits.

PLC Programming with RSLogix 500 111Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 116: PLC Programming With RSLogix 500_shared

The rung number area now shows a column of vertical bars and the revision rung below shows a column of vertical “R’s”.

Click on the “Test Edit” button . A dialog box will appear asking you to verify this action. Choose “Yes”.

PLC Programming with RSLogix 500 112Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 117: PLC Programming With RSLogix 500_shared

The ladder window now looks like this screenshot. The output has still not changed, but you can see that the new input for the Filling Line Storage Tank is on and is working properly.

You could still cancel your edits at this point with the “Untest Edits” tool button .

PLC Programming with RSLogix 500 113Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 118: PLC Programming With RSLogix 500_shared

The final step is to “Assemble Edits”. Locate the “Assemble Edits” tool icon .

PLC Programming with RSLogix 500 114Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 119: PLC Programming With RSLogix 500_shared

Click on the icon. A dialog box will appear asking you for confirmation. Choose “Yes”.

Your online edit is now complete. The Mixing Tank pump will not run unless it receives a signal from the Filling Line Storage tank indicating the tank is ready to receive finished product.

PLC Programming with RSLogix 500 115Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 120: PLC Programming With RSLogix 500_shared

A Final Note About Our ProgramYou may have noticed that we ignored some aspects of the system that perhaps should have been addressed.

For example, in a real world system, you would probably have to make sure that the supply of ingredients QR and KM are available. If not, the pumps could run dry, and this is probably undesirable.

Another nice feature of the program would be to make sure the weight in the tank is changing if we are adding an ingredient. If not, this certainly indicates some kind of problem and the system should probably be shut down.

I have intentionally left out features like this for simplicity’s sake. I don’t want to overwhelm you with too many “what ifs”.

The bottom line is that we fulfilled the Project Scope. This is the single most important aspect of creating a successful program.

Feel free to ponder enhancements to this batching logic. Perhaps you can use those ideas on your first real-world batching program.

PLC Programming with RSLogix 500 116Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 121: PLC Programming With RSLogix 500_shared

How Do I . . . ?Here is an FAQ section to address the most asked questions regarding RSLogix.

How do I . . . ?

Turn off Rung Comments

View > Properties > Comment Display uncheck Show Rung Comments

Change The Screen Font

View > Properties > Fonts

Show 3D Instructions

View > Properties > Miscellaneous Check Show 3D Instructions

Edit A Rung In Run Mode (see the “Editing in Run Mode” section in this book)

Double-click on the rung number

Make the changes to the rung.

Click “Accept Current Rung Edits”

Click “Test Edits”

Confirm the dialog box.

Click “Assemble Edits” .

Confirm the dialog box.

Hint: instead of moving your pointer to confirm each dialog box, just press the space bar – this is much faster.

PLC Programming with RSLogix 500 117Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 122: PLC Programming With RSLogix 500_shared

Cancel An Edit In Run Mode

Depending on what stage of the edit you are in, click one of these icons:

Cancel current rung edits .

Cancel Edits .

Untest Edits .

Find An Instruction In The Program When You Only Know Some Of The Descriptor Or Rung Comment

Press CTRL-F. Make sure the appropriate right boxes are checked. Type the text in the “Find What:” box. Click “Find Next” or “Find All”.

Go Back To The Last Rung I Was Working On

Use the “Logic Trace” toolbar.

If it is not visible, choose View > Toolbars and check “Logic Trace”. You can also drag it to the ladder window and it will become free floating.

Open Another Program, But Still Keep My Existing Program On Screen

Just start RSLogix again. You can open a number of RSLogix windows simultaneously.

Compare One Program To Another For DifferencesThis is handy if you have two programs for the same machine and there is confusion over which is the latest revision.

Choose Tools > Compare and fill in the blanks.

Force An Output On A Module To Come On

Right-click on the output in the ladder logic. Choose “Force On”.

PLC Programming with RSLogix 500 118Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 123: PLC Programming With RSLogix 500_shared

In the Forces Disabled/Enabled drop down, choose “Enable All Forces”. This will force on the output and turn on the device that is connected to the output, no matter what the logic in the rung says. The corresponding LED on the output module will come on. Use this with caution.

Force An Input On A Module To Come On

This differs from forcing on an output in that you can’t force electricity to become present at an input, but the PLC will think there is.

Right-click on the input in the ladder logic. Choose “Force On”. Unlike forcing an output, the corresponding LED in the input module will not come on.

Find Out How Much Memory Is Left In The PLCChoose File > Summary Info > Statistics

Get Help On A Specific InstructionChoose Help > SLC Instruction Help

Disconnect From The PLC After All The Programming Changes Are MadeChoose File > Save (save the data tables). Disconnect the interface cable.

Tips, Shortcuts and WarningsUse The Data Table To Find Unused Bits As You Write Your Program.If you are writing a large program and using many B3 file bits, it is easy to lose track of what bits are available.

Right-click on an instruction and choose Goto Data Table. Click the “Usage” button and an “X” will show what addresses you have already used. This technique works with any type of file, such as timers, counters and integers.

The Date Attribute Of The File Is Updated Every Time You Go Online Even If You Don’t Save The Program.Keep this in mind as you track your revisions.

PLC Programming with RSLogix 500 119Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 124: PLC Programming With RSLogix 500_shared

You Cannot Add Program Files Or Expand Data Tables When You Are In Run Mode.Try to think ahead and include all the files as you write the program offline. Sometimes you don’t have the option of shutting a machine down because, for example, you have used all the timers in your T4 file and you need a new timer.

Use Search And Replace With Caution.Try to avoid the “Replace All” button unless you are absolutely, positively sure that things will come out right. There is no “Undo”.

It is much safer to use the “Find Next” and “Replace” buttons. That way you can evaluate each change you make.

Attach Rung Comments To The Output, Not The Rung Number.The default in RSLogix is to attach comments to the rung number.

Choose Tools > Options… > System Preferences and select “Output Address”.

Don’t Fault The Processor In Run Mode.Make sure you don’t ask the PLC to do anything like dividing by zero. The PLC will fault and the machine will stop. This can be very embarrassing.

Backup Your Files Frequently.The easiest way is to “rev” your filename every so often, at least once every 30 minutes. Choose File > Save as and put a number in the filename.

Sometimes, files are corrupted through no fault of your own. You can always go back to the previous version so that you have not lost all of your work.

Disable A Rung With An AF.If you want to temporarily disable a rung, set aside a bit that you know will always be false. Label it “AF” for “always false” and use it with an XIC to temporarily disable a rung.

Don’t Turn Off Power To The PLC OR Your Computer During An Online Edit.There is a good chance this will corrupt your current file.

PLC Programming with RSLogix 500 120Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 125: PLC Programming With RSLogix 500_shared

Keep The Original Program In A Very Safe Place.If you need to make some changes on an existing program, upload the program from the PLC and store it on a floppy or a CD. If things go awry with your editing, you can always put the program back the way it was.

Keep Track Of What You Are Doing If You Modify An Existing Program.People will want to know.

Rung Comments Are Extremely Important.Not only will they explain the operation of the program to someone else, they will remind you of why you programmed the logic the way you did.

Set The Date And Time.Double click on “Processor Status” in the “Project” tree. To the right, you will see the fields you need to fill in to set the date and time. You can also use these words (S:37 through S:42) in your ladder logic.

Use Passwords Carefully.If you use one, don’t forget it . . . but if you do, your Rockwell rep can show you how to get around it.

Find Errors After A PLC Fault.Open the “Processor Status” file in the “Project” tree and click on the “Errors” tab. Take note of the Error Description and click “Clear Major Error”. Find the logic in your code and correct it before you go back online.

Make Sure Your Program Is Programmed Properly For A System Power-Up.There can be no machine motion until the operator initiates it.

Set Up A Printout.Choose File > Report Options. This shows you everything you can print. If you are not careful, though, you may get hundreds of pages, many of which you don’t need. Use the “Print Preview” button to make sure you are getting only what you want.

Address ONS (One Shots) Individually.An ONS instruction is used to turn on a bit for one scan. The trick here is to remember that in an A-B PLC, each ONS needs its own unique address. If you are working on a large program, it may behoove you to create a new binary file just to hold your one-shots.

PLC Programming with RSLogix 500 121Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 126: PLC Programming With RSLogix 500_shared

Load And Save Your Workspace.This is a nifty way for RSLogix to remember your window positions and the files that you would like to be opened the next time you run RSLogix.

Choose File > Load/Save Workspace to access this.

SymbolsThis is a type of label that can be used as a substitute for an address. There are some advantages in terms of exporting the database, but in my experience, they are not used much.

Use CTRL-G To Goto Places Real Fast.CTRL-G brings up a dialog box. Enter in a rung number or text to go to the first occurrence of the search string.

When You Are Done, Store Your Program To The EEPROM In The PLC.It is a good idea to save your ladder file to the EEPROM. The onboard battery will keep your program in the PLC’s RAM, but if the battery fails, the EEPROM will hold the program.

Don’t Lose All Your Rung Comments And Address Descriptors.Your rung comments and address descriptors are not stored in the PLC when you download your program.

If you were to go online without choosing a database, upload the file to your computer and save it, there is a chance that you could overwrite the file that has all the rung comments and address descriptors.

Use Revision NotesThat way, you will know what you did the last time you were there.

Use Tools > Options… to switch on revision notes.

Use The Built-In Automatic Program BackupChoose Tools > Options… and set your Project Files Search Path. Make sure AutoSave is enabled. RSLogix will automatically save your file every few minutes (the default is 10 minutes).

Create An HMI In RSLogix.

PLC Programming with RSLogix 500 122Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 127: PLC Programming With RSLogix 500_shared

RSLogix provides quick way to create an HMI (Human Machine Interface). It is not something you might want to use as a final solution for a factory floor, as anyone could get in and change your program, but it is pretty handy for start-up and troubleshooting.

Double-Click on “CGM 0” in the “Custom Graphical Monitors” section of the “Project” tree.

Click on a button at the top of the CGM screen to select it. In the screen area, click and drag a square to create the object. Click and drag an address from your ladder program and drop it on the object you just made. Double-click on the object to change parameters and you will end up with something like this.

When you are in Run Mode, click on the blue arrow to run the CGM.

Write Your Rung Comments In The Present Tense.You can then cut and paste them into a document to make an operator’s manual.

Write Your Rung Comments In A Standalone Word Processor (such as Word)Spell check them, then cut and paste them into RSLogix.

PLC Programming with RSLogix 500 123Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 128: PLC Programming With RSLogix 500_shared

ConclusionI hope that you have found the information in this book useful. Some of the concepts we have covered may seem confusing at first, but with time and effort, you will be able to program a PLC to do whatever you want it to do.

I wish you the best of luck in your endeavors.

PLC Programming with RSLogix 500 124Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 129: PLC Programming With RSLogix 500_shared

Supplementary recommendations that will help, available at engineer-and-technician.com.

Beginner’s Guide to PLC Programmingebook and tutorial$9.95

PLC Programming with RSLogix 5000ebook$19.95

How to Program RSView32 ebook$19.95

How To Troubleshoot With A PLCebook$19.95

PLC Programming with RSLogix 500 125Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 130: PLC Programming With RSLogix 500_shared

Index

1746-IA16 120VAC Input Module, 271746-NI4 Analog 4 Channel Input Module,

271746-OW16 Relay Output Module, 27AB_DF1, 99Accept Current Rung Edit, 116Accept Current Rung Edits, 122Analog Inputs, 27Assemble Edits, 119, 122Assigning I/O Addresses, 27Backup Your Files, 125Baud Rate, 104BIT, 11Cancel An Edit, 123CGM, 128Change The Screen Font, 122COM1, 96Configuring Colors, Fonts and Address

Display, 36COUNTER, 13Create An HMI In RSLogix, 128Descriptors, 37Digital Inputs, 28Digital Outputs, 29Disable A Rung With An AF, 125Done bit (DN), 66, 69Download, 9, 10, 101, 104Downloading, 9EEPROM, 127Enable bit (EN), 66, 67Expand Data Tables When You Are In Run

Mode., 125Fault The Processor, 125Find Errors After A PLC Fault, 126Force, 123, 124GEQ, 59, 61, 64, 70, 71Goto, 127GRT, 79HARDWIRED INPUT, 12HARDWIRED OUTPUT, 12I/O Modules, 7

Installing RSLogix, 30INSTRUCTION, 11JSR, 52, 56, 80LED, 109, 111, 124LEQ, 57, 58, 61, 64, 70, 71, 109, 112limit switches, 22, 24, 70, 71, 72, 73, 74, 88Memory, 124MicroLogix, 5, 7, 8, 9, 13, 30, 132NFPA, 106normally open, 11, 14, 16, 24, 73, 109One Shots, 127online edit, 120OTE, 14, 42, 43, 47, 57, 58, 61, 63, 67, 71,

72, 81, 108, 109OTL, 49, 51, 62, 69, 71OTU, 49, 59, 62, 69Passwords, 126Pilot Lights, 81Printout, 126PROG, 93, 107program mode, 89, 107Project Scope, 17REM, 107REMOTE RUN, 111remote run mode, 107RET, 57, 80Revision Notes, 127RS-232, 95RSLinx, 9, 10, 93, 94, 98, 132RSLinx Communications Service, 93, 94RSLinx Lite, 9, 10RSLogix 500 Software, 8run mode, 107RUNG, 12Rung Comments, 85, 122, 125, 126, 127,

128Running RSLogix, 31Scan Time, 16Search And Replace, 125Set The Date And Time, 126SLC 5/03, 27

PLC Programming with RSLogix 500 126Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 131: PLC Programming With RSLogix 500_shared

SLC 500, 1, 6, 7, 11, 12, 30, 93SLC Power Supply, 6SLC Rack, 6System Fault, 42, 43, 75, 78, 79, 84System Power-Up, 126Test Continuous, 108Test Edit, 117Test Edits, 116, 122The Date Attribute Of The File Is Updated

Every Time You Go Online Even If You Don’t Save The Program., 125

Time Base, 66timer, 11, 13, 14, 37, 65, 66, 67, 68, 69, 70,

72, 74, 75, 76, 89, 125TIMER, 13Timer On Delay, 66

Ultrasonic Level Sensor, 19, 21, 22, 25, 27, 39, 51, 70

Untest Edits, 118, 123upload, 104, 126, 127Use The Built-In Automatic Program

Backup, 128Use The Data Table To Find Unused Bits As

You Write Your Program, 124voltage, 7, 14, 54Workspace, 127XIC, 11, 14, 37, 41, 43, 44, 46, 49, 57, 59,

62, 63, 65, 67, 69, 70, 76, 108, 111, 113, 125

XIO, 14, 37, 42, 43, 44, 47, 50, 63, 74, 76, 108

PLC Programming with RSLogix 500 127Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com

Page 132: PLC Programming With RSLogix 500_shared

THE FOLLOWING ARE TRADEMARKS OF ROCKWELL AUTOMATION, INC.

Allen-Bradley®MicroLogix™PanelView™RSLinx®RSLogix™RSLogix™ 500SLC™ 500

THE AUTHOR OR THE PUBLISHER OF THIS BOOK IS IN NO WAY AFFILIATED WITH ROCKWELL AUTOMATION, INC.

Disclaimer

THE AUTHOR INTENDS THIS DOCUMENT TO BE ADVISORY ONLY. ITS USE IN INDUSTRY OR TRADE IS STRICTLY VOLUNTARY.

THIS DOCUMENT IS PROVIDED BY THE VENDOR “AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE VENDOR OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Courtesy of Rockwell Automation, Inc.

PLC Programming with RSLogix 500 128Copyright © 2013 Modern Media & Automation, LLC

engineer-and-technician.com