Jeff164 Posted December 5, 2019 Report Posted December 5, 2019 Hello I've got a new twist to an older project. I have a sampling system that I'm looking to automate so that instead of sampling A & B sides on a switch-over process, it will sample an entire batch of samples; one at a time in sequence. The user will select how many samples they will need to run at the start of the routine. The sample results will be displayed on the HMI as Red / Green radio buttons, one for each sample station; on a final results page at the end of the batch. I may have as many as 30 sample stations on the system active in the batch, and I didn't want to have to run through sets of sampling routine, rather have the same sample loop repeat itself until the sample counter clicked off. I was thinking that the Load Indirect (MI) would enable me to load the results from each test into a new MI location. A snip of code is attached. MI-15 will be my Go/No Go sample results integer, that value will be loaded into a MI location assigned by the STI dialog box in Rung 27. Am I on the right track &/or is there a better way to do this? thanks, Jeff
MVP 2023 Joe Tauser Posted December 7, 2019 MVP 2023 Report Posted December 7, 2019 Another way is to stuff a Data Table from the top. You get the added bonus of having multiple columns of data if you want. 1. Define a Data Table with more rows than you'll ever need. 2. When it's time to log, here's the logic: And what's inside the blocks: The Copy Rows function just moves the entire table down by one. This table has 1000 rows, so the oldest data is blown out. The newest data is always written to row 0. This method makes it real easy to store the data, but a limitation of Visilogic is there is no Data Table widget to get it back out. So you have to make more a little more logic to read the columns into registers for display. Your way works, too, and may be better for only keeping track of one value. The Data Table way if better if you need to grab more than one piece of information for each sample. Joe T.
Jeff164 Posted December 9, 2019 Author Report Posted December 9, 2019 Thanks Joe, I do appreciate the response. I've already got a fair amount of code written with the Load Indirect, I'll probably see if I can make this work. With allot of this stuff ( PLC work in general ) I have an idea of what I need the outcome to be but I dont know what tools within the software to select to make it happen. Will post back either way. Jeff
MVP 2023 Ausman Posted December 9, 2019 MVP 2023 Report Posted December 9, 2019 If you are actually wanting to have records of the process, Joe's method of using a Data Table makes it easy as you can write the Table onto an SD as necessary. Strings are easily read in *.UDTs, and easily shifted out of the plc using SD Card Explorer. Alternatively you can do a direct read of a table using the Connection tab under Data Tables/Data Tables in Visilogic. cheers, Aus
John_R Posted December 10, 2019 Report Posted December 10, 2019 12 hours ago, Ausman said: If you are actually wanting to have records of the process, Joe's method of using a Data Table makes it easy as you can write the Table onto an SD as necessary. Strings are easily read in *.UDTs, and easily shifted out of the plc using SD Card Explorer. Alternatively you can do a direct read of a table using the Connection tab under Data Tables/Data Tables in Visilogic. cheers, Aus Plus, with the Data Table method you can use the DataXport utility to copy the Data Table to an Excel file, saved into a folder or emailed to someone... JohnR
Jeff164 Posted December 10, 2019 Author Report Posted December 10, 2019 Thanks to all. I will certainly read into Data Tables, I can certainly see use for this on other applications, this one not so much. If the implementation of what I have written so far does not go smoothly I'll probably go that route. Jeff
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