Configuring Do-more Indirect Array Addressing for Logs

Brian Holt5 min read
AutomationDirectOther TopicTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

The hourly parts count lands in the wrong location, overwrites an earlier value, or requires another rung for every hour. The quick recovery is to stop translating the DirectSoft pointer pattern literally and use Do-more array indexing: hold the destination offset in a V location, write through that index, and advance it only after a successful sample.

Discard the fixes that create more trouble

Attempt Why it fails Use instead
Recreate the DirectSoft INCB pointer method Do-more exposes indirect access through array indexing, so a separate pointer-style instruction adds unnecessary logic and obscures the effective address. Address the memory block as Block[Index].
Write one rung for every hour Repeated rungs are easy to mistype and hard to change when the retention period or destination block changes. Use one write rung and increment its index.
Increment the stored count This changes the data, not the destination. The next sample still writes to the same location. Increment the V location used as the array index.
Let the index run continuously An unbounded index eventually leaves the allocated table and targets unintended memory. Compare the index with the allocated range before every write.
Reset while exporting the CSV file The export can capture a mixture of old, cleared, and newly written values. Sequence the final write, export, confirmation, and reset.

Get production running with one bounded indexed write. Then add the export interlock, daily reset, and diagnostics so the temporary recovery becomes maintainable logic.

Use the index as the effective address

All Do-more memory blocks support indirect addressing through array notation. With V13 equal to 100, reading D[V13] accesses D100. After changing V13 to 101, the same instruction accesses D101.

The index is an offset into the selected block; it is not the stored production value. Keep those roles separate:

  • The source contains the parts count to archive.
  • The indexed D location is the archive destination.
  • V13 selects which destination element is active.
  • The hourly event authorizes one write and one index increment.

Normal ladder instructions require a V location as the array index. Inside a MATH box, the index can be a full expression, and the output can also be an array expression. Structures are indexable as well; the same addressing model can select a structure element and then a member, as represented by T[V13].Acc.

Allocate and bound the hourly table

Reserve one contiguous block large enough for the complete logging interval. For one stored sample per hour over one day, the table needs 24 elements. If the first element uses index zero, valid offsets are 0 through 23; if the application starts elsewhere, calculate and document the corresponding start and last addresses.

Initialize V13 to the first valid offset at startup or at the start of the logging period. Before writing, test that it remains between the first and last allocated offsets. When it reaches the last element, inhibit further writes until the export-and-reset sequence finishes. Do not wrap immediately unless overwriting the oldest sample is the intended design.

Retentive memory requires another decision: after a power interruption, either resume from the retained index or reconstruct the correct slot from the time source and table state. A blind startup reset can overwrite earlier samples; a blind resume can duplicate an hour. Record the chosen recovery rule in the rung comments.

Write and advance in one controlled sequence

  1. Create a one-shot event from the hourly trigger. A continuously true time comparison can execute on every PLC scan and fill the table in seconds.
  2. Confirm that logging is enabled, CSV export is idle, and V13 is within the allocated range.
  3. Move the current hourly parts count into D[V13], or use a MATH output expression targeting D[V13].
  4. Latch a write-complete indication only after the destination instruction executes.
  5. Increment V13 once from the same one-shot sequence.
  6. Block another sample until the hourly trigger returns false and a new edge occurs.

Decide whether the archived value is an hourly total or a cumulative counter snapshot. For an hourly total, store the interval count and reset or roll the source counter according to the machine logic. For a cumulative snapshot, store the raw counter and calculate each interval later by subtracting adjacent entries. Do not mix these methods within the same table.

Flatten multiple dimensions in the MATH box

Do-more can represent a multidimensional table inside one linear block. For a table arranged by rows and columns, calculate the linear index as:

linear index = (row × column count) + column

Place that expression inside the brackets of ARRAY when using a MATH box. A 10-column table maps row 3, column 5 to linear offset 35 when rows and columns are zero-based. Allocate the total block as row count multiplied by column count.

Use symbolic constants for dimension sizes so a later table change updates the addressing calculation in one place. Check both row and column limits before evaluating the expression. An incorrect column count shifts every row after the first and can look like random data corruption even though the PLC is following the formula exactly.

Export, reset, and verify the full cycle

  1. Force or simulate one hourly event with V13 at the first valid offset.
  2. Confirm that only the selected D element changes and that V13 advances by exactly one.
  3. Hold the trigger true for several scans. The value and index must not advance again.
  4. Repeat at an interior offset and at the last valid offset.
  5. At the last offset, confirm that another write is blocked rather than directed beyond the table.
  6. Request the CSV export and verify that logging remains inhibited until the file operation reports completion.
  7. Inspect the CSV row order and compare several entries with their corresponding D locations.
  8. After successful export, clear or archive the table as required and return V13 to the original location.

Expose the current index, last completed slot, export state, and out-of-range condition on the maintenance display or diagnostic watch list. These four values separate a missed time trigger from a bad address, a stalled file operation, or an incorrect reset.

FAQ

Can I use a Do-more V location like a pointer?

Yes. Use the V location as an array index; with V13 equal to 100, D[V13] addresses D100.

Does incrementing V13 automatically store the next count?

No. Incrementing V13 only changes the effective destination address. Execute the indexed write first, confirm it ran once, and then increment the index once.

Can I reset the table as soon as the last hour is logged?

Reset only after the final write and CSV export complete; otherwise the file may contain cleared or mixed data. Stop here if the index cannot be bounded, the export has no usable completion indication, or watched memory changes outside the allocated block. Contact AutomationDirect official support with the project file, Do-more controller model, software or firmware version, watched index values, and the exact sequence that reproduces the fault.

Back to blog