When designing a PLC system, one of the first steps you must take is to determine memory allocation and organization. A little time spent planning and assigning your memory usage before programming can save a lot of time in the end.
Years ago, memory came at a premium. Many programmers only had 1KB of memory available for a PLC program. Due to these constraints, it was not uncommon for programmers to assign unused input and output (I/O) memory as data registers if the program grew to the point that the rest of the data registers had been assigned.
Memory allocation differs between platforms, although all platforms have input and output (I/O) memory. Rather than directly accessing I/O, programs read inputs at the start of a scan, then write them to a memory table. The program then processes the logic using the table’s saved input values and updates the memory table and output table as it evaluates the logic. At the end of the scan, it writes the values in the output table to the physical outputs.
Examples of I/O Memory Labels & Assignments
|Allen-Bradley||I||O||Assigned by slot starting at zero. (i.e. I:2/4 indicates third slot, fifth input; O:7/0 indicates 8th slot, first output). Addresses are decimal.|
|Automation Direct/Koyo||X||Y||Assigned by slot starting at first module, all addresses are octal. If the first slot is 16 inputs, addresses will be X0-X7, X10-X17. Next input assignment will then be X20-X27 and so on. Outputs are assigned similarly.|
|Siemens||I||Q||All addresses are octal. 10.0-10.7 indicates the first eight inputs used. Assignments are in groups of 32 (10.0-13.7), but I/O can be assigned as required and do not need to follow slot or card order.|
The example above illustrates how I/O memory is assigned and labeled in different ways depending on the platform. In the example above, the designated letters for I/O differ, as do the way they are assigned to physical points. For example:
- Siemens complicates the matter even further by starting analog I/O at different points depending on the platform (i.e. PIW256 or PIW800 designates Process Input Word.)
- Allen-Bradley still follows the slot number, (i.e. I:6.0)
- Automation Direct’s Koyo platform uses V-Memory locations for analog I/O (i.e. V7630-V7633 may hold four analog values from an I/O card).
Memory must also be assigned to timers and counters. Timers and counters have special data types — such as presets, accumulated values, and “done” bits – so they are generally assigned areas specially reserved for them. T0 or C2 (Siemens), CT5 (Koyo), and T4 and C5 (Allen-Bradley) are examples of these pre-assigned areas.
All three of the companies below have both older register-based systems, as well as newer tag-based systems, which tend to be more efficient and easier to organize than register-based programs.
Applies to: PLC5, SLC500, and Micrologix families
Examples of AB addresses for these pre-assigned areas 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), and new registers can be opened up as needed for timers, counters, bits, integers, REALs or floating point values, and strings. Examples of these addresses may look like N14, B33, F27, T88 and so on.
On newer tag-based systems, such as ControlLogix and CompactLogix platforms, users add memory in the form of tags, or text-based addresses that are added as they are needed. Since these can be read by the programmer, they are usually descriptive. The evolution of tag-based programming enables programs to be more easily uploaded and read without intermediary descriptions.
Applies to: S5 and S7 series; 200, 300 and 400s
Siemens assigns special areas for discrete bits. The platform uses M bits or words for general programming use. A bit address may look like this: M10.2, while words, double words (including floating point values), or bytes may look like this: MW42, MD60 or MB16.
Siemens PLCs also allow data to be organized into Data Blocks (DBs), which are structured by the programmer and can contain mixed data types. Most memory usage is placed in DBs rather than in the “M”, or marker memory. These DBs allow for data organization that is more application specific. User-Defined Types (UDTs) can also be used to define data further.
Siemens’ S7-1200 and S7-1500 area tag-based PLCs, as is its TIA Portal platform; however, it is essential to have the program handy since data structures aren’t correlated easily when uploaded.
Applies to: 200, 300 and 400 families
Like Siemens, Koyo assigns special areas for discrete bits. Koyo’s control relays are discrete only and use “C” as its designation. They are also octal with addresses such as C10 or C217. All of Koyo’s addresses, even the I/O, are overlaid with “V” designations. On one end of the spectrum, V0 starts with timer current values; on the other end, I/O may be somewhere in the V40000 range. User data words of the volatile (non-retentive) and non-volatile (retentive) types land somewhere in between. Locations also vary across Koyo’s 200, 300 and 400 platforms.
Koyo’s Productivity 3000 is tag-based, and thus tends to be more efficient than
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 the company’s tag-based PLC.
All of the platforms described above also allow tags or descriptions to be imported and exported by address. This allows programmers to manage and organize memory efficiently using a spreadsheet tool like Microsoft Excel.