07-13-2009 11:34 AM
Hi,
I have a question that I believe will produce a very simple and straightforward answer but I am not sure how to approach it. I am writing data to a LabVIEW measurement file and am enabling the write to measurement file subVI with a simple boolean button (i.e. When the button is clicked data is being saved and vice versa). Instead of having to click the button a second time to stop saving data I would like for it to reset itself after a certain period of time so that all of my files end up being the same size and scale. I'd like to think that all I need to do is use one of the timing functions (Functions->Programming->Timing), but I don't know which one. Any help will be appreciated.
Thank You,
bsteinma
Solved! Go to Solution.
07-13-2009 06:51 PM
Try using the Elapsed Time Express VI.
See attached.
07-15-2009 10:07 AM
Hi Ravens Fan,
If I wanted to place a button that will start the timer and begin saving after being pushed then stop after the time has run out where would I place it.
Thanks,
bsteinma
07-15-2009 12:18 PM
07-15-2009 02:24 PM
Thanks Raven Fan,
That worked.
07-16-2009 09:55 AM
The timeout function works well but I hadn't checked the file I was saving to in order to make sure that was alright. For some reason the file is much larger than it should be. I am using the write to measurement file vi and am opening the files up in Excel. I am acquiring data using the DAQ assistant, to read 1800 samples at 300 Hz. When using the timeout code that you prepared for me, even if I only save data for 6 seconds, I get several thousand data points in the saved file. I don't know why this is happening because it doesn't do that without the code I used from you. Could you help me follow your code so I know what each portion does. Does it have anything to do with where I placed the write to measurement file vi.
Thanks,
bsteinma
07-16-2009 09:50 PM
It is kind of hard to debug unless you post your code.
07-17-2009 10:24 AM
Hey Ravens Fan,
I've posted the code I have before adding the changes and after.
Thanks,
bsteinma
07-17-2009 11:01 AM
Does the before code work the way you want it to? If not, what do you want it to do?
The problem with the after code which uses the elapsed time structure is that now you've added the DAQ assistant, you've changed the timing mechanism of your code. Now the DAQ assistant collecting 1800 samples at 300 Hz, takes 6 seconds to collect the data. That doesn't seem like a problem. But the elapsed time structure occurs later. So it takes 6 seconds to run before those while loops end. In that time, the loops are running every 10 milliseconds putting the same dynamic data (blue wire) over and over again in the Express VI.
Since the DAQ Assistant sets your timing, I would go back to the before picture. If anything, you may want to put the save button in a small sequence structure with an error wire running through it so that the DAQ assistant is assured to complete before the Save button is read. That way if you click save in the middle of the 6 seconds, the data will be saved on that iteration of the loop rather than the next iteration of the loop and the next 6 seconds.