06 chapter03 04_control_logix_tags_memory_structure_fa14
DESCRIPTION
Chapter 03 Introduction to PLC Programming Slide set 04TRANSCRIPT
Chapter 03 Sect. 3-5-4, 3-6-5, 3-7-2
Tags and Memory Structure - ControlLogix
Tag Based Memory
Tag based memory structure Tag based memory structures are used in most
PLC/PAC platforms produced in the last 10-years.
A tag is a friendly name for a memory address. In languages such as C++, VB.NET, Java and many others, the term ‘variable’ is used. The control industry calls these ‘variable’s’, tags. As an example: Instead of addressing an input
device as I:4/12, a tag named ‘manualControl’ could be used and then assigned the data type of BOOL.
This tag is still assigned an address; however, the address is not visible to the end user.
Tag Naming - ControlLogix
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. They can not end with an underscore or begin with a number.
Mixed case is used for ease of reading such as: Conveyor_2 or Conveyor2 and not CONVEYOR_2 OR CONVEYOR2.
Invalid Tag Names
The following tag names are invalid: Conveyor2_motor_
This tag is invalid because a tag name cannot end with an underscore.
2Conveyor_motor This tag is invalid because a tag name cannot start
with a number.
Viewing/Sorting Tags
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_endOfConveyorConveyor2_inputSensorConveyor2_motor
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 Bit level data (0 or 1) Sint 8-bit integer data (Single Integer) Int 16-bit integer data (Integer [same as N7]) Dint 32-bit integer data (Double Integer) Real 32-bit floating point data (Floating Point)
Basic Data Types
Data Type Bits
31 16
15 8
7 1
0
Bool Not used Not used Not used 0 or 1
Sint Not used Not used -128 to 127
Int Not used -32,768 to 32,767
Dint -2,147,483,648 to 2,147,483,647
Real-3.40282347E38 to -1.17549435E-38 (negative values)
01.17549435E-38 to 3.40282347E38 (positive values)
All words in ControlLogix processors are 32-bits
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 only have 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 (SFC) Function Block Diagram (FBD) 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 tags 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, along with their data, 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, with subroutines 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.
Global tags should be used only when absolutely necessary.
RSLogix 5000 Project
Tag Based Addressing
There are two types of tags: Base tag Alias For tag
Base Tag All instructions have and need 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/LogixPro, 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/EMCNC107)
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/LogixPro, 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/LogixPro 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, IN8, 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 can be an instructor led or a self-paced introduction to RSLogix 5000 and will cover: Starting a new project Configuring the hardware Configuring communications Entering ladder logic Creating tags and data types Downloading the project and running the
program.