Ladder logic 104: Memory organization

Memory allocation varies from platform to platform. All platforms have input and output (I/O) memory and it is assigned and labeled in different ways depending on the platform.


One of the first decisions that needs to be made when designing a programmable logic controller (PLC) system is memory allocation and organization. In the early years of the PLC, memory came at a premium. 1K (one kilobyte) of memory for the program and data may have been all that was available for the programmer to use in a particular PLC. It was not unusual for programmers to assign unused I/O memory as data registers if the program grew to the point where the rest of the data registers had been assigned.

Memory allocation varies from platform to platform. All platforms have input and output (I/O) memory; this is because rather than accessing I/O directly, programs read the inputs at the beginning of the scan, writing them to a memory table. The program then processes the logic, using the saved input values and updating memory and the output table. At the end of the scan the output table is written to the physical outputs.

I/O memory is assigned and labeled in different ways. For this post, I am going to use three platforms as an example.

Memory allocation varies from platform to platform. All platforms have input and output (I/O) memory and it is assigned and labeled in different ways depending on the platform, as demonstrated in this table. Courtesy: Frank Lamb, Automation Primer

The letter designators for I/O differ as do the way they are assigned to physical points. This is even further complicated by the fact that for Siemens, analog I/O starts at different points depending on the platform (example: PIW256 or PIW800 designates Process Input Word.) Allen-Bradley still follows the slot number, (i.e. I:6.0) while AutomationDirect's Koyo platform uses V-Memory locations for analog, i.e. V7630-V7633 may hold four analog values from an I/O card.

Timers and counters also need to have memory assigned to them. Since they have special data types such as presets, accumulated values and "done" bits, they are generally assigned special areas reserved for them. T0 or C2 (Siemens) or CT5 (Koyo) are examples. Allen-Bradley has registers pre-assigned for timers and counters, T4 and C5. Examples of AB addresses for these might be T4:1 or C5:3. These are then appended with /DN for the "done" bit or .pre for a preset value.

Allen-Bradley also pre-assigns registers for bits (B3), integers (N7) and REALs (F8). New registers can be opened up as required for timers, counters, bits, integers, REALs or floating point values, and strings. Examples might look like N14, B33, F27, T88 and so on.

For both Siemens and Koyo special areas are assigned for discrete bits. Siemens uses M bits or words for general programming use; bits may have addresses such as M10.2 while words, double words and bytes may be assigned as MW42, MD60 or MB16. Floating point values are placed in double word locations.

Koyo's control relays are discrete only and use the designation "C". They are also octal, and have addresses such as C10 or C217.

All of Koyo's addresses, even the I/O, is overlaid with the "V" designation. V0 starts with timer current values, I/O may land somewhere in the V40000 range, while user data words of the volatile (non-retentive) and non-volatile (retentive) types fall somewhere in between. The system parameters are also located here. Locations also vary across the 200, 300 and 400 platforms.

Siemens PLCs also allow data to be organized into data blocks (DBs). These are structured by the programmer and can contain mixed data types. Most memory usage is placed here rather than in the "M" or marker memory. This allows for more application specific data organization. User-defined types (UDTs) can be used to further define data.

The previous descriptions apply to the older original platforms for these three types of PLCs. For Allen-Bradley this includes the PLC5, SLC500 and Micrologix families. For AutomationDirect/Koyo, it covers the 200, 300 and 400 families and for Siemens the S5 and S7 series, 200, 300 and 400s.

All three of these companies also have newer tag-based systems. For Allen-Bradley the ControlLogix and CompactLogix platforms allow users to add memory in the form of tags, or text-based addresses that are added as needed. Since these are readable by the programmer and usually descriptive, tag-based programming allows programs to be uploaded and read easier without the requirement of descriptions.

Siemens TIA Portal platform is tag-based, however it is still important to have the program since data structures are not as easily correlated when uploaded. The S7-1200 and S7-1500 are Siemens' tag-based PLCs.

Koyo's Productivity 3000 platform is their tag-based PLC. Tag-based programming is more efficient than the previously mentioned register-based systems and much easier to organize.

All of the previously mentioned platforms also allow for import and export of tags or descriptions by address. This enables programmers to manage and organize memory in an efficient way using Microsoft Excel.

Planning memory usage and assignment before starting to program is useful and can save the user a lot of time.

Frank Lamb is the founder of Automation Consulting Services Inc. This article originally appeared on the Automation Primer blog. Automation Primer is a CFE Media content partner. Edited by Chris Vavra, production editor, Control Engineering, CFE Media,

ONLINE extra

For more articles on PLCs and programming, see related articles below.

No comments
The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by...
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
Each year, a panel of Control Engineering and Plant Engineering editors and industry expert judges select the System Integrator of the Year Award winners in three categories.
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
Additive manufacturing benefits; HMI and sensor tips; System integrator advice; Innovations from the industry
Robotic safety, collaboration, standards; DCS migration tips; IT/OT convergence; 2017 Control Engineering Salary and Career Survey
Integrated mobility; Artificial intelligence; Predictive motion control; Sensors and control system inputs; Asset Management; Cybersecurity
Featured articles highlight technologies that enable the Industrial Internet of Things, IIoT-related products and strategies to get data more easily to the user.
This article collection contains several articles on how automation and controls are helping human-machine interface (HMI) hardware and software advance.
This digital report will explore several aspects of how IIoT will transform manufacturing in the coming years.

Find and connect with the most suitable service provider for your unique application. Start searching the Global System Integrator Database Now!

Infrastructure for natural gas expansion; Artificial lift methods; Disruptive technology and fugitive gas emissions
Mobility as the means to offshore innovation; Preventing another Deepwater Horizon; ROVs as subsea robots; SCADA and the radio spectrum
Future of oil and gas projects; Reservoir models; The importance of SCADA to oil and gas
Automation Engineer; Wood Group
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
click me