KB Controls is reader-supported. When you buy through links on our site, we may earn an affiliate commission. Read more in our disclaimer
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.
I would also like to thank my second sponsor - you. If you are enjoying and getting value from Learn Logix then please consider using the Buy Me a Coffee widget on this page to support the newsletter.
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.
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.
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.
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.
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:
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.
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.
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.
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.
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.
You can optionally define the following properties for your tag:
I will leave these properties at their default values for this tag.
After creating the tag, you may notice an asterisk on the left of the tag's row.
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.
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.
Learn Logix subscribers get one actionable tip to help them master Studio 500 Logix Designer delivered to their inbox every Tuesday morning.