tag based memory.pdf
TRANSCRIPT
-
Home
History
I/O Wiring
I/O Interaction
Number Systems
Memory Structure
Bit Instructions
Timers
Counters
LogixPro Labs
External Links
Site Map
Citation Page
Tag Based Memory Structures
Tag based memory structures are what most new generationPLC/PAC's use. A tag is a friendly name for a memory location. This
tag name also has a data type assigned.
In this section we will use the Allen Bradley ControlLogix PAC. Refer tothe manufacturer manual for other PAC brands.
AB ControlLogix Tag Based Memory Structure
As stated earlier, tags are the same as variables used in languages
such as C++, VB.NET or Java. Tag names should be assigned that aredescriptive to the data being stored in them. Example of tag namescould be:
Start_PBCould be a tag name for the start push button of a process.
Vessel01MixMotorA tag that could be for the mixer motor on process vessel 01.
_furnaceTemp
A tag name that could be use to store the temperature value readin a furnace.
Tag Naming Rules
There are several rules that must be followed when creating tagnames.
Tag names can contain numbers, letters (not case sensitive) andsingle underscore.
1.
The maximum length is restricted to 40 characters.2. Tag names must begin with a letter or an underscore but can notend with an underscore.
3.
Mixed case is used for ease of reading such as: Conveyor_2 orConveyor2 and not CONVEYOR_2 or CONVEYOR2.
4.
When viewing tags in the RSLogix 5000 software the tags will bedisplayed in alphabetical order. Use this to your advantage whennaming tags. Using the same word to start tag names from thesame process areas will keep them grouped together. As anexample:
Conveyor2_motorConveyor2_inputSensorConveyor2_endOfConveyor
5.
Tag Based Memory http://theplctutor.com/cntrllgxmem.html
1 of 7 19/06/2015 05:55
-
would keep all the tags associated with Conveyor2 groupedtogether.
When a tag is created it must be assigned a data type. The basic datatypes are 'basic' and 'structured'. The following tables outline the basicdata types and the most commonly used structures.
Basic ControlLogix Data Types
Data Types 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)
0
1.17549435E-38 to 3.40282347E38 (positive values)
Commonly Use Data Structures
Structure Data Type Type of Stored Data
Timer Control structure for timer instructions
counter Control structure for counter instructions
Control Control structure for array instructions
MessageControl structure for the messageinstructions
PID Structure for the PID instructions
ControlLogix Project structure
Before continuing with tags, data types and structures, it is importantto understand the structure of a ControlLogix project. ControlLogixprojects consist of Tasks, Programs and routines. The following is agraphical representation of a ControlLogix project. Refer to this
graphic during the following descriptions.
Tag Based Memory http://theplctutor.com/cntrllgxmem.html
2 of 7 19/06/2015 05:55
-
ControlLogix project structure
Project
A ControlLogix project (the large light blue box in the ControlLogixproject structure graphic above) contains all of the elements that makeup a program. Everything required for the program to function is
contained within the project.
Task
There are two types of tasks: continuous and periodic. Every project
must have one continuous task and it can be the only continuous taskin the project. A project can have upto 32-tasks. A task is associatedwith a progarm and has two functions:
It holds information necessary to schedule the programs
execution.
1.
It sets and determines the execution priority for one or moreprograms.
2.
As stated above there are two types of tasks, continuous and periodic.
Continuous taskA continuous task is represented by the white task box in theControlLogix project structure graphic above. Continuous tasksexecute non-stop. Every project must have, and can have only
one continuous task.Periodic task
The other tasked in the above grapic would be periodic tasks. Aproject does not require periodic tasks. A project only requires acontinous task. Periodic tasks interrupt the continous task and
execute for a precribed length of time and specific time intervals.When the time expires, the task executes one last time. Periodic
Tag Based Memory http://theplctutor.com/cntrllgxmem.html
3 of 7 19/06/2015 05:55
-
rates can be from 1ms to 2000 seconds. The default period is10mS.
Program
Each task requires at least one program. A task can have up to32-programs. Only one program can execute at-a-time.
Routines
Routines are where the executable code resides. Routines can bewritten in:
Ladder LogicSequential Function ChartFunction Block DiagramStructured Text
or a combination of all.
There are two types of routines:
Main routineSubroutine
Main Routine
When a program executes the main routine executes first. The mainroutine is used to call(execute) other routines in the program(subroutines).
For those who are familiar with the AB SLC500 or PLC5, the main
routine is the same as LAD 2.
Subroutines
Any and all additional routines within a program are called subroutines.
Subroutines are used to keep programs organized. They containexecutable code, just like the main routine and can be written in any ofthe 4-languages listed above. Subroutines will only execute when theyare called from the main routine or from another subroutine.
An example for the use of subroutines could be: An assembly areauses a rotary indexer that has 10-different assembly stations. Therecan be 10-subroutines with each subroutine containing the programcode that controls one of the assembly stations. These subroutines arecalled from the main routine or from other subroutines. If the productbeing produced does not require the 10-assembly stations, the
subroutine call to the assembly station(s) not required can be disabledand that/those stations will not be included in the process.
Tag Types and Scope
There are two types of tags:
Program tags
Control tags
Program Tags
The program tags are represented in the purple box in the
Tag Based Memory http://theplctutor.com/cntrllgxmem.html
4 of 7 19/06/2015 05:55
-
ControlLogix project structure graphic above. Tags that are usedwithin a program are stored in that program and have a scope of that
program. Scope will be discused later.
Controller Tags
Controller tags are represented in the white box in the ControlLogix
project structure graphic above. Controller tags are global tags. Globatags are tags that store values available to the entire project. I/O dataand system-level and system-shared data are examples of global tags.
Tag Scope
The scope of a tag is where and when the data stored at the location inmemory referenced by the tag is available. Some languages call scope,lifetime.
The data in a program scoped tag is only available when that programis executing. The tag and its data are not available to any otherprogram. When the program stops executing and transfers control toanother program the tags in the stopped program are no longeravailable.
Program level tags assist in keeping data organized and also assists insecurity by providing data hiding.
The following figure is a screen shot of the Rockwell Automation
RSLogix 5000 project window that shows the tree structure of anRSLogix 5000 project.
RSLogix 5000 Project Window
Tag Type Classifications
There are two tag classifications:
Base tagAlias For tag
Base Tag
All instructions are assigned a base tag. The base tag is a tag namethat represents the process function and is assigned a data type
Tag Based Memory http://theplctutor.com/cntrllgxmem.html
5 of 7 19/06/2015 05:55
-
appropriate for that function.
As an example: A mixing vessel on the north side of the plant mighthave a base tag name; North_Vessel_Mixer and if this tage is beingused to turn on/off the mixer motor it would assigned the data typeBool (0 or 1).
Alias For tag
An Alias For tag is another name for a base tag. I/O points areassigned to base tags using an Alias For to the I/O module point.
If the mixer motor controller is wired to an output module in slot 2,terminal 14, the I/O point would be assigned using an Alias For tag.Therefore, the base tag: North_Vessel_Mixer would be assigned anAlias For tag of: Local:2:O.Data.14
I/O Tag Format
The form for a physical address in the AB ControlLogix processor is:
Location:Slot:Type.Member.Submember.Bit
Location
The location specifies the network location for the data.
Local is used if the I/O module is in the same rack as theprocessor module.An adapter name is used to identify a remote communicationadapter such as a DeviceNET remote I/O block.
Slot
The slot is the slot number the I/O module is plugged into. Slot arenumbered with slot 0 being the first slot on the left side of the rack andcontinues counting up by 1 going to the right.
Type
The Type specifies one for four types of data:
I for inputsO for outputsC for configurationS for status
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 usea Channel Member (CH#)
Submember (Optional)
A submember is specific data related to a member. More on this later.
Bit (Optional)
The bit number specifies a bit number for an internal instructions or a
Tag Based Memory http://theplctutor.com/cntrllgxmem.html
6 of 7 19/06/2015 05:55
-
screw terminal for I/O modules.
Delimiters
Only two delimiters are used; Colons (:) and periods (dots)(.). If anaddress is a control-type tag, a (C) is placed at the end of the addressto indicate that the tag is a controller scoped tag.
Example: if a base tah is assigned to a start push button on process 1,that is wired to the input module in slot 7, screw terminal 8, and if thisinput module is in the same rack as the controller, the base tag mightbe:
Process1_StartPB
and then it would be assigned an Alias For of:
Local:7:I.Data.8(C)
There is no submember for the Alias For.
Top
Return to the memory structure page
The PLC/PAC Tutorial All rights reserved Copyright 2009
John G. (Skip) Todora Late updated: November 11, 2009
Tag Based Memory http://theplctutor.com/cntrllgxmem.html
7 of 7 19/06/2015 05:55