Hello
Just a little background on the question(s) i am about to ask. I have a basic to intermediate knowledge of ladder logic, but i am not so intimate to the programming techniques used on PLCs. I come from a Structured programming environment (think c++ and the sort). I am working on a prototype project (the final phase of this project will be done by a true PLC programmer).
To make a long story short, i need to move the contents of STRING.DATA array to an array of DINT. Like this:
STRING.DATA[0] = ARRAY[0]
STRING.DATA[1] = ARRAY[1]
STRING.DATA[2] = ARRAY[2]
STRING.DATA[3] = ARRAY[3]
...ETC
I understand i could use a MOV instruction for each element in the array, but:
- If i have 20 elements in the array, i'd need 20 MOVs which increases the rung amount...
- is the above the best way to handle this in ladder logic? what if the array varies in size?
- can use a FOR instruction? If so, how do i implement it?
- is there a better approach for this? If so, how?
Thanks so much in advance for all the help.
Just a little background on the question(s) i am about to ask. I have a basic to intermediate knowledge of ladder logic, but i am not so intimate to the programming techniques used on PLCs. I come from a Structured programming environment (think c++ and the sort). I am working on a prototype project (the final phase of this project will be done by a true PLC programmer).
To make a long story short, i need to move the contents of STRING.DATA array to an array of DINT. Like this:
STRING.DATA[0] = ARRAY[0]
STRING.DATA[1] = ARRAY[1]
STRING.DATA[2] = ARRAY[2]
STRING.DATA[3] = ARRAY[3]
...ETC
I understand i could use a MOV instruction for each element in the array, but:
- If i have 20 elements in the array, i'd need 20 MOVs which increases the rung amount...
- is the above the best way to handle this in ladder logic? what if the array varies in size?
- can use a FOR instruction? If so, how do i implement it?
- is there a better approach for this? If so, how?
Thanks so much in advance for all the help.