Indirect Addressing in PLCs: 5 Powerful Uses With Examples

Share:
PLC
Indirect Addressing in PLCs: 5 Powerful Uses With Examples

Writing one rung for every recipe, station or test result quickly turns a program into a wall of copied logic. Pointers and indexed arrays let a few rungs handle hundreds of values cleanly, with far less room for typing mistakes.

Pointers Indexed Arrays Recipes Bounds Checks

Large data sets are hard to manage with fixed addresses in every rung. Using a variable to choose the memory location lets one piece of logic work across many records.

Hello everyone, today we are going to learn how indirect addressing works in a PLC, how pointers and indexed arrays are used on different platforms, and how to avoid out of range faults.
indirect addressing

What Is Indirect Addressing?

Indirect addressing is a method in which an instruction does not use a fixed memory location but a location selected by the value of another register, called a pointer or index. It builds on normal PLC memory addressing, where every tag or register has a fixed place.

With a direct address, a rung always reads the same word. With a pointer, the same rung reads word 0, then 1, then 2, as the index changes.

Ladder logic example using a pointer register to address data memory
Image credit: ACC Automation

ACC Automation calls this the most powerful PLC instruction for handling large data sets. Their example moves values into a table using a pointer that steps through memory.

How Platforms Handle It

Pointer Registers

Click PLCs use DS registers as pointers.

Best for: simple tables
Click
Indexed Arrays

Productivity and Logix use Array[Index] tags.

Best for: recipes and records
Arrays
V Memory Pointers

Do More uses V memory for indirect access.

Best for: flexible blocks
Do More
Siemens Methods

Variable array index, pointers and ANY in TIA Portal.

Best for: S7 1200 and S7 1500
Siemens

ACC Automation stresses that each platform implements indirect addressing differently. The concept is the same, but syntax and limits vary.

The data type of the index must be an integer, and the element type drives the size in memory. Review PLC data types before designing arrays.

Direct vs Indirect Access

AspectDirectIndirect
AddressFixed in the rungChosen by an index
Rungs neededOne per valueOne for many values
ReadabilityVery clearNeeds comments
Fault riskLowOut of range index

Code using indirect addressing is shorter but harder to follow online. Name index tags clearly and document their range.

5 Powerful Indirect Addressing Uses

1
Recipe Management
Select a full recipe by recipe number.
2
Sequence Control
Step through stations or process stages.
3
Test Result Storage
Log each part result into the next slot.
4
Data Logging Buffers
Build a rolling table of readings.
5
Repeated Equipment
Run one routine for many identical pumps.

ACC Automation lists recipes, sequence control and test result storage as common uses. Recipe structures fit neatly with ISA 88 batch control.

For simple first in, first out tables, a shift register or bit shift instruction may be easier.

How an Indexed Move Works

Set IndexLoad the index with the record number
Check RangeCompare index with array limits
Calculate AddressBase plus index times element size
Move DataCopy value to or from the element
AdvanceIncrement index for the next record

The move itself uses standard data move instructions. Index maths uses math instructions such as ADD and MUL.

Address Formula

Element address = Base address + Index × Element size
Valid when 0 ≤ Index ≤ Array length minus 1

Example:
Base word 100, index 7, each element 2 words, array of 20 elements
Address = 100 + 7 × 2 = 114
Index 7 is within the valid range 0 to 19

Logix arrays hide the raw address, but the same logic sets the valid index range. Element size matters when you use pointer arithmetic on register based PLCs.

Array Index Calculator

Element Address and Bounds
Result
Element address 114, index 7 is within bounds 0 to 19

Always add a bounds check before any indirect addressing instruction. A compare instruction is enough, see our guide to compare instructions linked below.

Avoiding Out of Range Faults

In Logix controllers an index beyond the array size causes a major fault, Type 4 Code 20. Handling this is covered in PLC fault handling.

Use compare instructions such as LIM or GEQ and LEQ to guard every index. Clamp or reset the index when it leaves the range.

Advantages
  • Far fewer rungs for large data.
  • Easy to add more records.
  • Clean recipe and logging logic.
  • Less copy and paste error.
Limitations
  • Harder to read and debug online.
  • Out of range index faults the CPU.
  • Syntax differs between brands.
  • Cross reference tools show less detail.

Beginners should master direct logic first with ladder logic basics. Indirect addressing then becomes a natural next step.

Logix I/O and Tag Data Manual

PDF
Logix 5000 Controllers I/O and Tag Data Programming Manual
Rockwell Automation manual with a section on indirect addresses

TIA Portal Tutorial Video

Indirect Addressing FAQ

What is indirect addressing in a PLC?
It means an instruction reads or writes a memory location chosen by the value of an index or pointer. One rung can therefore handle many values.
Why is it called powerful?
ACC Automation calls it the most powerful PLC instruction for large data sets. It replaces hundreds of fixed rungs with a few flexible ones.
Do all PLCs support it?
Most modern PLCs support it but each brand uses different syntax. Click uses pointer registers while Logix and Productivity use indexed arrays.
What happens if the index is too large?
Many controllers raise a fault because the address falls outside the array. Logix reports it as a major fault, Type 4 Code 20.
How do I prevent index faults?
Check the index with a limit or compare instruction before using it. Clamp or reset the index when it leaves the valid range, and raise an alarm.
Where is it used most?
Recipe selection, sequence steps, test result logging and data tables are common uses. Any repeated data structure, such as many identical pumps, benefits from it.
Is it harder to debug?
Yes, because the address changes while the program runs. Clear tag names, comments and watch tables make troubleshooting much easier.

Related Articles

External References

What We Learn Today

  • Indirect addressing selects memory using an index or pointer.
  • It simplifies recipes, sequences and data logging.
  • Always bounds check the index to avoid controller faults.
I hope you like above blog. There is no cost associated in sharing the article in your social media. Thanks for reading!! Happy Learning!!

Leave a Reply

Your email address will not be published. Required fields are marked *