Introduction to Tags and Datatypes
It’s very important to understand Tags and Datatypes in the ControlLogix processor. The memory is made of of two main areas. Tags store data, and Tasks (logic) manipulates data. In contrast, the datatype is the way data is structured within a tag. When we added I/O, RSLogix / Studio 5000 automatically created some Controller Tags to view and control the I/O. We can create other tags as well for use in our project, such as tags for timers, integers, and other Boolean bits.
For example: If we have a tag called “ValveShut”, we can make this a BOOL Tag. As a result, the tag “ValveShut” would consist of only one bit. The tag can only have 2 states: 1 or 0.
In the same way, we could create a tag called “ValvePosition”. This might be a DINT (Double Integer) tag. At this point, you could store a value of 0 to 100 (percent) into this tag. A DINT tag contains 32 individual bits, which represent a numeric value when interpreted by the processor.
In like manner, we could create a tag called “TransitionTimer”. If we give this tag a TIMER datatype, it will inherit all the members we need for a timer (Accumulated Value, Preset, ENable bit, DoNe bit, and Timer Timing bit).
Controller Tags vs. Program Tags and parameters
Controller tags are global. In summary, almost anything can access a controller tag. Any program, or any other controller can access a controller tag.
In the same fashion, local tags and parameters are local to the program they reside in. The advantage of local tags is that they are in their own namespace. This means that we can have two programs that use the same tag names for timers, counters, integers, etc…. The tags will not interfere with each other if they are local tags or parameters.
Creating a tag
Before we create a tag, be sure you are offline or that the keyswitch is in “Remote”. There are several ways to create a tag. Let’s create a simple bool tag called “ValveShut”. We’ll make this a controller tag, so it will be global, and any program can access this tag. One way to do this is to right click the controller tag database, and create a new tag.
For this example, we’ll just double click the controller tag database, and choose “Edit Tags”. At the bottom of the Controller Tag Database, we’ll create the tag called “ValveShut”, and the datatype will be “BOOL”. You are now free to use this tag as you see fit in logic!
— Ricky Bryce