Back to tutorials
Beginner

RSLogix 500 Data Types and Cross Referencing

By
Vladimir Romanov
|
June 5, 2020
Table of Contents

Cross Reference and Data Structures Introduction

Many of those who start with PLC programming are faced with the challenge of deciphering code written by someone else. In fact, most PLC programming jobs will require you to work with existing code rather than write it from scratch. This task creates a challenge for novice PLC programmers as the interface in RSLogix 500 as well as RSLogix 5000 is unlike any other. Therefore, it’s easy to become frustrated trying to figure out where a certain tag is being used, how it ties into the logic and why it’s being used in certain places.

The second challenge many PLC programmers come across as they get started in RSLogix 500 lies in the data structures. The specification of each tag may be confusing to a beginner and unclear when it’s used as word, bit or byte in different instructions.

In this tutorial, we’re going to look at the “cross-referencing” function of RSLogix 500 (Similar to RSLogix 5000), go over the steps on how to use it and cover how it can help you trace existing code faster and understand what’s going on in the PLC. Before we get into cross-referencing however, we will take a deep dive into the different data structures we have available in RSLogix 500, explain how they are specified and discuss the basics of data in RSLogix 500 based PLCs.

RSLogix 500 Data Structures

We’ve introduced data structures in RSLogix and Studio 5000 in a separate tutorial (RSLogix 500 Data Structures). However, they’re created and used in a different manner in RSLogix 500. We will revisit their creation and use here.

In an RSLogix 500 application, the user will find currently specified data structures in the IO tree under the section called "Data Files" (See below). Note that this is different from RSLogix 5000.

RSLogix 500 - data structures in the IO tree under the section called "Data Files"
RSLogix 500 - data structures in the IO tree under the section called "Data Files"

You will notice that every data structure is specified by a letter, an integer as well as string.

  • Example: N17 - DATAFRMHMI is specified by “N”, “17” and “DATAFRMHMI”.

The letter will specify the type of data being used. The number specifies an incremental position of this data register. The string specifies the name of the data structure. Note that the name is optional, but recommended. The “N18” register above, does not have a name attached to it.

Basic RSLogix 500 Data Types

As a PLC programmer, it’s important to know the most commonly used data types. Here’s a list of those we recommend you become familiar with:

  • Binary [B] | The equivalent of a boolean or a piece of data capable of being set to 0 OR 1.
  • Integer [N] | A 16-bit register capable of storing values between -32768 and 32767.
  • Float [F] | A register that will store analog (decimal) values.
  • Timer [T] | A special register that will contain a structure used in TON and TOF instructions that will time certain events.
  • Counter [C] | A special register that will count a number of occurring events through the use of the CTU and CTD instructions.

In the screenshot above, you’ll also notice that there are two elements at the start of the data file with labels [O0 - Outputs] and [I1 - Inputs]. These data structures are created by the PLC once the user specifies the hardware used within the system. In other words, you will find all the input and output tags used within the program inside of these two structures. Their type will depend on the I/O of the system.

Understanding Specific Data Types

Now that we’ve covered the different data types, it’s time to give more information with regards to their layout.

When the user right-clicks a data structure and selects “Properties”, he will be presented with the same configuration window as the one when a new data structure is created. In this window, the user will find multiple key parameters.

RSLogix 500 - Data Type Creation and Properties
RSLogix 500 - Data Type Creation and Properties

At the very top, as discussed above, we find the three elements that will be displayed in the “Data Files” section: File, Type and Name of the register. Below, we will find the “Elements” and “Last” fields. Within the “Elements” field, the user will specify the number of elements within the data structure. In other words, this would be equivalent to an array in RSLogix 5000 or other programming languages.

Based on the number of elements within the array, the PLC will specify the “Last” element of the array. In the example above, we have an array of 20 elements which dictates that the elements will be numbered as follows: N17:0, N17:1, N17:2, ...., N17:18, N17:19.

Lastly, we can declare the scope within which the set of elements may be used. The typical “best-practice” approach is to keep the elements confined to the program they will be used. If they must be used within multiple programs, they should be set to “Global”. That being said, this feature is not used frequently in RSLogix 500; most elements are set to “Global” by default.

Definition | Array - A combination of a certain number of the same elements.

Example of a new Array of 10x Integers in RSLogix 500

RSLogix 500 - Defining an Array of Elements
RSLogix 500 - Defining an Array of Elements

Array Data File for the Array Above

RSLogix 500 - Array of Integer Elements
RSLogix 500 - Array of Integer Elements

Notice that the array of ten elements is created as the tenth (10) element of type “N”. The Data File above displays each element of the array that will be addressed as N10:0, N10:1, N10:2, …, N10:8 and N10:9 as the last element per the specification.

Working with Data Type - Boolean in RSLogix 500

The most fundamental data type is a boolean. It is a structure that may take the value of "0" or "1". This type of a tag will be used for most sensors, valves, relays, motor starters and other field devices. Based on our experience, most field devices will be operated through a boolean tag.

