Using Step 7 5.5
400 PLC
I had an idea recently of putting some data in an array.
There can be several devices, like a Drive for a motor for example.
Let's say 5 for now.
Each device has about 10 pieces of data. All in a UDT.
I was thinking of putting them all in one array of UDTs and then retrieve the data I want based on which motor I want to update or control.
Something like this:
Data.MotorDrv [2]
Now I realize I can do this much, but here comes the tricky bit.
L 3
T MW3
Data.MotorDrv [MW3]
Using sfc20
I can do this in STL with any pointers and AR1 etc, that is not the solution I am looking for. I want to symbolically address the array and return some element in it.
I kicked it around last week and thought it might work in SCL as I was able to return the Data [MW3] in SCL but only in an array of INT or WORD, not an array of UDTs.
I am a complete novice in SCL.
My current alternative is leaving the UDTs in the stat area and symbolically addressing them there.
I think an array of UDT or STRUCT would be more interesting AND it will allow additional devices to be added later to the end of the array with no ill effects on the existing code.
Like next week when they want to add 3 drives to the existing 5.
I could extend the array and change a few variables.
I realize there is only a small difference between the ideas, I am exploring what is possible here.
Is there a way to return ARRAY.UDT[MW3] where the position of the udt in the array is only known at runtime?
400 PLC
I had an idea recently of putting some data in an array.
There can be several devices, like a Drive for a motor for example.
Let's say 5 for now.
Each device has about 10 pieces of data. All in a UDT.
I was thinking of putting them all in one array of UDTs and then retrieve the data I want based on which motor I want to update or control.
Something like this:
Data.MotorDrv [2]
Now I realize I can do this much, but here comes the tricky bit.
L 3
T MW3
Data.MotorDrv [MW3]
Using sfc20
I can do this in STL with any pointers and AR1 etc, that is not the solution I am looking for. I want to symbolically address the array and return some element in it.
I kicked it around last week and thought it might work in SCL as I was able to return the Data [MW3] in SCL but only in an array of INT or WORD, not an array of UDTs.
I am a complete novice in SCL.
My current alternative is leaving the UDTs in the stat area and symbolically addressing them there.
I think an array of UDT or STRUCT would be more interesting AND it will allow additional devices to be added later to the end of the array with no ill effects on the existing code.
Like next week when they want to add 3 drives to the existing 5.
I could extend the array and change a few variables.
I realize there is only a small difference between the ideas, I am exploring what is possible here.
Is there a way to return ARRAY.UDT[MW3] where the position of the udt in the array is only known at runtime?