Book Image

Instant PLC Programming with RSLogix 5000

Book Image

Instant PLC Programming with RSLogix 5000

Overview of this book

RSLogix5000 is a user friendly IEC61131-3-compliant interface for programming the current generation of Rockwell Automation PLCs, which includes Ladder Diagrams (LD), Graphical Function Block Diagrams (FBD), Graphical Structured Text (ST), and Sequential Function Charts (SFC). Instant PLC Programming with RSLogix 5000 captures the core elements of PLC programming with RSLogix 5000 with a minimal investment of time. We will avoid getting into control theory and focus on condensing the information specific to RSLogix 5000. We have selected the key areas of RSLogix and provide a step-by-step approach to teaching them. This book start by follows the steps involved in creating a new RSLogix 5000 project and configuring racks, slots, and channels. Next, we will create routines using the various languages available in RSLogix 5000, troubleshooting and resolving issues we encounter along the way. Finally, we will dive into the advanced features, such as online changes, code generation, task management, and user-defined structures. You will also learn object-oriented PLC programming techniques using advanced features like user-defined types (UDTs) that improve the maintainability, uniformity, and readability of our routines. We also highlight the strengths and limitations of online changes and demonstrate techniques to maximize flexibility. You will learn everything you need to get up and running with RSLogix 5000 as well as best practices used by industry experts.
Table of Contents (7 chapters)

Building Functional Block Diagrams (Simple)

In this recipe, we will demonstrate how to use powerful Functional Block Diagrams (FBD) in your PLC program. We will create a simple digital alarm block routine using FBDs to manage our valve fault condition FC1001_FLT.

Getting ready

To complete this recipe, you should have completed the previous exercises.

How to do it...

  1. Open the Controller Organizer window and expand the tree Tasks | Main Tasks | Main Program. Right-click and select New Routine.

  2. Configure a new FBD routine by setting the following values:


    • Description: Digital Alarms

    • Type: Function Block Diagrams

  3. In order that our newly created routine executes with each scan of the PLC, we will need to add a reference to it in MainRoutine, which is executed with each scan of the MainTask. Repeat Steps 3 to 7 of the Building Ladder Diagram programs recipe (or copy and paste the existing JSR), but use the Routine name DIGITAL_ALARMS in the JSR element.

  4. Now we will return to our DIGITAL_ALARMS FBD by double-clicking on it in the Controller Organizer window.

  5. Next, we are going to add our Digital Alarm FBD, which we will use to manage our valve alarm fault. Select the Alarms element group in the FBD toolbox just above the FBD and click on the ALMD (Alarm Digital). The following screenshot displays the Alarms element group.

  6. We need to connect the ALMD block to our valve fault alarm using an Input Reference, so let's add one to our FBD. The Input Reference object looks like an arrow (with a square corner) that is pointing to the right, as shown in the following screenshot. It can be found at the top-left area of the Element Group selector above the FBD. Click on the Input Reference object icon to add it to the diagram. This icon looks as shown in the following screenshot:

  7. We will now set the input reference to point to our fault Base Tag. Click on the Input Reference icon, click on the drop-down option, and select FC1001_FLT.

  8. Now we will need to reposition our blocks so that they fit properly on our FBD sheet. Click-and-drag the ALMD object to the right by a few inches.

  9. Now we will connect the FC1001_FLT Input Reference to the ALMD block. Click and drag the point of the Input Reference object (you will see the mouse pointer change to a connector mouse icon) and release the mouse button over the Input Digital Pin object.

  10. The ALMD function block that we added was automatically created as a base type object in our program scope tag list (Program Tags). We will now change the name of the ALMD object to follow our existing tag naming convention. Right-click on the top title of the ALMD object and navigate to the Edit | ALMD_01 element.

  11. Select the Name field in the element property and change it to: FC1001_FLT_ALM and click on OK. The scope of our FBD Base tag is set to MainProgram automatically when we added it to our routine. The routine now looks like the following screenshot:


It is important to note that a Tag's scope cannot be changed after it has been created. You would need to delete and recreate the object in order to move it to another program or to the controller scope (global) level. If you wanted to create the function block at the controller scope level (a more global scope), you would need to declare the ALMD type tag manually at the controller scope level (using the New Tag form) and then change the FBD block to point to the ALMD tag you created.

How it works...

FBD routines are very different from Ladder Logic Routines; FBD routines are executed like a flow chart from input to output. FBD logic can flow in multiple directions and paths depending on how it is laid out. One or two FBD objects can easily replace dozens of Ladder Logic Rungs, thus making your program easier to maintain.

There's more...

More information on FBD can be found in the Rockwell publication Logix5000 Controllers Function Block Diagram available at

FBD provides a powerful set of high-level functions; it is important to understand how they interface with the HMI and how they are organized.

FBD properties

Double-clicking on an FBD block will open its properties. Each FBD block contains a unique set of properties and detailed help documentation is provided (by pressing the F1 key). Many of the properties allow you to more tightly integrate your PLC controller with your Human Machine Interface (HMI) computer. Using FBD can allow you to configure many properties like alarm names in the PLC rather than in the HMI. Many SCADA system vendors are moving to a more DCS-style, single database configuration. Rockwell Automation's PlantPAx automation system takes this type of DCS functionality to the next level, but that is a subject for a separate book perhaps.

Organizing your FBD with sheets

You can also organize your FBDs into multiple sheets and use wire blocks to pass data between them. You can add sheets to your FBD by clicking on the New Sheet icon above your FBD routine. You can also provide a helpful name for each sheet by editing the Sheet text field.

The layout flexibility and Sheet organization that FBD routines provide make them more suitable for printing than Ladder Logic.