• Monitor array tags through the Tags window
• Monitor tags of user- defined data types through the T ags window
Why These Skills Are Important Why These Skills Are Important
Often, well-des igned applications take advantage of more complex tags. These tags may combine multiple elements of the same data type into an array or may consist of new, user-defined data types.
Understanding how to interpret and monitor these complex tags is essential to troubleshooting an application.
Key Terms Key Terms Array
Array: A numerically indexed sequence of elements of the same data type. An array tag occupies a contiguous section of memory in the controller with each element in sequence. Arrays can have one, two, or three dimensions .
Element
Element: A single position within an array.
Example: Array Example: Array
A controller needs to store a piece of data for six different parts.
This data can be stored in an array of 6 INTs:
Array of 6
Review the definition of the term tag.
Review the definition of the term tag.
Before You Begin Before You Begin
Note that an array that is a member of Note that an array that is a member of user-defined data type can only have user-defined data type can only have one dimension.
one dimension.
Relate this to PLC-5 data, where N7:0 to Relate this to PLC-5 data, where N7:0 to N7:9 is a one-dimensional array of N7:9 is a one-dimensional array of integer data types.
integer data types.
Note that an array of Part[40] will have Note that an array of Part[40] will have elements of Part[0] to Part[39].
elements of Part[0] to Part[39].
Stress that it is easier for a programmer Stress that it is easier for a programmer to create a
to create a single-dimensionsingle-dimensional array ofal array of 100 DINTS than it is to create 100 100 DINTS than it is to create 100 individual tags.
individual tags.
Point out that you can create an alias Point out that you can create an alias tag for each element of an array. For tag for each element of an array. For example, Cold_Timer might be an alias example, Cold_Timer might be an alias for TIMER [34].
for TIMER [34].
7--2
7--2 Monitoring Arrays and Tags of User-Defined Data Types in an RSLogix 5000 Project
E 2007 Rockwell Automation, Inc. All rights reserved.2007 Rockwell Automation, Inc. All rights reserved. Rev. Rev. February February 20072007 ADTsb56r
Array Addressing Array Addressing
An instruction might examine or write to one element of an array:
Part_Data[3]
Part_Data[3]
ArrayName
ArrayName Single Single Element Element of of a a 1 1 Dimensional Dimensional ArrayArray
If an array total is 100, then you can address elements 0-99. A major fault is generated if code attempts to read from or write to an array element location that exceeds its corresponding dimension, e.g., if an array = Part[100] and an instruction attempts to write data in Part[150].
Certain data types can support one-, two-, or three-dimensional arrays:
Part_Data[2,5,3]
Part_Data[2,5,3]
ArrayName
ArrayName Dimension Dimension 11 Dimension 2
Three dimensiona l arrays might store the following data:
Part[2,3,0]
Array dimensions are separated by commas.
Note that the number or expression in Note that the number or expression in the brackets is the subscript. Point out the brackets is the subscript. Point out the square brackets that enclose the the square brackets that enclose the element number.
element number.
As an example, state that if As an example, state that if
Position1-Position1--Position2=48 and -Position2=48 and the array the array isis an array of only 40, a major fault will an array of only 40, a major fault will occur.
occur.
Note that if executable code attempts to Note that if executable code attempts to read beyond an array limit, it will read read beyond an array limit, it will read the next tag in memory and process the the next tag in memory and process the data accordingly.
data accordingly.
Add that an array might include data Add that an array might include data
stored by shift, day, and week. Or, x and stored by shift, day, and week. Or, x and y coordinates (for retrieving a part in y coordinates (for retrieving a part in storage).
storage).
"
Tip
Tip
7 7 ---- 33 Monitoring Arrays and Tags of User-Defined Data Types in an RSLogix 5000 Project
E 2007 Rockwell Automation, Inc. All rights reserved.2007 Rockwell Automation, Inc. All rights reserved.
Rev. February 2007 Rev. February 2007
ADTsb56r Advanced Array
Advanced Array AddressingAddressing
The following table contains more advanced array formats and examples:
If you monitor a tag in this If you monitor a tag in this
format . . .
format . . . EExxaammpplle e IIt t iis s a a . . . . ..
ArrayName
ArrayName[Element] [Element] Part[5]Part[5]
Standard single
ArrayName[T[Tag] ag] Station[PosStation[Position]ition] ChangingChanging ArrayName
ArrayName[Expression[Expression] ] Station[PosStation[Position+5]ition+5] elementelement ArrayName
ArrayName[Element].Bit [Element].Bit Part[5].15 Part[5].15 Bit in the elementBit in the element ArrayName
ArrayName[Epression[Epression].[T].[Tag] ag] Part[IndexAPart[IndexAND7].[MyIndeND7].[MyIndex]x] Changing Changing bit bit inin ArrayName
ArrayName[Expression[Expression].[Expression].[Expression] ] Part[IndexAPart[IndexAND7].[MyIndeND7].[MyIndex+31]x+31] the the elementelement
User-Defined Data Types User-Defined Data Types Structure
Structure: A data type that combines other data types. E.g., a TIMER data type is made up of DINTs and BOOLs.
User-Defi
User-Defined ned Data Data TTypeype: A structure created by a programmer to group related data in an application.
Member
Member: One data type within the structure.
Example
Example: User-Defined Data User-Defined Data TTypeype
There are several identical tanks in an application. Each tank has data that needs to be stored:
Temperature Point out that a period indicates the next
Point out that a period indicates the next sublevel of an address. A tag without a sublevel of an address. A tag without a period is the whole address.
period is the whole address.
Review:
Review: An element is one part of an An element is one part of an array, while a member is one part of a array, while a member is one part of a data type.
data type.
Chalk Talk:
Chalk Talk: Before showing the next Before showing the next slide, have the students help you make slide, have the students help you make a list of the members that might go into a list of the members that might go into the user-defined data type for the tank the user-defined data type for the tank example. Have the students select the example. Have the students select the data type of each
data type of each membermember..
7--4
7--4 Monitoring Arrays and Tags of User-Defined Data Types in an RSLogix 5000 Project
E 2007 Rockwell Automation, Inc. All rights reserved.2007 Rockwell Automation, Inc. All rights reserved. Rev. Rev. February February 20072007 ADTsb56r
To store this data, a programmer creates a user-defined data type.
This data type is then available for new tags:
Tag Name
Just as TIMER members are addressed (Total_Timer.EN or Total_Timer.TT), you can address members of a user-defined:
Tag.Member Tag.Member
Examples: User-Defined Data Type Addressing Examples: User-Defined Data Type Addressing
Specific data can be addressed in a tag of a user-defined data type:
Arrays and tags of user-defined data types can be mixed, providing extreme programming flexibility.
Example: Arrays and User-Defined Data Types Example: Arrays and User-Defined Data Types
If there are 25 tanks (5 rows of 5), a programmer can make an array of tags that uses a user-defined data type:
Tank [0,0]
Tank [0,0] Array Array = = [5,5][5,5]
One Specific Element = One Specific Element = Tank[1,3]Tank[1,3]
Provide other examples, including
Note that this is similar to how you Note that this is similar to how you address TIMER members in other address TIMER members in other projects (T4.EN or T4.TT).
projects (T4.EN or T4.TT).
State that the delimiter is a period.
State that the delimiter is a period.
Point out that the
Point out that the last example containslast example contains a structure (Load_Info) that is a structure (Load_Info) that is embeddedembedded in the user-defined data type.
in the user-defined data type.
Note that in this scenario, the Note that in this scenario, the user-defined data type is created first, user-defined data type is created first, and then the array of tags is created.
and then the array of tags is created.
7 7 ---- 55 Monitoring Arrays and Tags of User-Defined Data Types in an RSLogix 5000 Project
E 2007 Rockwell Automation, Inc. All rights reserved.2007 Rockwell Automation, Inc. All rights reserved.
Rev. February 2007 Rev. February 2007
ADTsb56r Example: Addressing
Example: Addressing
To observe the temperature value for the tank in position [1,3], the following tag would be addressed in the ladder logic:
Tank[1,3].Temperature Tank[1,3].Temperature
To observe the preset of the timer for the tank in position [1,3], the following tag would be addressed in the ladder logic:
Tank[1,3].Time_Over_Temp.PRE Tank[1,3].Time_Over_Temp.PRE
To monitor arrays and user-def ined data types by performing the following actions:
• Monitor array tags through the Tags window
• Monitor tags of user -defined data type through the T ags window As your instructor demonstrates these procedures, follow along in
the associated job aid(s).
Note that prior to version 12, RSLogix Note that prior to version 12, RSLogix 5000 software optimized array indexing 5000 software optimized array indexing (indirect offset, such
(indirect offset, such as Table[taas Table[tag]) forg]) for single-dimensio
single-dimensional array nal array usingusing pre-defined data types. This
?
Identify other tags, such as the levelIdentify other tags, such as the level for the tank in position 1,4.for the tank in position 1,4.
Answer
Answer: Tank[1,4].Level: Tank[1,4].Level
Here’s How Here’s How
These procedures can be found in the These procedures can be found in the Procedures Guide under
Procedures Guide under Monitoring and Editing Tag Values through the Tags Window which is a subprocedure of which is a subprocedure of Monitoring and Editing Data in a
Logix5000 Controller ..
Open the
Open the CCP153_1756R_DCCP153_1756R_DEM3.acdEM3.acd file. When demonstrating the listed
S In In the the Controller-scoped Controller-scoped tagstags collection, review the available collection, review the available arrays and tags of the User-defined arrays and tags of the User-defined data types.
data types.
S Review lReview ladder logadder logic created ic created withwith these tags.
these tags.
7--6
7--6 Monitoring Arrays and Tags of User-Defined Data Types in an RSLogix 5000 Project
E 2007 Rockwell Automation, Inc. All rights reserved.2007 Rockwell Automation, Inc. All rights reserved. Rev. Rev. February February 20072007 ADTsb56r
7 7 ---- 77