Posted 25 Mar 2019 (edited) I'm using a FIFO log to store data from the last 100 items. The FIFO log is being filled with a UDT that has multiple elements, (i.e. TagHistory[0].Height, TagHistory[0].Width....etc.). Is there a way to clear all the data in each UDT in the entire FIFO log (TagHistory[0] - TagHistory[100]) without having to use 100 separate instructions? There is a condition I need to meet where it would be necessary to clear the entire FIFO, essentially deleting all the item history data and starting from scratch. I was looking into using a FLL instruction but I don't have access to the PLC at the moment, so I can't test it. Here is a link to a similar topic, Thanks for any help Edited 25 Mar 2019 by Walks Share this post Link to post Share on other sites
Posted 25 Mar 2019 (edited) Create a "Null" tag of the same type as your UDT, with all zeros (or whatever value means "cleared out") and then use a single COP instruction. Set it up this way: Source: your Null tag Dest: TagHistory[0] Length: number of elements in the TagHistory array If it's critical that you not mess up (when is it not?), I would create a new array to practice on or, better yet, use a spare PLC to test it. Edited to add: Since the array is tied to FIFO instructions, you will also need to update the position element of the control tag for the FIFO instructions. You could probably also just clear array element 0 and set the FIFO position to 0. The data in the rest of the array would still be there but wouldn't be used. It would be overwritten as new items are added to the FIFO. I would probably still feel better clearing it, though. Edited 25 Mar 2019 by Joe E. FIFO info Share this post Link to post Share on other sites
Posted 25 Mar 2019 Thanks, I'll give it a shot a little later when I have the PLC. Luckily, I don't have to worry about interrupting anything while I play around with the PLC code. Share this post Link to post Share on other sites
Posted 25 Mar 2019 It doesn't appear to work, it will only clear the first tag array in the FIFO log, as in only TagHistory[0] is cleared while TagHistory[1],[2],[3].... all still have data in them. Share this post Link to post Share on other sites
Posted 25 Mar 2019 Hmmm.....Let me experiment a little. Share this post Link to post Share on other sites
Posted 25 Mar 2019 Yeah, that's not going to work...sorry I steered you wrong.I forgot a fundamental thing about the COP instruction. While it's copying, both the source and destination are incremented. The FLL instruction does what you want. I created a UDT of type "TagHistoryType" with 5 DINT members and then created an array of 100 elements of that type. Set the Length parameter to the number of array elements you want to clear. This FLL instruction cleared the entire array by writing a "0" to everything. If you want to initialize the tags to some value other than 0, you will need to either create a second array that contains the initial values or use a loop to copy the initialized tag into the array elements. Here's the FLL instruction that worked for me: Share this post Link to post Share on other sites