Published on February 28, 2014
ControlLogix Tags and Memory Structure
Tag Based Memory Tag based memory structure Tag based memory structures are used in many new PAC platforms. A tag is a friendly name for a memory address. In languages such as C++, VB.NET and Java the term ‘variable’ is used. The control industry calls these ‘variable’s’, tags. As an example: Instead of addressing a counter that is counting total number of parts with an address such as: C5:3, a tag named ‘TotalParts’ could be used and then assigned the data type of counter.
Tag Naming Tag names should describe the function or purpose of the tag. The name can be anything you want as long as the name follows these rules: Tag names can contain numbers, letters and a single underscore and are not case sensitive. The maximum name length is restricted to 40-characters. Tag names must begin with a letter or a single underscore but can not end with an underscore. They can not begin with a number. Mixed case is used for ease of reading such as: Conveyor_2 or Conveyor2 and not CONVEYOR_2 OR CONVEYOR2. When viewing tags in the RSLogix 5000 software the tags will be displayed in alphabetical order. Use this to your advantage when naming tags. Using the same word to start tag names from the same process areas will keep them grouped together. As an example: Conveyor2_motor Conveyor2_inputSensor Conveyor2_endOfConveyor Would keep all the tags associated with Conveyor2 grouped together.
Tag Data Types When a tag is created it must be assigned a data type. The data type is assigned based on the type of data that will be stored in the tag. There are many different data types. The five basic data types are: Bool Sint Int Dint Real Bit level data (0 or 1) 8-bit integer data (Single Integer) 16-bit integer data (Integer [same as N7]) 32-bit integer data (Double Integer) 32-bit floating point data (Floating Point)
Basic Data Types All words in ControlLogix processors are 32-bits Data Type Bits 31 16 15 Bool Not used Not used Sint Not used Not used Int Not used 8 7 Not used 1 0 0 or 1 -128 to 127 -32,768 to 32,767 Dint -2,147,483,648 to 2,147,483,647 Real -3.40282347E38 to -1.17549435E-38 (negative values) 0 1.17549435E-38 to 3.40282347E38 (positive values)
Data Structures Structure Data Type Type of Data Stored Counter Control structure for the counter instructions Timer Control structure for the timer instructions Control Control structure for the array instructions Motion Instructions Control structure for the motion instructions Motion Group Control structure for the motion group PID Control structure for the PID instructions Axis Control structure for an axis Message Control structure for the message instructions
Project Structure Before continuing with tags, data types and structures, it is important to understand the structure of a ControlLogix project. ControlLogix projects consist of: Tasks Programs Routines The next slide shows a graphical representation of this structure.
Project Structure Every project, shown in the light blue box labeled Project is required to have at least one: • Task • Program • Routine (Main) The white blocks in the diagram are required for every project.
Task There are two types of tasks: Continuous Periodic Every project must have one continuous task and it can be the only continuous task in the project. A project can have up to 32-tasks. A task is associated with a program and has two functions: It stores information necessary to schedule the programs execution. It sets and determines the execution priority for one or more programs.
Tasks Types Continuous A continuous task is represented by the white task box in the previous project structure graphic. Continuous tasks execute non-stop. Every project must have, and can have only one continuous task. Periodic The other tasks shown in the previous project structure graphic are periodic tasks. Periodic tasks are not required in a project. Periodic tasks interrupt the continuous task and executes for a prescribed length of time and at specific time intervals. When the time expires, the task executes one last time. Periodic rates can be from 1mS to 2000 seconds. The default period is 10mS.
Programs Each task requires at least one program. A task can have up to 32-programs. Only one program can execute at-a-time.
Routine Routines are where the executable code resides. Routines can be written in: Ladder Logic (This is what we will be using) Sequential Function Chart Function Block Diagram Structured Text There are two type of routines: Main routine Subroutine
Routines Main routine When a program executes the main routine executes first. The main routine is used to call (execute) other routines in the program (subroutines). The main routine is the same as LAD 2 in the RSLogix 500 and LogixPro software. Subroutine Any and all additional routines in a program are called subroutines. Subroutines are used to keep programs organized. They contain executable code just like the main routine and can be in any of the 4-languages mentioned earlier. Subroutines will only execute when they are called from the main routine or from another subroutine. Example: An assembly area might use a rotary indexer that has 10-different assembly stations. There can be 10-subroutines with each subroutine containing the program code that controls one of the assembly stations. These subroutines are called from the main routine or from other subroutines.
Tag Types and Scope Tag types: Program tags The program tag area is represented by the violet box in the memory structure graphic shown on a previous slide. Tags used for a program are stored in that program and have a scope of that program. Scope The scope of a tag is where and when that tag and its data is available. Some languages call scope, lifetime. The data in a program scope tag is only available when that program is running. The tag and it’s data are not available to any other program. When the program stops executing and transfers control to another program the tags in the program that has stopped are no longer available. Program level tags assist in keeping data organized and assist in security by providing data hiding. For this course we will only be using one program and most of the tags created will be at that programs scope.
Tag Types and Scope Tag types: Controller tag Controller tags, shown in the white box near the top of the memory structure graphic is an area of memory that saves global tags. Global tags are tags that are available to the entire project; all tasks, programs and routines. I/O data and system-shared data are examples of global tags.
RSLogix 5000 Project
Tag Based Addressing There are two types of tags: Base tag Alias For tag Base Tag All instructions have a base tag. The base tag is a tag name that represents the process function and is assigned a data type appropriate for that function. Example: A mixing vessel on the north side of the plant might have a base tag named: North_Vessel_Mixer and if this tag is being used to turn on/off the mixer motor it would be assigned the data type of Bool (0 or 1).
Tag Based Addressing Alias For tag: An Alias For tag is another name for a Base Tag. At this point in the course we will use Alias For tags to assign an I/O point to a Base tag. Example: If the mixer motor controller is wired to an output module in slot 2, output 14, the I/O point would be assigned using an Alias For tag. Therefore; the base tag: North_Vessel_Mixer would be assigned an Alias For tag of: Local:2:O.Data.14
I/O Tag Format The form for a physical address in the ControlLogix processor is: Location:Slot:Type.Member.Submember.Bit Location: specifies the network location for the data. Local is used if the I/O module is in the same rack as the processor module. An adapter name is used to identify a remote communication adapter such as a DeviceNET remote I/O block. (Not used in this course)
I/O Tag Format Slot Just like in the Rack/Slot addressing format of the SLC500’s, the slot designates the slot number of the I/O module. Type Type specifies one of four types of data: I for inputs O for outputs C for configuration S for status
I/O Tag Format Member Member specifies the type of data that the module can store. Digital (discrete) I/O modules use a DATA member. Analog I/O modules use a Channel Member (CH#). (EMEC245/PTRT5083)
I/O Tag Format Submember (optional) A submember is specific data related to a member. This will be talked about when needed. Bit (optional) The bit, just like in the Rack/Slot addressing format of the SLC500’s, specifies a bit number for internal instructions or an input/output for I/O modules. Delimiters Only two delimiters are used; Colons (:) and periods (Dots) (.) Note that the forward slash (/) is not used as the bit delimiter as it is in the SLC500 series. If an address is a control-type tag, a (C) will automatically be placed at the end of the address to indicate that the tag is a controller scoped tag.
I/O Tag Format Therefore: If a base tag is assigned to a Start Push Button on process 1, that is wired to the input module in slot 7, IN 8, and if this input module is in the same rack as the controller, the base tag might be: Process1_StartPB and then it would be assigned an Alias For of: Local:7:I.Data.8(C) There is no submember for this Alias For. Here is the good thing. You don’t have to remember the address structure for I/O because it can be selected from a pop-up dialog box in the RSLogix 5000 program. But it’s still a good idea to understand the structure.
Intro RSLogix 5000 Lab The next lab will be an instructor led introduction to RSLogix 5000 and will cover: (Take notes! There is no lab document) Starting a new project Configuring the hardware Configuring communications Entering ladder logic Creating tags and data types ControlLogix timers and counters Downloading the project and running the program.
References Rehg, J. A., & Sartori, G. J. (2007). Programmable Logic Controllers (2nd ed.). Upper Saddle River, New Jersey, USA: Pearson Prentice Hall. Page 91.