Rockwell Automation Logix5000 Controllers I/O and Tag Data Programming Manual User Manual
Page 28
Chapter 2
Organize tags
Guideline
Details
Use arrays to quickly create a group
of similar tags
An array creates multiple instances of a data type under a common tag name.
• Arrays let you organize a block of tags that use the same data type and perform a similar function.
• You organize the data in one, two, or three dimensions to match what the data represents.
For example, use a two-dimensional array to organize the data for a tank farm. Each element of the array represents
a single tank. The location of the element within the array represents the geographic location of the tank.
Important: Minimize the use of BOOL arrays. Many array instructions do not operate on BOOL arrays. This makes it
more difficult to initialize and clear an array of BOOL data.
• Typically, use a BOOL array for the bit-level objects of a PanelView screen.
• Otherwise, use the individual bits of a DINT tag or an array of DINTs.
Take advantage of program-scoped tags
If you want multiple tags with the same name, define each tag at the program scope (local tags) for a different
program. This lets you reuse both logic and tag names in multiple programs.
Avoid using the same name for both a controller tag and a local tag. Within a program, you cannot reference a
controller tag if a tag of the same name exists as a local tag for that program.
Certain tags must be controller scope (controller tag).
If you want the tag
Then assign this scope
In more than one program in the project
Controller scope (controller tags)
In a Message (MSG) instruction
To produce or consume data
In any of the seven AXIS data types
To communicate with a PanelView terminal
None of the above
Program scope (local tags)
For integers, use the DINT data type
To increase the efficiency of your logic, minimize the use of SINT or INT data types. Whenever possible, use the DINT
data type for integers.
• A Logix5000 controller typically compares or manipulates values as 32-bit values (DINTs or REALs).
• The controller typically converts a SINT or INT value to a DINT or REAL value before it uses the value.
• If the destination is a SINT or INT tag, the controller typically converts the value back to a SINT or INT value.
• The conversion to or from SINTs or INTs occurs automatically with no extra programming. But it takes extra
execution time and memory.
Use most restrictive external access
External access limits the exposure of controller tags by defining a user’s ability to edit tags to Read/Write, Read Only
and None. This helps:
• Reduce the risk of inadvertently changing tags.
• Reduce the number of tags to browse when configuring HMI.
See
Enable constant attribute for tags that should not be
changed by logic
You can assign a constant value to a tag to prevent the table-backed data from being changed programmatically.
This helps reduce the risk of inadvertently changing tags.
See
Limit a tag name to 40 characters
Here are the rules for a tag name:
• Only alphabetic characters (A–Z or a–z), numeric characters (0–9),
and underscores (_)
• Must start with an alphabetic character or an underscore
• No more than 40 characters
• No consecutive or trailing underscore characters (_)
• Not case sensitive
Use mixed case
Although tags are not case sensitive (upper case A is the same as lower case a), mixed case is easier to read.
28
Rockwell Automation Publication 1756-PM004E-EN-P - October 2014