Creating an Array of Boolean Tags in RSLogix 500

  • Step 1 - Right-click on "Data Files".
  • Step 2 - Click on "New..."
RSLogix 500 - New Data File Creation
RSLogix 500 - New Data File Creation
  • Step 3 - Specify a "Type" of "Binary"
  • Step 4 - Specify a "Name" (In our example, the name is BOOLEAN1)
  • Step 5 - Specify a "Description" (In out example, the description is the same as the name)
  • Step 6 - Specify a number of elements (In our example the number of elements is 10)
RSLogix 500 - New Array of Boolean Tags
RSLogix 500 - New Array of Boolean Tags
  • Step 7 - Press "OK"

Notice that at this point, you should see a new element appear under the "Data Files" structures that has been created based on your specifications. Here's the one we have in our tree:

At this point, you may double-click this data file. You should see the following window open:

RSLogix 500 - Cross-referencing Array of Booleans
RSLogix 500 - Cross-referencing Array of Booleans

You should immediately notice that the file contains elements specified on the left side as B11:0, B11:1, B11:2, ..., B11:8, B11:9. However, each one of those elements contains 16 bits. In fact, each one of those elements is a 16-bit integer each bit of which can be used in PLC programming, ladder logic and otherwise. In other words, we've created a total of 16 x 10 = 160 bits of usable data by specifying 10 binary files.

Using a Boolean Tag in RSLogix 500

Once the data file is created, it's possible to use it within our ladder logic. Each bit within the file specified above will be addressed as follows:

  • B11:0 - B11:0/0, B11:0/1, B11:0/2, ..., B11:0/14, B11:0/15
  • B11:1 - B11:1/0, B11:1/1, B11:1/2, ..., B11:1/14, B11:1/15
  • B11:2 - B11:2/0, B11:2/1, B11:2/2, ..., B11:2/14, B11:2/15
  • ...
  • B11:8 - B11:8/0, B11:8/1, B11:8/2, ..., B11:8/14, B11:8/15
  • B11:9 - B11:9/0, B11:9/1, B11:9/2, ..., B11:9/14, B11:9/15

Let's look at an example of an XIC Instruction and an OTE Instruction that utilizes one of those bits.

RSLogix 500 - XIC and OTE Instructions using the Boolean Tags
RSLogix 500 - XIC and OTE Instructions using the Boolean Tags

In the rung above, we notice that the integer is specified above while the bit of the integer used is specified below the instruction. Note that the XIC and OTE instructions are only able to use boolean values. Therefore it's not possible to specify "B11:0" alone. The bit must be used.

To specify the bit, you'll have to either double-click the bit and change it.

Cross-Referencing Tags in RSLogix 500

Cross-Referencing allows a programmer to quickly find all the uses of a specific tag within the program. This action is extremely convenient as you can easily see where the tag is being used, which instructions are using the tag and jump to the location of said instruction.

To cross-reference a tag, simply right-click on it and select "cross-reference".

RSLogix 500 - Cross Reference of Data Tables
RSLogix 500 - Cross Reference of Data Tables

Once you hit "cross-reference", a new window will open. Let's see an example below and analyze how it works.

At the very top of the window, we can see the address as well as a description of our boolean tag - "B3:0/0 - Fault Reset". Everything below this line and above the next tag is referencing this specific tag.

Below that line, we see a line that calls out an OTE Instruction usage - "OTE - File #4 FAULTS - 1"

  • "OTE" - This references the instructions within which the tag is being used.
  • "File #4 FAULTS" - This is a reference to the subroutine number and name the tag is being used in.
  • "1"- This is a reference to the rung in which this instruction is found.

What's extremely important is that the same instruction can be used in multiple rungs across a single program. We can see such an example in the XIO call for the same boolean tag. In this case, the cross-reference is made for rungs 6, 9, 12, 15, 18, 21, 24, 27, 30, 33.

The plc programmer may click any one of those numbers to be brought to the instruction at that specific location. This is extremely helpful as you can easily jump to every location a specific bit is being used in.

Conclusion

Knowing how to deal, create and use different data structures is a fundamental skill of any plc programmer. Likewise, knowing how to cross-reference calls to these data structures will aid you in your troubleshooting efforts immensely. We recommend that you create a program in which you practice creating these different structures, assigning them to different instructions and see if you can cross-reference them as explained above.

Back to tutorials

Got a question or comment?

Related Tutorials

Beginner

How to Create a PLC Backup for a ControlLogix Controller

In this tutorial your will learn how to create software backups in an RSLogix 5000/Studio 5000 environment.

July 2, 2020
|
By
Jacques Venter
Beginner

An Introduction to Safety in Automation Systems

Automated machinery and systems can help improve productivity and quality, but safety must always be held to the most scrupulous of standards. In this tutorial, you will learn about safety best practices in automated systems.

June 25, 2020
|
By
Kyle Sanders
Beginner

How to Program PID Loops in RSLogix 5000

In this tutorial, you will learn about PID loops and how to create them in RSLogix 5000.

June 22, 2020
|
By
Jacques Venter