Overview of Memory Organization and Design

advertisement
Chapter 3: Memory Organization and
Addressing
Computer Aided Manufacturing TECH 4/53350
1
Memory Organization & Addressing
Learning objectives

Understand memory
y organization
g
and addressing
g for
the following PLCs:

IEC 61131-3 Model

Allen-Bradley ControlLogix

Allen-Bradley PLC-5/SLC-500
Computer Aided Manufacturing TECH 4/53350
2
IEC 61131-3 Model
Technology Overview




IEC 61131-3 Protocol
International Electrotechnical Commission (IEC)
V d IIndependent
Vendor
d
d t Standardized
St d di d Programming
P
i Language
L
f
for
Industrial Automation
Specifies Syntax, Semantics and Display for:






Ladder Diagram
Sequential Function Charts
Function Block Diagram
Structured Texts
Instruction Lists
IEC 61131- 3 refers to Part 3 of IEC 61131 suite





Part 1 – General Overview
Part 2 – Hardware
Part 3 – Programming Language
Part 4 – User Guidelines
P t 5 - Communication
Part
C
i ti
Computer Aided Manufacturing TECH 4/53350
3
Memory Organization & Addressing
IEC 61131-3 Model
IEC 61131- 3 Protocol: A mutually agreed upon set of rules, conventions, and
agreements for the efficient and orderly design of PLCs
Layered Software Architecture
 Each layer hides details of lower layers
Common Elements of IEC 61131-3 Architecture:
 Configuration (Top layer)


It describes entire software (program + data) for one PLC
Each PLC, within an organization, has a separate configuration

Includes resources, memory addresses for I/O channels, system
capabilities

Resource (within Configuration layer)



Provides support function for the execution of IEC programs
Configuration may consist of one or more resources
Provides an interface between a program and a I/O ports of the PLC
Computer Aided Manufacturing TECH 4/53350
4
IEC 61131-3 Model
C
Common
El
Elements
t off IEC 61131-3
61131 3 Architecture
A hit t
(continued)
(
ti
d)

Tasks (within Resource layer)



Control the execution of a set of programs and/or function blocks
Programs/function blocks can be executed periodically or can be
event driven
Programs must be assigned to a task in order to be executed


The task must be configured to either execute periodically or upon a
trigger
Resource layer may consist of one or more Tasks
http://www.personal.kent.edu/~asamba/tech43550/iec61131.pdf
Computer Aided Manufacturing TECH 4/53350
5
IEC 61131-3 Memory Model
Configuration
Resource
Task
Task
Resource
Task
Task
Task
Program
Func- Function
tion
Block Block
Program
Program
Program
FB
FB
FB
Function
Bl k
Block
FB
FB
Lcl Glbl
Lcl Glbl
Local
Global
Prog. Vars Prog. Vars
Lcl Glbl
Global and directly represented variables
Access Paths
Computer Aided Manufacturing TECH 4/53350
6
IEC 61131-3 Memory Model
Variables
 Local Variable




Defined within the software element
Accessible only by the software element
Software Element: Function Block, Resource or Configuration
Global Variables


Defined for a configuration
Accessible to all elements contained in the config
configuration
ration



Global Config variable can be accessed by all software elements
Global Program Variable can be accessed by all function blocks in the
program
Directly Represented Variables

Refers to memory and I/O locations
Computer Aided Manufacturing TECH 4/53350
7
A-B ControlLogix Memory
Project
Task1
Task2
Program 32
Program
Program 1
Main
Routine
Fault
Routine
Controller
(global) Tags
Config.
Task3
Program
((local)) Tags
g
Status
Watchdog
Other
R ti
Routines
I/O Data
Controller Fault Handler
Computer Aided Manufacturing TECH 4/53350
Task32
System-shared
S
h d
Data
Power Up Handler
8
Simple Ladder Logic
NOT Operation
O
i
Tasks




Configured to control execution of one or more programs
Maximum of 32 tasks
No more than one continuous task
Others are periodic, scheduled at fixed interval. May be
interrupted by a higher-priority periodic task.
Programs



Consists of Routines
•
Max. of 32 per task
•
Executed in order as listed in task
Computer Aided Manufacturing TECH 4/53350
9
Simple Ladder Logic
NOT Operation
NOT Truth Table

Possible Combinations of
the 2 Switches: (22)
Computer Aided Manufacturing TECH 4/53350
A
B
Light
OFF
OFF
OFF
OFF
ON
OFF
ON
OFF
ON
ON
ON
OFF
10
ControlLogix Program Organization
Tasks




Configured
C
fi
d tto control
t l execution
ti off one or more programs
Maximum of 32 tasks
No more than one continuous task
Others are periodic, scheduled at fixed interval. May be
interrupted by a higher-priority
higher priority periodic task.
Programs

Consists of Routines
Max. of 32 per task

Executed in order as listed in task

Computer Aided Manufacturing TECH 4/53350
11
ControlLogix Program Organization
Routines



Encapsulate code in single programming language
Main Routine is first one executed
 Must call other routines
Fault Routine is executed if a program fault is
encountered
t d during
d i execution
ti
Controller Tags

Global
Gl
b l di
directly
tl represented
t d varibles
ibl
 Represents global controller memory
 I/O data
Computer Aided Manufacturing TECH 4/53350
12
ControlLogix Scan



Control logic (program) continuously scanned.
Data is transferred to/from I/O modules any time
during
g the logic
g scan.
If input data must remain constant, make a copy
at beginning
g
g of scan and use the copy
py
throughout scan
Computer Aided Manufacturing TECH 4/53350
13
Download