M E M O RY C A PA C I T Y AND U T I L I Z AT I O N

M E M O RY C A PA C I T Y AND U T I L I Z AT I O N

Memory capacity is a vital concern when considering a PLC application. Specifying the right amount of memory can save the costs of hardware and time associated with adding additional memory capacity later. Knowing memory capacity requirements ahead of time also helps avoid the purchase of a controller that does not have adequate capacity or that is not expandable.

Memory capacity is nonexpandable in small controllers (less than 64 I/O capacity) and expandable in larger PLCs. Small PLCs have a fixed amount of memory because the available memory is usually more than enough to provide program storage for small applications. Larger controllers allow memory expandability, since the scope of their applications and the number of their I/O devices have less definition.

Application memory size is specified in terms of K units, where each K unit represents 1024 word locations. A 1K memory, then, contains 1024 storage locations, a 2K memory contains 2048 locations, a 4K memory contains 4096 locations, and so on. Figure 5-5 illustrates two memory arrays of 4K each; however, they have different configurations—the first configuration uses one-byte words (8 bits) and the other uses two-byte words (16 bits).

Figure 5-5. Block illustration of (a) a 4K by 8 bits storage location and (b) a 4K by

16 bits storage location.

The memory capacity of a programmable controller in units of K is only an indication of the total number of storage locations available. Knowing this maximum number alone is not enough to determine memory requirements.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components The Memory System C HAPTER 2 and Systems

and I/O Interaction 5

Additional information concerning how program instructions are stored will help to make a better decision. The term memory utilization refers to the amount of data that can be stored in one location or, more specifically, to the number of memory locations required to store each type of instruction. The manufacturer can supply this data if the product literature does not provide it.

To illustrate memory capacity, let’s refer to Figure 5-5. Suppose that each normally open and normally closed contact instruction requires 16 bits of storage area. With these memory requirements, the effective storage area of the memory system in Figure 5-5a is half that of Figure 5-5b. This means that, to store the same size control program, the system in Figure 5-5a would require 8K memory capacity instead of 4K, as in Figure 5-5b.

After becoming familiar with how memory is utilized in a particular control- ler, users can begin to determine the maximum memory requirements for an application. Although several rules of thumb have been used over the years, no one simple rule has emerged as being the most accurate. However, with a knowledge of the number of outputs, an idea of the number of program contacts needed to drive the logic of each output, and information concerning memory utilization, memory requirement approximation can be reduced to simple multiplication.

E X AM PLE 5 -1

Determine the memory requirements for an application with the following specifications:

70 outputs, with each output driven by logic composed of 10 contact elements

11 timers and 3 counters, each having 8 and 5 elements, respectively

20 instructions that include addition, subtraction, and com- parison, each driven by 5 contact elements

Table 5-1 provides information about the application’s memory utilization requirements.

O u t p u t c o li

3 Table 5-1. Memory utilization requirements.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components The Memory System C HAPTER 2 and Systems

and I/O Interaction 5

S OLU T I ON

Using the given information, a preliminary estimation of memory is:

(a)

Control logic = 10 contact elements/output rung Number of output rungs = 70

(b)

Control logic = 8 contact elements/timer Number of timers = 11

(c)

Control logic = 5 contact elements/counter Number of counters = 3

(d)

Control logic = 5 contact elements/math and compare Number of math and compare = 20

Based on the memory utilization information from Table 5-1, the total number of words is:

(a)

Total contact elements

Total outputs

(70 x 1)

Total words

Total contact elements

(11 x 8)

Total timers

(11 x 3)

Total words

Total contact elements

(3 x 5)

Total counters

(3 x 3)

Total words

(d)

Total contact elements

Total math and compare

(20 x 1)

120 Thus, the total words of memory required for the storage of the

Total words

instructions, outputs, timers, and counters is 1035 words (770 + 121 + 24 + 120), or just over 1K of memory.

The calculation performed in the previous example is actually an approxima- tion because other factors, such as future expansion, must be considered before the final decision is made. After determining the minimum memory requirements for an application, it is wise to add an additional 25 to 50% more memory. This increase allows for changes, modifications, and future expansion. Keep in mind that the sophistication of the control program also affects memory requirements. If the application requires data manipulation and data storage, it will require additional memory. Normally, the enhanced instructions that perform mathematical and data manipulation operations

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components The Memory System C HAPTER 2 and Systems

and I/O Interaction 5

will also have greater memory requirements. Depending on the PLC’s manufacturer, the application memory may also include the data table and I/O table (discussed in the next section). If this is the case, then the amount of “real” user application memory available will be less than that specified. Exact memory usage can be determined by consulting the manufacturer’s memory utilization specifications.

5 -4 M E M O RY O R G A N I Z AT I O N AND

I /O I NTERACTION

The memory system, as mentioned before, is composed of two major sections—the system memory and the application memory—which in turn are composed of other areas. Figure 5-6 illustrates this memory organiza- tion, known as a memory map. Although the two main sections, system memory and application memory, are shown next to each other, they are not necessarily adjacent, either physically or by address. The memory map shows not only what is stored in memory, but also where data is stored, according to specific locations called memory addresses. An understanding of the memory map is very useful when creating a PLC control program and defining the data table.

Executive System

Memory Scratch Pad

Data Table

Application Memory

User Program

Figure 5-6.

A simplified memory map.

Although two different programmable controllers rarely have identical memory maps, a generalized discussion of memory organization is still valid because all programmable controllers have similar storage requirements. In general, all PLCs must have memory allocated for four basic memory areas, which are as follows:

• Executive Area . The executive is a permanently stored collection of programs that are considered part of the system itself. These supervi- sory programs direct system activities, such as execution of the control program, communication with peripheral devices, and other system housekeeping activities.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION Components The Memory System C HAPTER 2 and Systems

and I/O Interaction 5

• Scratch Pad Area. This is a temporary storage area used by the CPU to store a relatively small amount of data for interim calculations and control. The CPU stores data that is needed quickly in this memory area to avoid the longer access time involved with retrieving data from the main memory.

• Data Table Area. This area stores all data associated with the control program, such as timer/counter preset values and other stored con- stants and variables used by the control program or CPU. The data table also retains the status information of both the system inputs (once they have been read) and the system outputs (once they have been set by the control program).

• User Program Area. This area provides storage for programmed instructions entered by the user. The user program area also stores the control program.

The executive and scratch pad areas are hidden from the user and can be considered a single area of memory that, for our purpose, is called system memory . On the other hand, the data table and user program areas are accessible and are required by the user for control applications. They are called application memory.

The total memory specified for a controller may include system memory and application memory. For example, a controller with a maximum of 64K may have executive routines that use 32K and a system work area (scratch pad) of

1 / 4 K. This arrangement leaves a total of 31 3 / 4 K for application memory (data table and user memory). Although it is not always the case, the maximum memory specified for a given programmable controller normally includes only the total amount of application memory available. Other controllers may specify only the amount of user memory available for the control program, assuming a fixed data table area defined by the manufacturer. Now, let’s take

a closer look at the application memory and explore how it interacts with the user and the program.