Exploring Elementary Data Types 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 Elementary Data Types Before You Begin About this Lab Many complex data structures within the Studio 5000 Logix Designer® application may be employed to simplify integration of hardware and use of advanced instructions. However, when we drill down into these structures, we find that their various elements are of data types from the list of elementary data types. In this lab you will: Explore elementary data types 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_Lab11.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 Elementary Data Types Level 1: Logix - On Demand Add Local Hardware Modules For our fundamental logic, we tend to use tags of the Boolean data type because they align with the data requirements of bit-level instructions. However, in addition to the Boolean data type, there are several other elementary data types with which we should be familiar. In this section of the lab, you will experiment with the various elementary data types to gain a better understanding of their use and limitations. 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_Lab11.ACD file. The help documentation that is installed with the Logix Designer application is extremely useful for answering specific questions that arise while creating a controller project. So, let’s take a look in the Logix Designer help to get an idea of the elementary data types available for our use. 2 © Rockwell Automation, Inc. All rights reserved. Level 1: Logix - On Demand Exploring Elementary Data Types 3. In the top ribbon menu of your Logix Designer project, expand Help and select Contents: 4. In the Search box of the browser that appears, type ‘Elementary Data Types’ and press Enter on your keyboard: © Rockwell Automation, Inc. All rights reserved. 3 Exploring Elementary Data Types Level 1: Logix - On Demand 5. Scroll down the list of Search Results and select Elementary data types: 6. Read through the resulting table of elementary data types to get an idea of available data types and their characteristics. Generally speaking, the original elementary data types found within the Logix Designer application were BOOL, SINT, INT, DINT and REAL. The three integer types were signed, using two’s complement representation. The 64 bit LINT was also available, but its use was somewhat limited. With the introduction of version 32, the 64 bit and unsigned integer data types became available for use in high-performance controllers (e.g., 1756-L8z, 5069-L3z). 7. 4 Close the Help browser. © Rockwell Automation, Inc. All rights reserved. Level 1: Logix - On Demand Exploring Elementary Data Types 8. Within the Controller Organizer of your Logix Designer project, locate and double click the Controller Tags: 9. Select the Edit Tags tab: © Rockwell Automation, Inc. All rights reserved. 5 Exploring Elementary Data Types Level 1: Logix - On Demand 10. Add the following tags to the table: 11. Select the Monitor Tags tab: 12. In the Value column for the BOOL tag, type ‘2’ and press Enter on your keyboard: 6 © Rockwell Automation, Inc. All rights reserved. Level 1: Logix - On Demand 13. Exploring Elementary Data Types Read the warning that appears and click the OK button: This is an example of what occurs when we attempt to write a value to a tag of a data type too small for the particular value. 14. Type ‘1’ for the BOOL Value and press Enter on your keyboard: 15. In the Value column for the SINT tag, type ‘5.5’ and press Enter on your keyboard: 16. Read the warning that appears and click the OK button: This is an example of what occurs when we attempt to write a decimal value to an integer tag. 17. Type ‘-100’ for the SINT Value and press Enter on your keyboard: © Rockwell Automation, Inc. All rights reserved. 7 Exploring Elementary Data Types Level 1: Logix - On Demand 18. Click the arrow next to the SINT tag to reveal its individual bits: 19. In the Value column for SINT.7, type ‘0’ and press Enter on your keyboard: The individual bits of an integer data type can be (and frequently are) used individually, rather than using the overall integer value. For example, instead of using an individual Boolean tag, we could assign SINT.7 to a bit-level instruction. In such cases, it is generally preferable to view the overall integer value in binary format, rather than decimal. 8 © Rockwell Automation, Inc. All rights reserved. Level 1: Logix - On Demand 20. Exploring Elementary Data Types In the Style column for the SINT tag, select Binary: Now we can see the individual bit values at a glance, without having to expand the integer. Furthermore, this allows us to see the bit values if we happen to use the overall integer value in an instruction such as a compare instruction. 21. Click the arrow next to SINT to once again collapse the tag: © Rockwell Automation, Inc. All rights reserved. 9 Exploring Elementary Data Types Level 1: Logix - On Demand 22. In the Value column for the USINT tag, type ‘-100’ and press Enter on your keyboard: 23. Read the warning that appears and click the OK button: This is an example of what occurs when we attempt to write a negative value to an unsigned integer tag. 24. Type ‘100’ for the USINT Value and press Enter on your keyboard: 25. In the Value column for the REAL tag, type ‘5.5’ and press Enter on your keyboard: The REAL and LREAL data types provide the necessary ability to work with decimal values. 26. Continue testing the functionality of the elementary data types until you are satisfied with your understanding of their capabilities and limitations. Now that we have seen how these data types function, we can delete the tags, as they serve here only as examples. However, to delete tags, the table must be on the Edit Tags tab. 10 © Rockwell Automation, Inc. All rights reserved. Level 1: Logix - On Demand 27. Select the Edit Tags tab: 28. Click the square to the left of the BOOL tag: © Rockwell Automation, Inc. All rights reserved. Exploring Elementary Data Types 11 Exploring Elementary Data Types Level 1: Logix - On Demand 29. While holding down the Shift key on your keyboard, click the square to the left of the LREAL tag: 30. Press the Delete key on your keyboard: 31. Close the Controller Tags. In these examples, we were working with controller tags. However, the same principles apply to local tags and program parameters as well. 12 © Rockwell Automation, Inc. All rights reserved.