Omron CX-Programmer Structure Array Tag Index

Hann

Member
Join Date
Nov 2022
Location
New Zealand
Posts
16
I am using a function block that has a in/out parameter that is a structure.
The structure has an array as one of the elements.
I can index the elements in the array if I hard code it e.g. struct.array[0]

I want to index using a tag e.g. struct.array[index].

I get the following error
ERROR: In a structure variable, only one variable index can be used in the root struct array. Rung 73 (7,40).

Is there a way to accomplish dynamic addressing in a function block given this limitation.

I am investigating indirect registers, but are not yet familiar enough to know if it will work.
 
possible workarounds, off the top of my head (no experience):

replicate (block move?) the entire array to a function block-local copy of the array, and then extract a value from that using [index].

Or perhaps create a function that takes an array and an index as input parameters, and returns the value at that index.
 

Similar Topics

Hello ! I am trying to use an omron cj2m-cpu33 with a CP1W-CIF01 plug in serial connector to talk to a zebra ZT610 printer. I am getting the data...
Replies
8
Views
380
Is there a way in CX-Programmer to call Ladder Instructions from a structured text program? I can see several functions in the autocomplete...
Replies
3
Views
1,974
Is there a way in CX-Programmer to call functions from a structured text program? I have found this manual that seems to describe the process...
Replies
1
Views
1,062
Is there a way in CX-Programmer to initialise an array? Set all values to zero or false depending on the data type Solutions in Ladder and...
Replies
2
Views
1,294
Is there a way in CX-Programmer to ad UINTs together with an instruction without a compiler warning. Ladder Rung: Warning: Instructions...
Replies
2
Views
1,257
Back
Top Bottom