Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Exploring Data Structures

Important User Information


This documentation, whether, illustrative, printed, “online” or electronic (hereinafter “Documentation”) is intended for use only as
a learning aid when using Rockwell Automation approved demonstration hardware, software and firmware. The Documentation
should only be used as a learning tool by qualified professionals.

The variety of uses for the hardware, software and firmware (hereinafter “Products”) described in this Documentation, mandates
that those responsible for the application and use of those Products must satisfy themselves that all necessary steps have been
taken to ensure that each application and actual use meets all performance and safety requirements, including any applicable
laws, regulations, codes and standards in addition to any applicable technical documents.

In no event will Rockwell Automation, Inc., or any of its affiliate or subsidiary companies (hereinafter “Rockwell Automation”) be
responsible or liable for any indirect or consequential damages resulting from the use or application of the Products described in
this Documentation. Rockwell Automation does not assume responsibility or liability for damages of any kind based on the
alleged use of, or reliance on, this Documentation.

No patent liability is assumed by Rockwell Automation with respect to use of information, circuits, equipment, or software
described in the Documentation.

Except as specifically agreed in writing as part of a maintenance or support contract, equipment users are responsible for:
• properly using, calibrating, operating, monitoring and maintaining all Products consistent with all Rockwell Automation
or third-party provided instructions, warnings, recommendations and documentation;
• ensuring that only properly trained personnel use, operate and maintain the Products at all times;
• staying informed of all Product updates and alerts and implementing all updates and fixes; and
• all other factors affecting the Products that are outside of the direct control of Rockwell Automation.

Reproduction of the contents of the Documentation, in whole or in part, without written permission of Rockwell Automation is
prohibited.

Throughout this manual we use the following notes to make you aware of safety considerations:

Identifies information about practices or circumstances that can cause an explosion in a hazardous
environment, which may lead to personal injury or death, property damage, or economic loss.

Identifies information that is critical for successful application and understanding of the product.

Identifies information about practices or circumstances that can lead to personal injury or death, property
damage, or economic loss. Attentions help you:
• identify a hazard
• avoid a hazard
• recognize the consequence

Labels may be located on or inside the drive to alert people that dangerous voltage may be present.

Labels may be located on or inside the drive to alert people that surfaces may be dangerous temperatures.
Level 1: Logix - On Demand Exploring Data Structures

Before You Begin

About this Lab


When working with Rockwell Automation’s Integrated Architecture, hardware and instruction
data type structures provide the ability to create consistent variables for storage of data
necessary for instruction logic and hardware interface. In this lab you will:
 Explore data structures
This lab takes approximately 15 minutes to complete.

Hardware
To complete this lab, you will require the following hardware:
 PC-based programming workstation with access to the RAcbi learning environment

Software
To complete this lab, you will require the following software:
 Studio 5000 Logix Designer® version 32

Files
To complete this lab, you will require the following files:
 Machine_1_Lab12.ACD

Setup
To complete this lab, you will need to perform the following setup procedure:
1. Log on to your instance of the RAcbi learning environment.

© Rockwell Automation, Inc. All rights reserved. 1


Exploring Data Structures Level 1: Logix - On Demand

Explore Data Structures


Many complex instructions require the use of a backing tag that contains the elements
necessary for the internal instruction logic to interface with our logic external to the instruction.
Furthermore, when adding hardware to a project, relevant hardware data types are
automatically added to the project by the add-on profile (AOP). In this section of the lab, you will
locate and explore predefined and module defined data types.
1. If you have completed all labs up to this point in the Level 1: Logix - On Demand course,
then you may continue using your Machine_1.ACD file from previous labs:
a. Open the Studio 5000® environment.
b. Under Recent Projects, select your Machine_1 project:

1.b.

2. If you have NOT completed all labs up to this point in the Level 1: Logix - On Demand
course (e.g., you are just doing this individual lab as a refresher), then open the starting
file for this lab:

a. Use the shortcut on the desktop of your instance of the RAcbi learning
environment to open the LabFiles.
b. Open the Machine_1_Lab12.ACD file.

With the release of version 31 of the Logix Designer application, an Assets folder was added to
the Controller Organizer. Within the Assets folder, we find the Data Types folder. Prior to
version 31, the Data Types folder was a main folder itself (i.e., it was not subordinate to an
Assets folder). Within the Data Types folder, we find a Predefined folder that contains data
types that are predefined for use when creating instruction backing tags, along with the
elementary data types. We also find the Module Defined folder that contains module data types
that are added whenever we add a module to the I/O Configuration.

