KB Controls is reader-supported. When you buy through links on our site, we may earn an affiliate commission. Read more in our disclaimer

How to Create Local Tags and Program Parameters in Studio 5000 Logix Designer

A big thank you to our partners who keep this newsletter free to the reader:

Today's issue is brought to you by RealPars. RealPars provides high quality industrial automation courses at an affordable price. Join today for less than €20 a month and get access to RealPars full course catalog including courses for Siemens, Allen-Bradley, and CODESYS control platforms.

For even more savings, the first 100 readers who use my discount code "kb-controls" get an additional 10% off the price of their membership.

In Studio 5000 Logix Designer a tag is a strongly type and logically named variable. Tags are used to access areas in the controllers memory to read and write values. You use tags to store data created in your application code such as the result of a calculation and to interface with hardware for example by reading the status of a sensor.

A tag has a specific scope which defines where the tag can be used. Controller-scoped tags can be used globally throughout a Logix Designer project and a program-scoped tag can only be used in the program where they are declared. It is a best practice to limit the use of controller-scoped tags in a project.

A special type of program-scoped tag called a program parameter can be used to provide controlled access to a program-scoped tag outside of the program where it is declared. Before program parameters were available in Studio 5000 Logix Designer, data was passed to and from programs using a technique called aliasing which we will talk about in another tutorial.

In this tutorial, I will show you how to declare a program parameter in a Studio 5000 Logix Designer project.

Create a Program Parameter

In the previous instalment of Learn Logix, we learned about the structure of a Studio 5000 Logix Designer project.

As a reminder, the Controller Organizer provides a hierarchical view of the application code and configuration data for a single Logix 5000 controller. In the Controller Organizer, there is a task folder which contains the tasks, programs, and routines for a project.

We will talk about tasks, programs, and routines in more detail later but as an overview:

Tasks are a mechanism to control how often a set of scheduled programs run.

Programs are a mechanism to encapsulate related routines and tags.

Routines are where we actually program our application in logic in one of the IEC 61131 programming languages.

As we have already seen, a new Logix 5000 project contains a task, program, and routine by default called MainTask, MainProgram, MainRoutine respectively.

Open the Tag Table

A program-scoped tag is defined at the program level. To edit the program-scoped tags for a folder, open the tag table from the program by double-clicking on Parameters and Local Tags under the program in the Controller Organizer.

Parameters and Local Tags

When the tag table opens with the Monitor tags tab activated. This tag allows us to monitor the values of tags in a controller.

To create tags and program parameters, we need to activate the Edit Tags tab. Activate the Edit Tags tab by clicking on the tab at the bottom of the tag table.

People who are new to Logix Designer can find that there is too much information displayed in the tag table. To combat being overwhelmed, we can hide unused columns by right-clicking on a specific column. In my project, I will hide the "Alias For" and "Base Tag" columns.

Hide Column

Define a Name for the Tag

To add a new tag or program parameter to the tag table, double click on the Name cell in the first row. The cell is activated and you can enter a name for your tag. Here, I have created a tag called Start_PB_01.

When naming tags, there are a few rules that are defined by the IEC 61131-3 standard and enforced by Logix Designer. These rules are:

  • Tag names can be up to 40 characters in length
  • Tag names can use the upper and lower case letters A through Z
  • Tag names are not case sensitive
  • Tag names can contain the numbers 0 through 9
  • Tag names can contain an underscore (_) character
  • Tag names cannot contain spaces ( )
  • Tag names cannot use other characters that are not defined here
  • Tag names cannot begin with a number

Define the Usage for the Tag

Once you have entered a name for you tag, press tab to move to the next cell.

To reveal the Usage options, click on the dropdown arrow next to the word Local. Let's talk about what the most common usage options mean.

Tag Usage

The usage of a tag defines how the tag's data can be accessed.

A Local Tag usage means that the tag is a traditional program-scoped tag. A tag with a Local Tag usage can only be accessed within the program where it was defined.

An Input Parameter is similar to a Local Tag but it has the ability to be connected to a single Controller Tag or program parameter from another program. An Input Parameter makes data from outside a program accessible in the program.

An Output Parameter is the opposite of an input parameter. It can be connected to one ore more controller tags or program parameters and makes data from inside a program accessible outside the program.

Both InOut and Public Parameters are more advanced program parameters that we will talk about in a future tutorial.

Since my tag represents the data coming from a Start Pushbutton, I have defined it's usage as Input Parameter so that the data from the button can be passed into my program.

Input Parameter

Define the Data Type for the Tag

Once again, I press the tab key on my keyboard to advance to the next cell.

Each tag in Logix 5000 has a data type which defines what data the tag can store and how much space the tag takes up in the controller's memory.

The most simple data type is a BOOL or Boolean data type. Tags with a Boolean data type can be True or False and take up one bit in the controller's memory. Boolean variables are used to store the data for discrete devices like pushbuttons which can only be open or closed.

To se the Data Type for a tag, click on the ellipsis button in the Data Type cell.

Set the Data Type

After clicking the button, the Select Data Type dialog opens up.

Use the search function to find the BOOL data type in the list, select the BOOL data type, and click OK to set the data type for the tag.

Select Data Type

Define the Description for the Tag

I press the tab key to advance to the next cell.

Each tag or program parameter can be documented with a description. This description is not used by the controller but may be used by other people who have to maintain or extend your projects. You should always include a clear, concise description for your tags.

Since this program parameter contains the data for a normally open momentary pushbutton, I set the description to NO Momentary as shown here.

Tag Description

Define Other Properties for the Tag

You can optionally define the following properties for your tag:

  • The External Access property allows us to restrict access to a tag by other applications like a HMI.
  • The Constant property allows us to define a constant value for a tag which cannot be changed programmatically.
  • The Style property allows us to control how a tag's value is displayed in the project.

I will leave these properties at their default values for this tag.

Save the Tag

After creating the tag, you may notice an asterisk on the left of the tag's row.

Asterisk

This asterisk indicates that the tag's configuration has been created or changed but those changes aren't stored in the project yet.

I press Enter to store the tag's configuration in the project. Once the tag's configuration has been stored in the project, the asterisk disappears.

Stored Tag Configuration

Wrap Up

In this tutorial, we learned how to create a program parameter in a Studio 5000 Logix Designer project.

Although we focussed specifically on creating a program parameter, you can use this same approach to create controller-scoped and program-scoped tags in Studio 5000 Logix Designer.

When you're ready, I recommend that you learn more about PLC programming by following an affordable course based on free software.

PLC Programming From Scratch teaches you everything you need to know to be an intermediate PLC programmer by developing and testing the software for two industrial automation applications. By the end of the course, you will have two portfolio projects to discuss in interviews and you will know how to approach projects to design good PLC software.

Introduction to PLC Programming with CODESYS teaches you the fundamentals of PLC programming with CODESYS, a hardware independent PLC software development system that is becoming increasingly popular in industry.

Related Content

How to Add Bit Instructions to a Routine

How to Add Bit Instructions to a Routine

How to Create Local Tags and Program Parameters in Studio 5000 Logix Designer

How to Create Local Tags and Program Parameters in Studio 5000 Logix Designer

The Structure of a Project in Studio 5000 Logix Designer

The Structure of a Project in Studio 5000 Logix Designer

How to Create a Project in Studio 5000 Logix Designer

How to Create a Project in Studio 5000 Logix Designer