05-11-2010 08:21 AM - edited 05-11-2010 08:21 AM
Hi all,
I am writing a VI for measuring data and inserting it into a database. The measurements are controlled by a loop that runs once every minute. I want to give each measurement a unique id number and store this too in the database.
To do this, I want to add a counter to this loop so that I can count the number of times the loop has executed in total. This is, even if the VI, LabVIEW or even th PC is restarted, I want the counter to keep track of the number of executions. If say, the loope executes two times and then the VI is stopped and restarted, I want the following number on the counter to be three.
Does anyone have an idea about how to do this? I am gratefule for any help!
Clara
Solved! Go to Solution.
05-11-2010 08:36 AM
05-11-2010 08:39 AM
05-11-2010 08:43 AM
Not allowed to give away code but I can describe one of my "Totalizers" used to keep track of how much stuff has passed through a fliter so we know when to change it.
THe Total izer is implemented as an Action Engine.
It has three actions (methods)
1) Init - Opens an ini file and reads the last values read and cahces these in shift registers. It also inits a timer so we now how long since the last file I/O.
2) Update - Uses the data passed by the caller to update the totals. It also checks how long since the last save and if more than one minute it writes to the ini file (forced write).
3) Read - returns the totals for display and evealuating if a an alarm should be triggered to change the filter.
Note:
THe pre-LV 8.6 version of the ini file exposed methods to allow writing to the file. The new ini functions do not expose that functionality and require closing the file.
Ben
05-12-2010 02:18 AM
Thanks for all the advice.
I decided to go for the easiest solution I could think of: just writing to and reading from a txt file as muks suggested. The text file only contains this single value. It seems to work fine so far at least. Please see the attached VI.
I am sure that what ravis and Ben suggests would also work fine, but I went the option of least effort. 🙂
Clara