2 © Rockwell Automation, Inc. All rights reserved.


Level 1: Logix - On Demand Exploring Data Structures

3. Within the Controller Organizer of your project, expand the Assets and Data Types
folders and notice the Predefined and Module-Defined folders:

4. Expand the Predefined folder, locate the COUNTER data type, and double-click it to
view its structure:

© Rockwell Automation, Inc. All rights reserved. 3


Exploring Data Structures Level 1: Logix - On Demand

Whenever we would like to include a counter instruction (e.g., CTU, CTD) in our logic,
we create a tag of the COUNTER data type as a backing tag that contains the data for
interfacing with that instance’s internal logic. In this window, we see that the structure
includes seven members. To see what these various members do within the logic, we
can look to the instruction help.
5. Click the Cancel button to close the COUNTER: Data Type window.
6. In the top ribbon menu, expand Help and select Instruction Help:

7. Scroll down to the Timer/Counter Instructions and select the CTU instruction:

4 © Rockwell Automation, Inc. All rights reserved.


Level 1: Logix - On Demand Exploring Data Structures

8. Scroll down to the COUNTER Structure table and read through the descriptions of the
various elements:

Now we have a pretty good idea of how these members are used to interface with the
logic contained within the instruction. We could similarly learn about any instruction
predefined data type available within the Logix Designer application.
9. Close the instruction help window.
10. Collapse the Predefined folder.
11. Open the MainProgram Parameters and Local Tags and select the Edit Tags tab:

© Rockwell Automation, Inc. All rights reserved. 5


Exploring Data Structures Level 1: Logix - On Demand

12. In the bottom row of the table, create a Local tag named CTU and with the data type
COUNTER:

13. Expand your new tag and notice that it contains the required members, just as expected:

This tag could now be used as a backing tag for one instance of a CTU (or any other
counter) instruction.

6 © Rockwell Automation, Inc. All rights reserved.


Level 1: Logix - On Demand Exploring Data Structures

14. Select the square to the left of your CTU tag:

15. Press the Delete key on your keyboard to delete the tag.
16. Close the Parameters and Local Tags.

© Rockwell Automation, Inc. All rights reserved. 7


Exploring Data Structures Level 1: Logix - On Demand

17. Back within the Data Types folder, expand the Module-Defined folder:

8 © Rockwell Automation, Inc. All rights reserved.


Level 1: Logix - On Demand Exploring Data Structures

These are the data types that were automatically added to the Module-Defined folder
when we added the relevant hardware modules to our I/O Configuration. Just as with the
predefined data types, we can double-click on any of these data types to view its
structure.
18. Double-click the AB:1756_IB16F_NoTimestamp:I:0 data type.
Because we chose to not use the advanced timestamp functionality of the digital input
module in slot three, this will be the data type for our input data structure.
19. Notice that this structure contains a DINT Fault member and a 16 element array of
structures member named Pt:

The number 16 in square brackets at the end of the Data Type indicates that this is a 16
element array. The AB:1756_IB16F_SmallStruct:I:0 data type is another Module-Defined
data type. Of course, we could return to the Module-Defined folder to double-click the
sub-structure data type and view its contents, but we can also simply expand the sub-
structure here to view its contents.
20. Click the arrow next to the Pt member to expand the sub-structure:

So, the input structure data type for the digital input module in slot three contains a 16
element array (one element for each of the 16 points). Each element of the array
contains four Boolean members. The Data member indicates the current state of the
point (i.e., true or false, 0 or 1). There is also a Fault member to indicate if the point is
faulted.

© Rockwell Automation, Inc. All rights reserved. 9


Exploring Data Structures Level 1: Logix - On Demand

21. Click the Cancel button to close the Data Type window:

22. Back in the Module-Defined folder, double-click the AB:1756_OB16IEF:O:0 data type.
23. Notice that the data type contains a 16 element array of structures named Pt:

24. Click the arrow next to the Pt member to expand the sub-structure:

So, the output structure data type for the digital output module in slot four contains a 16
element array (one element for each of the 16 points). Each element of the array
contains two Boolean and two real members. The Data member allows us to turn the
output point on or off.

10 © Rockwell Automation, Inc. All rights reserved.


Level 1: Logix - On Demand Exploring Data Structures

25. Click the Cancel button to close the Data Type window:

26. Collapse the Assets folder.

© Rockwell Automation, Inc. All rights reserved. 11

You might also like