72 Chapter 5 Basics of PLC Programming
5.1 Processor Memory Organization
While the fundamental concepts of PLC programming are
common to all manufacturers, differences in memory or-
ganization, I/O addressing, and instruction set mean that
PLC programs are never perfectly interchangeable among
different makers. Even within the same product line of a
single manufacturer, different models may not be directly
compatible.
The memory map or structure for a PLC processor con-
sists of several areas, some of these having speci c roles.
Allen-Bradley PLCs have two different memory struc-
tures identi ed by the terms rack-based systems and tag-
based systems. The memory organization for rack-based
systems will be covered in this chapter and that for tag-
based systems in a later chapter.
Memory organization takes into account the way a
PLC divides the available memory into different sections.
The memory space can be divided into two broad catego-
ries: program les and data les. Individual sections, their
order, and the sections’ length will vary and may be xed
or variable, depending on the manufacturer and model.
Program les are the part of the processor memory
that stores the user ladder logic program. The program
accounts for most of the total memory of a given PLC
system. It contains the ladder logic that controls the ma-
chine operation. This logic consists of instructions that
are programmed in a ladder logic format. Most instruc-
tions require one word of memory.
The data les store the information needed to carry out
the user program. This includes information such as the
status of input and output devices, timer and counter val-
ues, data storage, and so on. Contents of the data table can
be divided into two categories: status data and numbers or
codes. Status is ON/OFF type of information represented
by 1s and 0s, stored in unique bit locations. Number or
code information is represented by groups of bits that are
stored in unique byte or word locations.
The memory organizations of the rack-based Allen-
Bradley PLC-5 and SLC 500 controllers are very similar.
Figure5-1 shows the program and data le organization
for the SLC 500 controller. The contents of each le are
as follows.
Program Files
Program
les are the areas of processor memory where
ladder logic programming is stored. They may include:
• System functions ( le 0) —This le is always
included and contains various system-related in-
formation and user-programmed information such
as processor type, I/O con guration, processor le
name, and password.
• Reserved ( le 1) —This le is reserved by the pro-
cessor and is not accessible to the user.
• Main ladder program ( le 2) —This le is always
included and contains user-programmed instructions
that de ne how the controller is to operate.
• Subroutine ladder program ( les 3–255) —These
les are user-created and are activated according to
subroutine instructions residing in the main ladder
program le.
Data Files
The data
le portion of the processor’s memory stores input
and output status, processor status, the status of various
bits, and numerical data. All this information is accessed
via the ladder logic program. These les are organized by
the type of data they contain and may include:
• Output ( le 0) —This le stores the state of the out-
put terminals for the controller.
• Input ( le 1) —This le stores the status of the
input terminals for the controller.
• Status ( le 2) —This le stores controller operation
information and is useful for troubleshooting con-
troller and program operation.
• Bit ( le 3) —This le is used for internal relay logic
storage.
• Timer ( le 4) —This le stores the timer accumu-
lated and preset values and status bits.
Figure 5-1 Program and data fi le organization for the
SLC 500 controller.
Designated
User
defined
System functions
Reserved
User program
Subroutine programs
0
1
2
3–255
0
1
2
3
4
5
6
7
8
9
Program
files
Data
files
10–255
Output image
Input image
Status
Bit
Timer
Counter
Control
Integer
Reserved
Network
Bit
Timer
Counter
Control
Integer
pet10882_ch05_071-094.indd 72pet10882_ch05_071-094.indd 72 7/23/10 9:14 PM7/23/10 9:14 PM