jydepower Posted February 5, 2013 Report Posted February 5, 2013 Hallo. I have an array[1..10] of DUT where i save data for every time an operator empty a box full of sorted boards. Another operator receives the boards later on, and create a pack. When the first operator empties the box, i move the data into the first available array. The second operator don't necessarily use the first entry in the array. When the second operator uses or delete one of the arrays(packs), lets say [3] entry i then move entry [4] to [10] to place [3] to [9]. Basically i want the data to be topmost in the array at all time. I have made this with A LOT of MOVE_E functions, and it works. But i wondered if there was a smarter ways to do it. If i had to expand the array to 20, i would had to add hundreds of MOVE_E functions. Any ideas? I'm working with iec developer 7,04 The picture below shows how i check on array 1 and 2. I have checks for array 3 to 10 below(no room in screenshot).
Veganic Posted February 6, 2013 Report Posted February 6, 2013 (edited) I'd look at using structured text. The following example is similar to your request but not identical. I'm just using an array of signed word rather than DUT. Make moved equal to the moved "pack" and then all packs below that one will be moved up one and pack[0] will be zero'd. This was done in GX Works2. ----------------------------------------------------------------- (*fill array with some data on first scan*) IF M8002 THEN pack[0] := 10; pack[1] := 20; pack[2] := 30; pack[3] := 40; pack[4] := 50; pack[5] := 60; pack[6] := 70; pack[7] := 80; pack[8] := 90; pack[9] := 100; moved := -1; (* -1 means do nothing*) END_IF; FOR index := moved TO 1 BY -1 DO; lower := index -1; upper := index; pack[upper] := pack[lower]; END_FOR; IF moved > -1 THEN pack[0] := 0; moved := -1; END_IF; Edited February 6, 2013 by Veganic
Mitsu Posted February 6, 2013 Report Posted February 6, 2013 What plc are you using? QnU has a n-word shift of n-word data instruction called SFTWR which seems useful in your situation.
jydepower Posted February 6, 2013 Author Report Posted February 6, 2013 I AM using Q03UDE so i will look for that function.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now