Logix for Programmers
IAOT-SP004B-EN-E 2/20/2007
1 of 112
IAOT-SP004B-EN-E 2/20/2007
2 of 112
ABOUT THIS HANDS-ON LAB __________________________________________________7 LAB MATERIALS ___________________________________________________________8 DOCUMENT CONVENTIONS ____________________________________________________9 NEW V16 START PAGE _____________________________________________________10 LAB 1: USING MULTI-TASKS/MULTI-PROGRAMS IN LOGIX (20 MINUTES) ___________________13 ABOUT THIS LAB __________________________________________________________13 LAUNCHING A PROJECT IN RSLOGIX 5000 PROGRAMMING SOFTWARE __________________13 BREAKING UP THE CURRENT PROGRAM TO USE MULTIPLE TASKS _____________________15 DIVIDING SECTIONS OF CONVEYOR CODE INTO PROGRAMS IN THE CONTINUOUS TASK ______25 LAB 1 SUMMARY __________________________________________________________32 LAB 2: LAYING OUT THE TAG DATABASE IN A LOGIX CONTROLLER (40 MINUTES) ____________33 ABOUT THIS LAB __________________________________________________________33 OPENING AN EXISTING CONTROLLER FILE _______________________________________33 CREATING A USER-DEFINED DATA TYPE FOR A CONVEYOR __________________________33 USING THE CONVEYOR UDT _________________________________________________41 USING DATA SCOPING ______________________________________________________57 OPENING AN EXISTING CONTROLLER FILE _______________________________________58 DATA SCOPING THE PROGRAM _______________________________________________58 LAB 2 SUMMARY __________________________________________________________63 LAB 3: CODE RE-USE (15 MINUTES)_______________________________________________64 ABOUT THIS LAB __________________________________________________________64 OPENING AN EXISTING CONTROLLER FILE _______________________________________64 IAOT-SP004B-EN-E 2/20/2007
3 of 112
CODE RE-USE USING COPYING AND PASTING ____________________________________ 64 CODE RE-USE USING THE LADDER PARTIAL IMPORT/EXPORT TOOL ____________________ 66 OPENING AN EXISTING CONTROLLER FILE _______________________________________ 67 USING THE LADDER PARTIAL IMPORT/EXPORT TOOL TO EXPORT TO A L5X FILE___________ 67 OPENING AN EXISTING CONTROLLER FILE _______________________________________ 68 USING THE LADDER PARTIAL IMPORT/EXPORT TOOL TO IMPORT A L5X FILE _____________ 68 LAB 3 SUMMARY __________________________________________________________ 73 LAB 4: PORTABILITY OF LOGIX PLATFORMS (10 MINUTES) ______________________________ 74 ABOUT THIS LAB __________________________________________________________ 74 OPENING AN EXISTING CONTROLLER FILE _______________________________________ 74 PORTING A PROJECT BETWEEN LOGIX PLATFORMS ________________________________ 74 LAB 4 SUMMARY __________________________________________________________ 80 LAB 5: ALIASING IN THE LOGIX PLATFORM (15 MINUTES) ______________________________ 81 ABOUT THIS LAB __________________________________________________________ 81 OPENING AN EXISTING CONTROLLER FILE _______________________________________ 81 ASSIGNING ALIAS TAGS_____________________________________________________ 81 LAB 5 SUMMARY __________________________________________________________ 91 LAB 6: OFFLINE PROGRAM MEMORY ESTIMATION (10 MINUTES) _________________________ 92 ABOUT THIS LAB __________________________________________________________ 92 OPENING AN EXISTING CONTROLLER FILE _______________________________________ 92 OFFLINE MEMORY ESTIMATION TOOL___________________________________________ 92 LAB 6 SUMMARY __________________________________________________________ 98
IAOT-SP004B-EN-E 2/20/2007
4 of 112
LAB 7: DOWNLOADING THE PROJECT (5 MINUTES) ___________________________________99 ABOUT THIS LAB __________________________________________________________99 SECTION A: DOWNLOADING TO THE CONTROLLOGIX CONTROLLER ____________________99 OPENING AND DOWNLOADING AN EXISTING CONTROLLER FILE _______________________99 LAB 8: ONLINE PROGRAMMING (15 MINUTES) ______________________________________102 ABOUT THIS LAB _________________________________________________________102 LAB 8 SUMMARY _________________________________________________________112
IAOT-SP004B-EN-E 2/20/2007
5 of 112
Welcome to Logix for Programmers Hands-On Lab About This Hands-On Lab Welcome to this Hands-On Lab series! This session provides you with an opportunity to explore the Logix platform. The following sections explain what you’ll be doing in this lab session, and what you will need to do to complete the hands-on exercises. Experienced PLC programmers will learn how to take full advantage of core Logix programming features that set it apart from traditional programmable controllers. You will take advantage of the Multi-Tasking/Multi-Program model, memory layout, and learn editing and programming tips to increase your productivity. This will be accomplished by making you the head Logix programmer at an OEM. The engineer that was working with you has left the company and you now must complete the project for him. The engineer was a traditional PLC user. You know that the end customer has specified a Rockwell Automation Logix system for the job. You have heard of the powerful features that set it apart from traditional PLCs. As you start to look at the project you notice that the engineer had programmed the project as if he was still using a traditional PLC. You decide to make changes to take advantage of the Logix features. What You Will Accomplish In This Lab As you complete the exercises in this hands-on session, you will be able to perform common programming tasks in Logix in a more productive way than with traditional PLCs. This will be accomplished by showing how to utilize:
Multiple Tasks
Multiple Programs
User Defined Data Types (UDTs)
Data Scoping
Code Re-use
Portability between Logix platforms
Aliasing
Offline Memory Estimation
Downloading and testing your program
Who Should Complete This Lab This hands-on lab is intended for individuals who:
Are familiar with programming SLCs, PLC5s, or Logix controllers.
Have completed the Introduction to Logix Lab.
Are familiar with RSLogix 5000 software.
IAOT-SP004B-EN-E 2/20/2007
7 of 112
Lab Materials For this Hands-On lab, we have provided you with the following materials that will allow you to complete the labs in this workbook. Software This hands-on lab uses the following software:
RSLogix 5000 programming software
RSLinx
Files This hands-on lab uses the following files which are located in the Working Folder on the computer desktop:
Conveyor_Program_S1.ACD
Conveyor_Program_S2.ACD
Conveyor_Program_S3.ACD
Conveyor_Program_S4.ACD
Conveyor_Program_S5.ACD
Conveyor_Program_S6.ACD
Conveyor_Program_S7.ACD
Conveyor_Program_S8.ACD
Conveyor_Program_S9_CLX.ACD
Conveyor_Program_S9_CPX.ACD
Look_up_a_bar_code.ACD
IAOT-SP004B-EN-E 2/20/2007
8 of 112
Document Conventions Throughout this workbook, we have used the following conventions to help guide you through the lab materials. This style or symbol:
Indicates:
Words shown in bold italics (e.g., RSLogix 5000 or OK)
Any item or button that you must click on, or a menu name from which you must choose an option or command. This will be an actual name of an item that you see on your screen or in an example.
Words shown in Courier text, enclosed in single quotes (e.g., 'Controller1')
An item that you must type in the specified field. This is information that you must supply based on your application (e.g., a variable). Note: When you type the text in the field, remember that you do not need to type the quotes; simply type the words that are contained within them (e.g., Controller1).
FYI
The text that follows this symbol is supplemental information regarding the lab materials, but not information that is required reading in order for you to complete the lab exercises. The text that follows this symbol may provide you with helpful hints that can make it easier for you to use this product.
Note: If the mouse button is not specified in the text, you should click on the left mouse button.
IAOT-SP004B-EN-E 2/20/2007
9 of 112
New V16 Start Page Beginning with V16 RSLogix 5000 will incorporate a Start Page that opens when you open the software. This start page has numerous features to help beginners to advanced programmers take advantage of the advanced features built into RSLogix 5000 software.
The Start Page has three main areas: IAOT-SP004B-EN-E 2/20/2007
10 of 112
1. Quick Start area:
Open an Existing Project.
Start a New Project.
Open a Sample Project.
View all Sample Projects.
View Getting Started Videos.
2. Learning Center
Watch Videos that showcase the new features in V16 such as AOI’s.
Get topic specific Help
3. Resource Center
View online Books
Access and Download Firmware from the Online Logix Firmware site.
Access and Download Software updates from the Logix Software site.
4. Close the Start Screen by clicking on the Close icon in the upper right corner of the screen.
5. You can view the start page again at any time by clicking on View and then Start Page.
IAOT-SP004B-EN-E 2/20/2007
11 of 112
Lab 1: Using Multi-Tasks/Multi-Programs in Logix (20 minutes) About This Lab In this lab we will introduce the Multi-Task/Multi-Program model in Logix. This will show the ease in program layout over traditional PLCs. You will take an existing program that was programmed with techniques used in traditional PLCs and modify it to take advantage of using Multi-Tasks/MultiPrograms in Logix. The existing program contains ladder code for 3 conveyor segments and a temperature loop. In this lab you will:
open an existing controller file
move a PID loop from the continuous task to a periodic task
use multiple programs in the continuous task to segment the programming of the 3 conveyors for ease of use
Launching a Project in RSLogix 5000 Programming Software In this section of the lab, you will launch the RSLogix 5000 software, which will allow you to program the project. 1. From the computer desktop, double-click on the Lab Files folder. 2. Double-click on the Logix for Programmers folder to view its contents. 3. Double-click on the existing project called Conveyor_Program_S1.ACD.
IAOT-SP004B-EN-E 2/20/2007
13 of 112
This will launch the project in RSLogix 5000. The Controller Organizer appears on the left side of the RSLogix 5000 window, with a Controller folder called Conveyor_Program.
FYI Controller Organizer The Controller Organizer is a graphical representation of the contents of your controller file. This display consists of a tree of folders and files that contain all of the information about the programs and data in the current controller file. The default main folders in this tree are: Controller File Name - contains controller-scoped tags, controller fault handler and the power up handler. Tasks - tasks are shown in this folder. Each task shows its own programs with routines and program-scoped tags. Trends - trends are shown in this folder. Data Types - shows predefined and user-defined data types. User-defined data types are created in this folder.
IAOT-SP004B-EN-E 2/20/2007
14 of 112
I/O Configuration - contains the information about the hardware configuration of this controller file. It holds a hierarchy of modules with which the controller is configured to communicate. In front of each folder, there is a square containing a + sign or a - sign. The + sign indicates that the folder is closed. Click on it to expand the tree display and display the files in the folder. The - sign indicates that the folder is already open and its contents are visible.
Breaking Up the Current Program to Use Multiple Tasks After looking through the Controller Organizer you notice that your engineer laid out the program as if it were a traditional PLC. You remember from past experience that this made coding, troubleshooting, and adding additional conveyor segments difficult. You have decided to take full advantage of Logix and break out the routines into 4 separate programs: one program for each conveyor and a periodic task for the temperature loop.
FYI Tasks in Logix Controllers The Logix controllers can utilize 3 types of tasks: Continuous, Periodic, and Event. You can define up to 32 tasks in a ControlLogix controller. (Note: FlexLogix, DriveLogix and CompactLogix controllers support 8 tasks) Continuous Task - The continuous task runs in the background. Any controller execution time not allocated to other tasks or operations (motion, periodic tasks, event tasks, communications, or diagnostics) is used to execute the continuous task. The continuous task runs all the time. When it has completed execution of a full scan, it restarts. A project does not need to contain a continuous task. If used, a project can only contain one continuous task. Typical Use: If you want the code to scan all the time. Periodic Task - A periodic task performs a task at a specified period. You can configure the execution rate from .1ms to 2000s. Whenever the period for the periodic task expires, the periodic task will interrupt any lower priority task, execute one time, and return control to whatever task it interrupted. Typical Use: If you want to execute code at a constant period or multiple times within the continuous task’s scan. Event Task - An event task performs a specific function based on an event or trigger. Triggers can be a digital input, an analog input, motion operations, a consumed tag, or an event instruction. When the event occurs the event task will interrupt any lower priority task, execute one time, return control to whatever task it interrupted. Typical Use: If you want to execute code as soon as an event or trigger occurs.
IAOT-SP004B-EN-E 2/20/2007
15 of 112
1. From the Controller Organizer, expand the MainProgram folder by clicking on the +. Once the MainProgram is expanded it will appear as follows:
If you double-click on the MainRoutine, you can see that the engineer was trying to segment the program by using JSRs to go to the conveyors and temperature loop. If you then doubleclick on the Conveyor_1 routine you will notice that there are JSRs to the routines that deal with that conveyor. This is the way a traditional PLC does program segmentation. This is not taking advantage of Logix. The first thing you notice is that the temperature loop is coded in the MainTask which is a continuous task.
FYI Task Icons A Continuous Task folder Icon looks as follows: An Event Task folder Icon looks as follows: A Periodic Task folder Icon looks as follows:
You know that it is best to program a PID loop by using periodic tasks. So the first thing you decide to change is moving the Temperature_Loop routine into a periodic task.
IAOT-SP004B-EN-E 2/20/2007
16 of 112
2. Right click on the Tasks folder and select New Task.
The New Task window will appear.
FYI New Task Dialog Box From this window you configure the properties of a new task. This window changes based on the type of task you choose. There are two new configuration options for every task type (starting with V12): Disable Automatic Output Processing to Reduce Task Overhead - At the end of a task output processing is performed. The controller goes through the I/O tree and updates the state of outputs affected by the task. By disabling output processing the task will execute faster. If you have a periodic task that is only doing data manipulation and has no outputs you would want to disable output processing. Or, if you have only a few outputs that are manipulated by the task you may want to disable output processing and use the IOT (Immediate Output instruction), output processing done immediately. IAOT-SP004B-EN-E
2/20/2007
17 of 112
You can also enable and disable output processing programmatically through application code by using the SSV (Set System Variable) instruction. Inhibit Task - This feature allows you to prevent a task from executing. This is used during system commissioning to isolate and test a specific task by inhibiting other tasks in the project. You can also inhibit and uninhibit a task programmatically through application code by using the SSV (Set System Variable) instruction. 3. Configure the new periodic task to match the data below. When finished click on OK
IAOT-SP004B-EN-E 2/20/2007
18 of 112
4. Verify that the Tasks section of the Controller Organizer appears as follows:
Currently there is no program defined in the Temperature_Loop periodic task. 5. To add a program, right click on Temperature_Loop and select New Program.
6. When the New Program dialogue box appears, enter ‘PID_Loop’ in the name field, then click OK.
IAOT-SP004B-EN-E 2/20/2007
19 of 112
7. Click on the + sign to expand the PID_Loop program you just added to the Temperature_Loop periodic task. You will notice that there are no routines assigned in this program yet.
We will not have to create a new routine. We will drag the Temperature_Loop routine from the continuous task to the periodic task. 8. Put the pointer over the routine Temperature_Loop; click and hold the left mouse button. 9. Drag the Temperature_Loop routine and place it over the PID_Loop program in the periodic task and release the mouse button.
10. Verify that the routine Temperature_Loop was added to the PID_Loop program as shown below:
Next we will have to configure the PID_Loop program to have a main routine which will be the Temperature_Loop routine we just dragged and dropped.
IAOT-SP004B-EN-E 2/20/2007
20 of 112
11. Right click on PID_Loop and then select Properties.
The Program Properties window will appear.
12. Click on the Configuration tab.
IAOT-SP004B-EN-E 2/20/2007
21 of 112
The configuration tab will become active. You notice that no Main routine has been assigned.
FYI Main and Fault Routines For a Program you can assign two types of routines: Main and Fault. You must always assign a Main Routine. A Fault Routine is optional. The Main Routine is the first routine that is executed when the program is executed. For example, in our case, when the Program PID_Loop is executed it will start with the Temperature_Loop routine. This is equivalent to a MCP for a PLC5 or File 2 for a SLC. The Fault Routine lets you use code to clear specific faults and let the controller resume execution. Do not program the Fault Routine to globally clear all MajorRecoverable Faults.
We want to assign the Temperature_Loop routine as the Main Routine.
IAOT-SP004B-EN-E 2/20/2007
22 of 112
13. To do this click on the down arrow of the selection box next to Main. 14. Select Temperature_Loop and click Apply.
This has assigned the Temperature_Loop routine as the Main routine. Click OK to close the Program Properties window. 15. Double-click on the Temperature_Loop routine. This will open the ladder logic editor. Because the PID instruction used to be in the Continuous Task, a timer had to be use to condition the PID’s execution.
IAOT-SP004B-EN-E 2/20/2007
23 of 112
Now that the PID is being executed in a Periodic Task, the timer condition is no longer needed. Delete rung zero and the timer done condition (XIC) on rung one.
16. From the File menu select Save As. The Save As window appears. 17. When the Save As window appears, type ‘Conveyor_Program_S2’ in the name field and then click on Save. If asked to replace the file click Yes.
IAOT-SP004B-EN-E 2/20/2007
24 of 112
Dividing Sections of Conveyor Code into Programs in the Continuous Task Now that you have completed moving the temperature loop into the periodic task you decide to divide each conveyor’s code into its own program. This will allow for easier coding, troubleshooting, and adding additional conveyor segments in the future. You will keep working in the program from the previous section, Conveyor_Program_S2.
FYI A Logix controller lets you divide your application into multiple programs, each with its own data. There is no need to manage conflicting tag names between programs. This makes it easier to re-use code and tag names in multiple programs. Currently we are only concerned with using multiple programs. Later we will learn to manage tag names.
1. In the Controller Organizer, right click on the MainTask folder and select New Program.
The New Program window will appear.
IAOT-SP004B-EN-E 2/20/2007
25 of 112
2. Create a program by typing ‘Conveyor_1’ in the Name field. Then click on OK.
3. From the Controller Organizer, verify that you have 2 programs in the Continuous Task: MainProgram and Conveyor_1.
4. Drag and drop the 4 routines from the MainProgram into the Conveyor_1 program. These routines are C1_Alarm_Status, C1_Energy_Manag, C1_Start_Stop, and Conveyor_1.
IAOT-SP004B-EN-E 2/20/2007
26 of 112
5. When finished, verify the Controller Organizer appears as follows:
Next we must assign a Main Routine to the program Conveyor_1. Remember that a program must always have a Main Routine.
IAOT-SP004B-EN-E 2/20/2007
27 of 112
6. Right click on the program folder Conveyor_1 and select Properties.
The Program Properties window will appear.
IAOT-SP004B-EN-E 2/20/2007
28 of 112
7. Click on the Configuration tab. The Configuration tab will become active. We want to assign the Conveyor_1 routine as the Main Routine. 8. To do this, click on the down arrow of the selection box next to Main. Select Conveyor_1 and click Apply.
9. Click on OK to close the Program Properties window. In the Controller Organizer the program structure now appears as below. You notice the next to the routine Conveyor_1. This designates it as the Main Routine for Program Conveyor_1.
10. Repeat steps 1 through 9 for the other 2 conveyors.
IAOT-SP004B-EN-E 2/20/2007
29 of 112
11. When you have completed creating the programs for the other 2 conveyors, verify that the program structure in the Controller Organizer appears as shown below:
In the Continuous Task the MainProgram is no longer needed. We will now remove it from the program. First we will have to remove the MainProgram from the Continuous Tasks list of scheduled programs to run. 12. Right click on the MainTask folder and select Properties.
IAOT-SP004B-EN-E 2/20/2007
30 of 112
13. When the MainTask Properties window appears, click on the Program/Phase Schedule tab.
14. To unschedule the program, highlight MainProgram, click on Remove, and then click Apply. The program has now been unscheduled and will no longer be executed by the controller. By looking at the figure below, you see that the MainProgram now appears in the Unscheduled list.
FYI Program Scheduling Program scheduling allows you to determine the order in which the programs in a Task are executed. In the previous figure, the execution order would be Conveyor_1, Conveyor_2, and then Conveyor_3. You can change the execution order by highlighting a program and using the up and down move arrows. Unscheduled programs are still downloaded to the controller, but not executed.
15. Click on OK to close the Task Properties window. IAOT-SP004B-EN-E 2/20/2007
31 of 112
16. Save the program by clicking on the Save icon
on the toolbar.
17. From the File menu select Close.
Lab 1 Summary In this lab we took an existing program that was programmed using techniques used in traditional PLCs and modified it to take advantage of using Multi-Tasks/Multiple-Programs in Logix. This allows for easier coding, troubleshooting, and code expansion.
IAOT-SP004B-EN-E 2/20/2007
32 of 112
Lab 2: Laying Out the Tag Database in a Logix Controller (40 Minutes) About This Lab In this lab, we will discuss and show how to layout the tag database using User Defined Data Types and Data Scoping. In this lab, you will:
Learn about the advantages of using UDTs
Learn how to optimize the layout of UDTs
Use Data Scoping to help make development easier and faster
We will continue modifying the program from Lab 1. We will now concentrate on Data layout in a Logix controller.
Opening an Existing Controller File In this section of the lab, you will open an existing program. 1. From the computer desktop, double-click on the Lab Files folder. 2. Double-click on the Logix for Programmers folder to view its contents. 3. Double-click on the existing project called Conveyor_Program_S3.ACD. This will launch the project in RSLogix 5000.
Creating a User-Defined Data Type for a Conveyor Since you have reorganized the program layout to take advantage of Logix, you are now ready to start reorganizing the data layout. You notice that the engineer had laid out the data as if he was using a traditional PLC with Integer, Real, and Timer data tables. The problem is that it’s tough to keep track of the data associated with a device when it is spread out all over the controller’s memory. Again, you have decided to take full advantage of Logix and use User Defined Data Types.
FYI User-Defined Data Types User Defined Data Types also know as UDTs or structures, let you organize or group data logically, so all of the data associated with a device can be grouped together. For example, each conveyor has 8 Integer values, 3 Real values, 2 Timers, and 11 Booleans associated with it. In a traditional PLC, 4 different data tables would be needed. Then, when you have multiple conveyors you would need to map out the conveyors into each data table. This becomes hard to manage. IAOT-SP004B-EN-E
2/20/2007
33 of 112
What a UDT allows you to do is group the different data types together (Integer, Real, Timer, Boolean, etc), in a User-Defined Data type. You can then create an array of that UDT type. This makes programming, documenting the code, and tracking of the data easier. 1. From the Controller Organizer, double-click on Controller Tags.
The Tag Editor will appear. You notice that the Tag Data base has the look and feel as if it was a traditional PLC.
FYI Logix Tag Database In a traditional PLC a physical address identifies each item of data, such as N7:0 or B3:0/0. Without using address comments or symbols, it was very difficult to read logic. In Logix controllers there is no fixed memory, N7:0 or B3:0/0. The Logix memory is a tag based system. The tag name itself identifies the data. This lets you organize your data to mimic your machine. You can actually document your code with the tag names you assign, for example Nozzle_1_Temperature.
IAOT-SP004B-EN-E 2/20/2007
34 of 112
FYI Guidelines for creating tags for a Logix project
Guideline
Details:
1) Create user-defined data types.
User-defined data types (structures) let you organize your data to match your machine or process. A user-defined data type provides these advantages: One tag contains all the data related to a specific aspect of your system. This keeps related data together and easy to locate, regardless of its data type. Each individual piece of data (member) gets a descriptive name. This automatically creates an initial level of documentation for your logic. You can use the data type to create multiple tags with the same data lay-out. For example, use a user-defined data type to store all the parameters for a tank, including temperatures, pressures, valve positions, and preset values. Then create a tag for each of your tanks based on that data type.
2) 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 1, 2, or 3 dimensions to match what the data represents. For example, use a 2 dimension 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.
3) Take advantage of programscoped tags.
If you want multiple tags with the same name, define each tag at the program scope (program tags) for each different program. This lets you re-use both logic and tag names in multiple programs. Avoid using the same name for both a controller tag and a program tag. Within a program, you cannot reference a controller tag if a tag of the same name exists as a program tag for that program. Certain tags must be controller scope (controller tag). If you want to use 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 between Controllers
IAOT-SP004B-EN-E 2/20/2007
35 of 112
to communicate with a PanelView terminal none of the above 4) For integers, use the DINT data type.
program scope (program tags)
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.
5) 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
6) 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. These tags are easier to read:
Than these tags:
Tank_1
TANK_1
Tank1
TANK1 tank_1 tank1
7) Consider the alphabetical order of tags.
RSLogix 5000 software displays tags of the same scope in alphabetical order. To make it easier to monitor related tags, use similar starting characters for tags that you want to keep together. Starting each tag for a tank with Tank keeps the tags together.
Otherwise, the tags may end up separated from each other.
Tag Name
Tag Name
Tank_North
North_Tank
Tank_South
South_Tank
IAOT-SP004B-EN-E 2/20/2007
36 of 112
2. Click on the + next to N7 in the tag editor. This will expand the array N7 to show all the elements. You notice that data is defined from N7[0] through N7[7]. Then again from N7[20] through N7[27] and N7[40] through N7[47]. These areas are for each of the 3 conveyors, a traditional PLC data table layout.
3. Also look through B3, F8, and T4. They all follow the same format: Conveyor 1 starts at [0], Conveyor 2 starts at [20], and Conveyor 3 starts at [40]. This was done to try and make looking for a conveyor’s data in the tag database easier. This helps, but you are using 4 data tables for the conveyors and wasting memory. This would be better accomplished by creating a UDT. Let’s create a UDT now. 4. From the Controller Organizer under the Data Types folder, click on the + next to User-Defined.
IAOT-SP004B-EN-E 2/20/2007
37 of 112
You will notice that there is a UDT called Conveyor (Creation of the UDT was started for you).
5. Double-click on Conveyor. This will open the UDT editor for the Conveyor data type. As you can see the UDT is a mixture of different data types. This is a very useful tool when programming.
IAOT-SP004B-EN-E 2/20/2007
38 of 112
FYI Guidelines for User-Defined Data Types
When you create User-Defined Data Types, keep the following in mind:
If you include data that represents I/O devices, you must use logic to copy the data into the UDT. You can not alias I/O into a UDT.
If you include an array in the UDT, limit the array to a single dimension. Multidimensional arrays are not permitted in UDTs.
When you create the UDT, group like data types together. This creates a more compact UDT.
From looking at the UDT, you notice that like data types are not grouped together. BOOL and REAL data types are mixed. The size of the UDT is currently 52 bytes. This can be reduced by grouping the BOOLs together. 6. To do this, click to the left of Motor_Overload. This will select the entire row.
IAOT-SP004B-EN-E 2/20/2007
39 of 112
7. Click the Move Up button. This moves the Motor_Overload tag up in the UDT.
8. Repeat this with the other BOOL tags until they are all grouped together. 9. Click on Apply. Notice the size of the UDT now. You have saved 12 bytes. 10. When you have completed moving the BOOL tags, verify that the UDT appears as follows:
IAOT-SP004B-EN-E 2/20/2007
40 of 112
11. Back in Controller Tags, expand the N7 tag and notice N7[0] through N7[7] and their descriptions. 12. Add these tags to the UDT using their descriptions. Do this manually (and remember to reference guideline 4 from earlier). 13. When you are done, click Apply to accept your changes and verify that the UDT should look like the figure below.
You now have a completed UDT that defines a conveyor in the program. 14. Click on OK to close the UDT editing window. 15. From the File menu select Close. You will be asked to save changes made to the file, select No.
Using the Conveyor UDT You will now use the UDT conveyor you just created. You realize that the UDT will help optimize the tag database and make it easier to troubleshoot and develop code. 1. From the toolbar menu in RSLogix 5000, select File > Open. 2. Double-click on the existing project called Conveyor_Program_S4.ACD file. This will launch the project in RSLogix 5000.
IAOT-SP004B-EN-E 2/20/2007
41 of 112
3. From the Controller Organizer, double-click on Controller Tags. This will open the Tag Editor.
Looking in the tag editor you see a new tag in the database, Conveyor_1.
IAOT-SP004B-EN-E 2/20/2007
42 of 112
4. Click in the + next to Conveyor_1 to expand the tag. You notice that the tag has the same format as the UDT you just created. This is confirmed by looking in the Type column.
IAOT-SP004B-EN-E 2/20/2007
43 of 112
5. From the Controller Organizer, expand the 3 Conveyor programs in the Continuous Task by clicking on the + for each program.
6. Double-click on the routine C2_Start_Stop. This will open the routine for viewing and editing.
IAOT-SP004B-EN-E 2/20/2007
44 of 112
7. Now displayed is the ladder routine C2_Start_Stop. You notice that in this case the addressing for Conveyor_2 is still using traditional PLC addressing. For example, on rung 0 the Timer is addressed as T4[20].
8. Double-click on the routine C1_Start_Stop. This will open the routine for viewing and editing.
IAOT-SP004B-EN-E 2/20/2007
45 of 112
9. Now displayed is the ladder file C1_Start_Stop. You notice that the addressing for Conveyor 1 is using the UDT. As you can see, the code is now self-documenting and the tag name describes what it is. You do not need to add a description to the address like you do in traditional PLCs. There are some older style addresses still in the code; we will take care of them later.
Now let’s go through and update the other two Conveyor programs to use UDTs. First we will need to create two new tags. 10. From the toolbar menu, select Window > Controller Tags – Conveyor_Program(controller). This will bring the tag editor window to the front.
IAOT-SP004B-EN-E 2/20/2007
46 of 112
11. From the bottom left corner of the tag editor window, click on the Edit Tags tab.
From here we will create two new tags, Conveyor_2 and Conveyor_3. 12. In the Tag Editor, at the bottom of the list, notice that there’s an open space to create a new tag. 13. In the Name: Column enter ‘Conveyor_2’ and in the Type column enter ‘Conveyor’. This is creating a tag called Conveyor_2 of type Conveyor.
While the pencil icon is still visible on the record, you’re still in edit mode. 14. To create your new tag, click in the new empty row below Conveyor_2 and verify that the tag editor appears as follows:
15. Using the same methodology as above, create a tag for Conveyor_3.
IAOT-SP004B-EN-E 2/20/2007
47 of 112
16. When you are finished, verify that the tag data base appears as follows:
IAOT-SP004B-EN-E 2/20/2007
48 of 112
Now we will need to update the ladder code to use these new tags. We will start with Conveyor_2. We will only modify the Alarm_Status and Energy_Manag routines. Use the tables below and refer to the Conveyor_1 routines.
IAOT-SP004B-EN-E 2/20/2007
49 of 112
Let’s start with an example. 17. From the Controller Organizer, double-click on the routine C2_Alarm_Status. IMPORTANT: For now we will ignore any B3 addresses that have the word “mapped” in the description. 18. On rung zero, notice the OTE instruction with the description C2 Motor Overload. By looking at the figures on the previous page, you see that this description matches the second member in the UDT.
19. To change the address double-click on B3[28]. This will open a pull down box so you can select a new tag.
IAOT-SP004B-EN-E 2/20/2007
50 of 112
20. Click on the down arrow (this will open the Tag Browser) and scroll through the list until you find Conveyor_2. 21. Click on the + to expand the tag, and then select Conveyor_2.Motor_Overload as shown below:
22. Double-click on Conveyor_2.Motor_Overload. This makes Conveyor_2.Motor_Overload the new tag for the OTE instruction. 23. Click on the white space in the tag editor and verify that the rung appears as follows (again, notice the self documenting code):
24. Now, go through and finish updating this routine. Then update the Energy_Manag routine for Conveyor 2. 25. Repeat the same steps for Conveyor 3. 26. You notice that the tag Conveyor_2.Motor_Overload does have a description. With V12 and earlier versions of RSLogix 5000, descriptions entered in the UDT editor were not shown outside the UDT editor.
FYI UDT Pass Through and Append Description Options IAOT-SP004B-EN-E
2/20/2007
51 of 112
Starting in version 13 of RSLogix 5000, there are 2 new settings under Workstation Options.
If you enable pass-through descriptions, then whenever you do not provide an explicit description for a tag:
The base tag’s description will be displayed if the tag is an alias, or
The defined data type’s member description will be displayed if the tag is a member, or
The base tag's description will be displayed if the tag is a bit, array element, or member, or
The defined base data type's description will be displayed.
If you check this checkbox, the Append to Base Tag Descriptions checkbox is enabled. Check the Append to Base Tag Descriptions checkbox if you want to make the base tag description part of the pass-through description. Add any additional description according to pass-through description rules. Before this feature, you would have to manually cut the descriptions from the UDT editor and manually paste them into the tags in the Tag Editor. This added many hours of programming. Let us look at how this new feature works. 27. From the Controller Organizer, under the Data Types folder, click on the + next to UserDefined.
You will notice that there is a UDT called Conveyor.
IAOT-SP004B-EN-E 2/20/2007
52 of 112
28. Double-click on the word Conveyor. This will open the UDT editor for Conveyor data type.
29. Add in some descriptions for the members of the UDT and click Apply when you’re finished. 30. Change the description of the UDT as shown below:
IAOT-SP004B-EN-E 2/20/2007
53 of 112
31. Click on Apply and then OK to close the UDT editor. 32. From the Controller Organizer, double-click on the routine C2_Alarm_Status. You notice now that the descriptions you entered are now present on the tags. The description is the UDT description (Conveyor Data) + the UDT member description (Motor Overload Indication).
33. From the toolbar menu, select Tools > Options.
IAOT-SP004B-EN-E 2/20/2007
54 of 112
The Options window will appear.
34. Under Application, click on Display. The window will appear as follows.
35. Position the WorkStation Options window so you can see it and the OTE instructions in the routine C2_Alarm_Status. IAOT-SP004B-EN-E 2/20/2007
55 of 112
36. Click on the check box next to Append To Base Tag Descriptions to turn this option off and then click on Apply to accept your changes. You notice that the description has changed. The UDT description Conveyor Data has been removed.
37. Click on the check box next to Show Pass-Through Descriptions to turn this option off and then click on Apply to accept your change. You notice that the description has changed again. There is nothing there. This is how the rung would have appeared in V12 and earlier of RSLogix 5000.
IAOT-SP004B-EN-E 2/20/2007
56 of 112
38. Turn both options back on and then click Apply and then Ok. 39. When you are done, click on the Save icon. 40. From the File menu select Close.
Using Data Scoping In this lab you will learn about the advantages of data scoping. You have just used User-Defined Data Types to better organize your tag database and create self documenting code. The next and last thing that you want to do is better scope the tags to the program level. This is data scoping. Data Scoping allows you to:
Use the same tag names between programs because program scoped tags are isolated from one another.
Develop standard code that can be copied multiple times without worrying about tag name collisions.
Freedom from having to manage tag names and data locations.
Speed the development of projects.
FYI Data Scoping When you create a tag, you define it either as a controller tag (global data) or a program tag for a specific program (local data).
A Logix controller lets you divide your application into multiple programs. There is no need to manage conflicting tag names between programs. This makes it easier to re-use both code and tags names in multiple programs. IAOT-SP004B-EN-E 2/20/2007
57 of 112
Data at the program scope is isolated from other programs. Routines cannot access data that is at the program scope of another program. You can re-use the tag name of a program scoped tag in multiple programs.
Opening an Existing Controller File In this section of the lab, you will open an existing program. 1. From the toolbar menu in RSLogix 5000, select File > Open. 2. Double-click on the existing project called Conveyor_Program_S5.ACD file. This will launch the project in RSLogix 5000.
Data Scoping the Program 1. From the Controller Organizer, double-click on Controller Tags to open the tag editor. 2. Verify that you are on the Edit Tags tab (if you are not, you will not be able to perform the Cut/Paste operations).
IAOT-SP004B-EN-E 2/20/2007
58 of 112
When the Tag editor opens you will notice that many of the old tags are missing (N7, F8, T4). These tags were no longer needed after creating the conveyor UDT and modifying the code. The tags Conveyor_1, Conveyor_2 and Conveyor_3 took their places. The F9 and PD files were changed to tag names instead of data table numbering like a traditional PLC. The T10 file was deleted after moving the PID to the periodic task.
Now we want to move the tags Conveyor_1, Conveyor_2 and Conveyor_3 from the controller scope to the program scope. 3. Double-click on the Data Type column. This will better sort the tags for the editing we will do.
First we will move the tags Temp_Loop_PID, Control_Output, and Process_Variable to the Temperature_Loop program scope. 4. Click to the left of the tag Temp_Loop_PID. This will select the entire row.
IAOT-SP004B-EN-E 2/20/2007
59 of 112
5. Hold the shift key and click to the left of the tag Process_Variable. This will select all 3 tags.
6. From the toolbar menu, select Edit > Cut.
7. From the Scope pull-down menu, click on the down arrow. Click on the + next to Programs to expand the tag. This will show all current controller and program tag data bases.
8. Select PID_Loop scope as shown below:
This will open the tag editor for the program scoped tags for the program PID_Loop.
IAOT-SP004B-EN-E 2/20/2007
60 of 112
FYI
In the pull down, the
before the name designates the controller scoped tags. The
controller is called Conveyor_Program. So Conveyor_Program means the controller scoped tags. All the other names in the list are program names or equipment phases in the controller. Currently no tags have been defined at the program scope level for PID_Loop. We will now paste in the tags we cut in step 7. 9. Click in the open tag name file so the Cursor appears as shown below:
10. From the toolbar menu, select Edit > Paste.
11. Verify that the 3 tags are pasted in as shown below:
IAOT-SP004B-EN-E 2/20/2007
61 of 112
12. Switch back to the Controller scope tags. It will appear as follows:
13. Cut/Paste the tag Conveyor_1 to the program scope of Conveyor_1. 14. Cut/Paste the tag Conveyor_2 to the program scope of Conveyor_2. 15. Cut/Paste the tag Conveyor_3 to the program scope of Conveyor_3. 16. When you are done, verify that the only tag that left in the Controller scope is B3.
17. When you have completed moving the tags, click on the Verify Controller icon
.
You will get 4 errors, but they are okay. The errors deal with the Simulator program. Earlier, we stated that data at the program scope is isolated from other programs. Routines cannot access data that is at the program scope of another program. However, you can re-use the tag name of a program scoped tag in multiple programs. Let’s prove this by going into the program scope tags for all 3 conveyors and changing the tags names Conveyor_1, Conveyor_2, and Conveyor_3 all to Conveyor. 18. Select Conveyor_1 from the Scope pull-down menu.
IAOT-SP004B-EN-E 2/20/2007
62 of 112
19. Change the tag name ‘Conveyor_1’ to ‘Conveyor’.
20. Modify the other 2 tags, Conveyor_2 and Conveyor_3 with the same name. 21. When you have completed changing the tag names, click on the Verify Controller icon
.
You will get 4 errors, but they are okay. The errors deal with the Simulator program. You did not get any errors about duplicate tags. That is because program scope tags are isolated from one another.
FYI Data scoping tags makes it easier to re-use both code and tag names in multiple programs. You could create in this case a program called conveyor which uses program scoped tags. You could then add this program into the project as many times as you have conveyor segments and never have to modify the code or tags.
25. From the toolbar menu, select File > Close. 26. When asked to save changes select No.
Lab 2 Summary In this lab, you learned how to layout memory using User Defined Data Types and Data Scoping.
Learned about the advantages of using UDTs
Learned how to optimize the layout of UDTs
Learned how the Show Pass-Through Descriptions and Append To Base Tag Description options can save engineering and code documenting time
Learned about the advantages of Data Scoping
IAOT-SP004B-EN-E 2/20/2007
63 of 112
Lab 3: Code Re-use (15 minutes) About This Lab In this lab you will build on the idea from the end of the last lab. That is, when you create a program that uses program scope tags, re-using code and tag names is easier, which makes development easier. In this lab you will:
Open an existing file
Re-use a program multiple times in the project thru copying and pasting
Re-use ladder code in the project thru the Ladder Partial Import/Export tool
Opening an Existing Controller File In this section of the lab, you will open an existing program. 1. From the computer desktop, double-click on the Lab Files folder. 2. Double-click on the Logix for Programmers folder to view its contents. 3. Double-click on the existing project called Conveyor_Program_S6.ACD. This will launch the project in RSLogix 5000.
Code Re-use Using Copying and Pasting You observe that in every system design there is always one temperature loop and 2 or more conveyor segments. You decide to create a rough template of a project to use as a starting point. It contains one temperature loop and one conveyor segment. You will use this template project to create the code for a system with 10 conveyor segments. From the Controller Organizer you see the baseline program: one Conveyor program and the Temperature_Loop Task. You will need to add 9 conveyor segments to get to the total of 10 specified for the project.
IAOT-SP004B-EN-E 2/20/2007
64 of 112
1. From the Controller Organizer, right click on the Conveyor program and select Copy.
2. From the Controller Organizer, right click on the MainTask and select Paste.
IAOT-SP004B-EN-E 2/20/2007
65 of 112
This added in a copy of the original conveyor segment code and incremented the program name.
3. Repeat the steps above to add in the remaining eight conveyor segments. 4. When you are finished, verify that the Controller Organizer appears as follows:
5. When you are done, click on the Save icon. 6. From the File menu select Close.
Code Re-use Using the Ladder Partial Import/Export Tool Sometimes in a system, a conveyor segment will need to have a Bar Code station. It is used in the system by the first and/or last conveyor segments. You could add it into the template code, but you would then have to delete this code from the middle sections, in this case 9 conveyor segments. In the system you are programming, you will only need to add it to the first conveyor segment. Before, you have used the scrap file method by cutting rungs of ladder and saving them as scrap files on the desk top. But when you pasted the scrap files back in, you would have to spend time creating all the tags. You are looking for something easier and faster.
IAOT-SP004B-EN-E 2/20/2007
66 of 112
FYI Ladder Partial Import/Export Tool This is a new feature available with version 13 and higher of RSLogix 5000. The basic function that the Ladder Partial Import/Export tool provides is the ability to extract specific rungs of code from a project and store them in an external file (L5X). Later, you can import the code back into any RSLogix 5000 project. The significant difference is that the Partial Import/Export feature is not limited to just the ladder rungs, like scrap files. The export file contains all the tag definitions, UDTs, and associated comments. As a result of this capability, when the file is imported, everything is created and the result is code that verifies with no errors. Extending this even further, RSLogix 5000 provides a dialog listing all the associated tags, UDTs, and descriptions so you can modify them before the import occurs. This helps to avoid potential tag naming collisions.
Opening an Existing Controller File In this section of the lab, you will open an existing program. This file contains the code you want to add into the first conveyor segment’s code. 1. From the computer desktop, double-click on the Lab Files folder. 2. Double-click on the Logix for Programmers folder to view its contents. 3. Double-click on the existing project called Look_up_a_bar_code.ACD. This will launch the project in RSLogix 5000.
Using the Ladder Partial Import/Export Tool to Export to a L5X File 1. From the Controller Organizer, double click on the MainProgram folder to expand it. This is where the bar code station code is located. Once the MainProgram is expanded it will look like the following.
2. Double-click on the MainRoutine to open the ladder editor. 3. From the toolbar menu select Edit > Select All. This will select all the rungs in the routine.
IAOT-SP004B-EN-E 2/20/2007
67 of 112
4. Right click to the left of rung zero and select Export Rung. 5. When the Export Rung window appears, enter the File name as shown below, then click Export.
The exported ladder file (L5X) was created. 6. From the File menu select Close.
Opening an Existing Controller File In this section of the lab, you will open an existing program. 1. From the computer desktop, double-click on the Lab Files folder. 2. Double-click on the Logix for Programmers folder to view its contents. 3. Double-click on the existing project called Conveyor_Program_S6.ACD. This will launch the project in RSLogix 5000.
Using the Ladder Partial Import/Export Tool to Import a L5X File 1. From the Controller Organizer, double-click on the Conveyor program folder to expand it. This is where we will add the Bar Code station code. Once Conveyor is expanded it will appear as follows:
IAOT-SP004B-EN-E 2/20/2007
68 of 112
2. Right click on the Conveyor program and select New Routine. 3. When the New Routine window appears, enter the parameters as follows and then select OK.
4. Verify that the Conveyor program now appears as follows:
5. Double-click on C_Bar_Code to open the routine in the ladder editor.
IAOT-SP004B-EN-E 2/20/2007
69 of 112
6. Right click over rung 0 and select Import Rung.
7. When the Import Rung window appears, click on the file Look_up_bar_code.L5X and then click on Import.
IAOT-SP004B-EN-E 2/20/2007
70 of 112
The Import Configuration window will appear.
FYI Import Configuration The Import Configuration has 2 tabs: Tags and Data Types. Tags - These are all the tags that are associated with the ladder being imported. You can change any tag name before the import is performed. You will also be warned if a tag name already exists in the project.
This will allow you to change the tag name if you know it will cause an issue. Data Types - This will show any UDTs that are coming in with the import. It will show if the UDT does not exist and will be created or if it exists and will use the existing UDT. This tab is for information only.
IAOT-SP004B-EN-E 2/20/2007
71 of 112
8. Change the Tag Name lane to ‘line_number’, then click into the next tag field below to accept the change.
You have just modified a tag name while you are importing the ladder. 9. Click on OK to start the Import. When the Import finishes, you have completed ladder code. All tags are created in the correct scope (Conveyor in this case).
IAOT-SP004B-EN-E 2/20/2007
72 of 112
10. Verify you see the following in the ladder editor:
11. Scroll to the top of the C_Bar_Code routine and delete the empty rung zero. You will now have to add a rung in the main routine Conveyor to JSR to the C_Bar_Code routine. 12. When you are done click on the Save icon. 13. From the File menu select Close.
Lab 3 Summary You just realized that it took you less than 15 minutes to create your core program. This used to take a few hours. You would have had to copy code, change addresses, document the addresses, and verify everything was done correctly.
IAOT-SP004B-EN-E 2/20/2007
73 of 112
Lab 4: Portability of Logix Platforms (10 Minutes) About This Lab In this section of the lab we will show the ease with which you can move between the Logix platforms. In this lab you will:
Use the program from the previous lab section
Change the Controller type defined in the project
Opening an Existing Controller File In this section of the lab, you will open an existing program. 1. From the toolbar menu in RSLogix 5000, select File > Open. 2. Double-click on the existing project called Conveyor_Program_S6.ACD. This will launch the project in RSLogix 5000.
Porting a Project Between Logix Platforms You know from past experience that you will not sell all your conveyor systems based on one controller. You will pick the controller based on the size and system requirements of each customer. In the past this caused you to have programs for every controller you used. This was because with a traditional PLC, moving between platforms was not easy or could not be done. Usually this was because the different platforms were not based on a ‘core’ architecture. This added development time and cost to your projects. This required multiple programming software packages. With the Logix platform this is not an issue. All Logix controllers, ControlLogix, FlexLogix, SoftLogix, CompactLogix, and DriveLogix are all based on the same ‘core’ Logix engine. This means that a program developed for CompactLogix can be easily ported to ControlLogix with a few simple steps. 1. From the controller faceplate in RSLogix 5000, click on the Controller Properties button.
IAOT-SP004B-EN-E 2/20/2007
74 of 112
The Controller Properties window will appear.
Currently, the project is setup to use a 1769-L31 CompactLogix controller. For the current job you are doing, the customer has specified a 1756-L62 controller. This is a hardware change. In the past this would mean more engineering time, but with Logix this is not the case.
IAOT-SP004B-EN-E 2/20/2007
75 of 112
2. Click on the Change Controller… button. The Change Controller Type window will appear.
3. Click on the down arrow to expand the Type controller selection.
By scrolling through the list you can select all Logix controllers.
IAOT-SP004B-EN-E 2/20/2007
76 of 112
4. Scroll through the list until you see 1756-L62 ControlLogix5562 Controller.
5. Click on 1756-L62 ControlLogix5562 Controller to select it as the controller you would like to change to.
6. Click OK to change from a 1769-L31 controller to a 1756-L62 controller.
IAOT-SP004B-EN-E 2/20/2007
77 of 112
The Change Controller Type Warning window will appear.
These warnings make sense. The I/O modules used in a CompactLogix controller are different from a ControlLogix Controller. In the case of the program we are converting, we will have no issues. We did not define any I/O. 7. Click Yes to make the change.
IAOT-SP004B-EN-E 2/20/2007
78 of 112
The Controller Properties window now shows that the controller type is a 1756-L62 ControlLogix Controller. You also notice that the program was verified and has no errors. That is all that is needed to change a program. That was easy.
8. Now try changing from a 1756-L62 to a 1756-L55 Controller. When you do the conversion, the warning is shorter this time. This is because the I/O for a 1756-L62 and 1765-L55 controller is the same.
9. Select Yes. 10. Close the Controller Properties window by clicking OK. IAOT-SP004B-EN-E 2/20/2007
79 of 112
11. From the File Menu select Close. 12. When asked to save changes select No.
Lab 4 Summary With Logix, portability between platforms is not an issue. All Logix controllers, ControlLogix, FlexLogix, SoftLogix, CompactLogix, and DriveLogix are all based on the same ‘core’ Logix engine. This means that a program developed for any Logix controller can be easily ported to another Logix controller with a few simple steps.
IAOT-SP004B-EN-E 2/20/2007
80 of 112
Lab 5: Aliasing in the Logix Platform (15 Minutes) About This Lab In this section of the lab we will show that Aliasing makes project development easier and faster. In this lab you will:
Open an existing project
Alias tags currently in the program to I/O points
Opening an Existing Controller File In this section of the lab, you will open an existing program. 4. From the computer desktop, double-click on the Lab Files folder. 5. Double-click on the Logix for Programmers folder to view its contents. 6. Double-click on the existing project called Conveyor_Program_S7.ACD. This will launch the project in RSLogix 5000.
Assigning Alias Tags One of the hardest things when programming a traditional PLC is dealing with I/O. As the project is being developed, you may not know all the details about the I/O in the system. People have done several things to work around this:
Create mapping routines. That is, map an input to an internal bit and map an internal bit to an output.
Create place holders. When the I/O layout is complete, search and replace on the place holders.
Wait until the I/O layout for the system is complete, then start coding
These just add time and aggravation to project development. With Logix you do not have to do these I/O work arounds. We avoid this by using Aliasing.
FYI What is Aliasing and when do I use it? An alias tag lets you create one tag that represents another tag:
Both tags share the same value
When the value of one of the tags changes the other tag changes as well
Use aliases in the following cases: IAOT-SP004B-EN-E 2/20/2007
81 of 112
Program logic in advance of having completed I/O layouts
Assign a descriptive name to an I/O point.
Provide a simpler name for a complex tag.
The most common use of aliasing is to program logic before completing I/O layouts. For each I/O device, create a descriptive name that describes the device, such a Conveyor_Start_Push_Button. Program your logic using the descriptive tag names. Test your logic without I/O connected. Later, when the I/O layouts are complete, add the I/O modules to the I/O configuration of the controller. Finally, convert the descriptive tags to aliases for their respective I/O connections. There are 2 limitations that you should be aware of when using Aliasing:
You can not Alias I/O into a UDT
You can not change an Alias online
For this lab the I/O points are defined as follows: 1756-IB16D in slot 2
Point 0 = Conveyor_Start_Push_Button
Point 1 = Conveyor_Stop_Push_Button
Point 2 = Entrance_PE
Point 3 = Exit_PE
Point 4 = Conveyor_EStop_Push_Button
Point 5 = Motor_Overload_Input
1756-OB16D in slot 0:
Point 0 = Conveyor_Start_Command
IAOT-SP004B-EN-E 2/20/2007
82 of 112
1. From the Controller Organizer, notice that
There is only one Conveyor program in the Continuous or Main Task
2 I/O modules have been added to the I/O Configuration.
2. From the controller faceplate in RSLogix 5000, click on the Controller Properties button.
The Controller Properties window appears.
IAOT-SP004B-EN-E 2/20/2007
83 of 112
3. Notice that the controller type is a 1756-L63 as shown below:
4. Close the Controller Properties window by clicking on Cancel. 5. Now expand the Conveyor program by clicking on the + next to the Conveyor folder.
6. Once the Conveyor program is expanded, double-click on Program Tags to open the tag editor.
IAOT-SP004B-EN-E 2/20/2007
84 of 112
When the tag editor appears, you will notice that it has opened to the Scope of Conveyor (program Scope). If you had double-clicked on Controller Tags it would have been at the controller Scope.
You will also notice that there are several new tags. These were originally in the B3 tag, which existed in the controller scope. They have been moved for data scoping and renamed to use Logix tag naming conventions.
Let’s start with the Conveyor_Start_Command tag. Because this is an output we will alias it to an output. From earlier we said that Point 0 = Conveyor_Start_Command. 7. In the tag editor, click in the Alias For column next to Conveyor_Start_Command. Note: make sure the Edit Tags tab is selected in the lower left corner of the tag window.
IAOT-SP004B-EN-E 2/20/2007
85 of 112
8. Click on the down arrow. This will open the tag browser.
Scroll down in the Tag Browser list until you see the following tags.
The output module is in slot 0 and we want output point 0. This would relate to an address of Local:0:O.Data.0. 9. Click on the + to expand Local:0:O. 10. Now on the expansion click on Local:0:O.Data.
IAOT-SP004B-EN-E 2/20/2007
86 of 112
11. Click on the down arrow and select point 0.
When you clicked on point 0 the browser closed and you returned to the tag editor. 12. Verify that the tag editor appears as follows:
The (C) next to Local:0:O.Data.0 means that the tag is in the Controller scope. The Alias For column now contains the address of the Conveyor_Start_Command. These 2 tags are now equal. 13. From the Controller Organizer, double-click on the routine C_Start_Stop.
IAOT-SP004B-EN-E 2/20/2007
87 of 112
14. When the ladder editor appears, look at rung 1.
Notice that under the tag Conveyor_Start_Command is . This means that Conveyor_Start_Command is an Alias for Local:0:O.Data.0. The two tags are equivalent. This will be updated throughout the code. Now let us Alias the Conveyor_Start_Push_Button on rung 0. 15. This time, right click on the tag Conveyor_Start_Push_Button and then select Edit “Conveyor_Start_Push_Button” Properties.
16. When the Tag Properties window appears, click on Alias from the Type pull-down menu.
IAOT-SP004B-EN-E 2/20/2007
88 of 112
17. Notice that the dialog field Alias For is now active.
18. Click on the down arrow to open the tag browser.
The tag browser is currently set to browse all tags. 19. Earlier we stated that Point 0 = Conveyor_Start_Push_Button. This input card is in slot 2, so we want to Alias to Local:2:I.Data.0.
IAOT-SP004B-EN-E 2/20/2007
89 of 112
20. When finished, verify that the Tags Properties appears as follows:
21. Click on Apply then OK to close the Tag Properties window. Notice that under the tag Conveyor_Start_Push_Button is . This means that Conveyor_Start_Push_Button is an Alias for Local:2:I.Data.0. The two tags are equivalent. This will be updated throughout the code.
22. Alias the remainder of the inputs as follows, some of them are in other routines:
Point 1 = Conveyor_Stop_Push_Button
Point 2 = Entrance_PE
Point 3 = Exit_PE
Point 4 = Conveyor_EStop_Push_Button
Point 5 = Motor_Overload_Input
23. When you have completed Aliasing the remaining 5 inputs, click on the Save icon
.
24. From the toolbar menu, choose File > Close.
IAOT-SP004B-EN-E 2/20/2007
90 of 112
Lab 5 Summary As you can see, Aliasing brings a project together seamlessly. You no longer need to worry about when the I/O layout for a system will be finished.
IAOT-SP004B-EN-E 2/20/2007
91 of 112
Lab 6: Offline Program Memory Estimation (10 Minutes) About This Lab In this lab you we will show the use of the Offline Program Memory Estimation tool that is built into RSLogix 5000. In this Lab you will:
Open an existing file
See the features of the Offline Program Memory Estimation Tool
Opening an Existing Controller File In this section of the lab, you will open an existing program. 1. From the computer desktop, double-click on the Lab Files folder. 2. Double-click on the Logix for Programmers folder to view its contents. 3. Double-click on the existing project called Conveyor_Program_S8.ACD. This will launch the project in RSLogix 5000.
Offline Memory Estimation Tool Prior to version 13 with Logix controllers the only way to know how much memory was used by a project was to download to the controller and check online or use a spread sheet that had memory information. This gave you a very rough estimate. With version 13 and above of RSLogix 5000 you can do this offline and accurately. 1. From the controller faceplate in RSLogix 5000, click on the Controller Properties button.
IAOT-SP004B-EN-E 2/20/2007
92 of 112
2. When the Controller Properties window appears, click on the Memory tab.
FYI Memory Option The Memory Option is set to the controller type you have selected for the project. In our example we have a 1756-L63 controller selected. If you would like to see if the program will fit into a 1756-L55M13 all you would need to do is change the controller type for the project and then come back to the memory tab.
IAOT-SP004B-EN-E 2/20/2007
93 of 112
3. Click on the Estimate button. Notice that the memory usage data has changed.
FYI Memory Tab Information Depending on the type of controller you select, the information shown will change. For L55, L61, L62, and L63 controller’s data shown:
Estimated I/O memory
Estimated Data and Logix Memory
Estimated Logix Memory (L55M16 only)
For L33, L34, L31, L32 and L35E controller’s data shown:
Estimated Data and Logix Memory (These controllers do not contain I/O memory)
The green, yellow, and red bars are static. They are like a stop light: green means keep going, memory usage is okay; yellow means caution, slow down you are starting to get close; and red means you should look at moving to another controller with more memory. IAOT-SP004B-EN-E 2/20/2007
94 of 112
This tool can also be used online to measure memory usage during controller execution. During runtime, the Max Used (high water mark) will typically be higher than Used. This is because controller memory is allocated and de-allocated during runtime in all areas. 4. Based on what you learned in Lab 4, change the controller type for this project to a 1756-L55. 5. When you are finished changing the controller type, go back to the Memory Tab.
6. Click on the Estimate button. 7. Notice you have used a small amount of both I/O Memory and of Data and Logic Memory:
IAOT-SP004B-EN-E 2/20/2007
95 of 112
8. Double-click on Controller Tags to open the tag editor.
9. When the Tag Edit opens, make sure you are on the Edit Tags tab.
10. Create a tag called ‘Big_Array’ in the Controller Scope with an array size of 300000.
11. From the toolbar menu, select Window > Controller Properties – Conveyor_Program.
IAOT-SP004B-EN-E 2/20/2007
96 of 112
12. When the Controller Properties window is brought back to the front it will be on the Memory Tab. Click on the Estimate button.
You have calculated negative memory usage in the Estimated Data and Logic Memory section. This means you have exceeded the memory limit of the controller. 13. Click on the down arrow of the selection box next to Memory Option.
This shows all the valid memory configurations for the 1756-L55 controller.
IAOT-SP004B-EN-E 2/20/2007
97 of 112
14. Select the 1756-L55M13.
15. Click on the Apply button. The memory usage for the controller is recalculated.
The 1756-L55M13 controller has enough memory for the project.
16. Close the Controller Properties window by clicking OK. 17. From the File menu select Close. 18. If asked to save changes select No.
Lab 6 Summary The Offline Memory Estimation Tool is a new and powerful aid in project development. Prior to version 13 of RSLogix5000 you had to download to a controller to determine memory usage. You can now determine the right controller memory size easily during development, rather than in the field. This becomes even more important when:
Using ControlLogix redundancy, when using redundancy I/O and data memory will double in usage, you will use memory up at a faster rate.
When moving forward from previous versions of Logix to V13 or higher. You can determine if the application size will grow and no longer fit in the controller you have.
IAOT-SP004B-EN-E 2/20/2007
98 of 112
Lab 7: Downloading the Project (5 minutes) About This Lab In this lab you will open a controller project based on the Demo Box that is at your station. You will:
Determine the type of controller you are using
Open the project that corresponds to the controller you are using
Download the program to the controller
Section A: Downloading to the ControlLogix Controller In this section of the lab you will:
Open an existing file
Download the project to the controller
Opening and Downloading an Existing Controller File In this section of the lab, you will open and download an existing program. 1. From the computer desktop, double-click on the Lab Files folder. 2. Double-click on the Logix for Programmers folder to view its contents. 3. Double-click on the existing project called Conveyor_Program_S9_CLX.ACD. This will launch the project in RSLogix5000. 4. The project was written for a L63 Processor located in slot 1 as shown below.
IAOT-SP004B-EN-E 2/20/2007
99 of 112
5. Look at your Demo Case and determine what type of Processor you have and what slot it is in. 6. If your Processor is not a 1756-L63 then you must change the processor type in the project to match what you actually have. 7. If it is not in Slot 1 then you can re-configure your Demo Case to match this project.
IAOT-SP004B-EN-E 2/20/2007
100 of 112
8. From the toolbar menu, select Communications > Who Active
9. In RSLinx Browse until you locate your controller. 10. Click on your Controller. 11. Click Download. 12. When asked to change the controller to run mode, select Yes. If you were not asked to change the controller to run mode, use the key switch to place the controller into run mode
Now proceed to Lab 8.
IAOT-SP004B-EN-E 2/20/2007
101 of 112
Lab 8: Online Programming (15 Minutes) About This Lab In this lab you will:
Add I/O online.
Use the Browse Logic feature
You will use the program that you are online with from the previous lab.
FYI NEW IN VERSION 15 Add I/O Online Beginning in Version 15 you can add I/O at runtime and online to the local chassis, to the unscheduled portion of the ControlNet, and remotely via an Ethernet I/O network. Prior to V15 you could not add any I/O once you were Online. You had to go offline and then download after you added I/O to your project. In this lab you will see how easy it is to add I/O online.
1. You should be online from the previous lab. If not go back and follow the steps to go online with your controller. Make sure the controller is in Run mode. 2. Look in the I/O configuration area of the project. Currently your project should be configured like the picture shown below:
3. We will be adding a Module to Slot 3. (No matter what is physically in your slot 3)
IAOT-SP004B-EN-E 2/20/2007
102 of 112
4. Right click on the chassis and select New Module.
5. Click on the By Vendor tab. 6. Scroll through the list of Modules. Notice how some are “Grayed Out”. These are not available to be inserted online. Anything not Grey is available.
IAOT-SP004B-EN-E 2/20/2007
103 of 112
7. Scroll through the list and pick 1756-IF8.
8. Select OK and enter the following module configuration:
IAOT-SP004B-EN-E 2/20/2007
104 of 112
9. Select OK and notice the Warning Dialog that is displayed.
10. Since this is just a Lab, Select Yes. If this were a running system, you would want to consider what may happen when you put the module into the system. Make sure you have configured the module properly before you say yes to this dialog.
11. The Module will be inserted in the I/O configuration.
IAOT-SP004B-EN-E 2/20/2007
105 of 112
12. Set the RPI and say OK.
Some Things to Consider when adding a module on a Network.
The module will be added to the Unscheduled portion of a ControlNet.
You must have enough unscheduled bandwidth for the module to function.
On a ControlNet network you will have to run RsNetworx for ControlNet to move the module from the unscheduled portion to the Scheduled portion of the network. You will have to put the controller in program mode to accomplish this.
FYI Logic Browser A new feature as of version 13 of RSLogix5000 is Browse Logic. Browse Logic is meant to give a table of contents view of key logic components. It helps provide users with the ability to easily locate a particular section of code with the help of program documentation. What does Browse Logic find in each language? Ladder - All rungs, rung comments, tag descriptions (destructive references only), instructions, tag/operand descriptions, and tag information via tooltip. Function Block Diagrams - All sheets, all block tags, attached/unattached text boxes, and tag information via tooltip. Sequential Function Charts - All steps, transitions, and action tags, attached/unattached text boxes, and tag information via tooltip. IAOT-SP004B-EN-E
2/20/2007
106 of 112
Structured Text - All lines, tags (destructive references only), and tag information via tooltip. This tool is for both offline and online use. 1. To show the use of the Browse Logic tool you will use it to find the “Easter Egg” in the program. From the Search menu select Browse Logic.
The Browse Logic window will appear.
This looks very similar to what is under the Tasks section of the Controller Organizer.
IAOT-SP004B-EN-E 2/20/2007
107 of 112
2. Double-click on the Simulation periodic task to expand it. 3. Keep expanding the folder and routines under it. When you are done the window should appear as follows.
As you can see it gives you the table of contents. Now use the tool to find the “Easter Egg”. Hint: there are 2 ways to do it. One is much easier than the other. Below we will go thru both methods and start with the more difficult one.
IAOT-SP004B-EN-E 2/20/2007
108 of 112
4. Let us start by expanding the MainTask, just like we did for the Simulation Task.
No Easter Egg here.
IAOT-SP004B-EN-E 2/20/2007
109 of 112
5. Now expand the TemperatureLoop.
You found the Easter Egg. It was in a rung comment in the Temperature_Loop routine. If you click on Rung 0 and then click on the Go To button it will take you to that rung, but do not do that yet. 6. The easier way to find the Easter Egg is to enter ‘Easter Egg’ in the Find: field and then click on the find icon
.
IAOT-SP004B-EN-E 2/20/2007
110 of 112
It takes you right there - much faster!
7. Now click on the Go To button. Then click on Close. You are taken to that rung in the Ladder Editor.
You see the great potential this tool has. You could can put key ‘words’ in different places and use the Browse Logix tool to quickly navigate to those areas.
IAOT-SP004B-EN-E 2/20/2007
111 of 112
8. From the toolbar menu, select Communications > Go Offline.
9. From the File menu select Exit. If asked to save changes select No.
Lab 8 Summary In this lab we showed 2 new features that will help with online programming.
Ability to add new modules at runtime. It is no longer necessary to shut a running system down to make a functional change.
Browse Logic: Helps you to navigate more easily thru a project.
IAOT-SP004B-EN-E 2/20/2007
112 of 112