09-30-2007 07:37 AM
09-30-2007 08:01 AM
first of all, the "elapsed time" should not be in the main loop. the way you set it up is : if time has elapsed, then stop loop.
you should do: if time has elapsed, then save data. therefore you might want to put the save inside a case structure in the while loop. every time it is elapsed ,you have to reset the time elapsed (by inserting a new "start time"), and save.
few remarks tough:
1) if you want to do it this way, you will have to keep all the data created in the loops in shift registers, that will be cleaned only when you save. you wont be able to do it with waveforms or dynamic data. what is wrong with saving every iteration?
2) there a several identical operations in your applications. that's why subvis are for.
3) stop condition: a logic OR connected to a false constant??
4) put a short wait in the while loop (e.g. 50ms). since you do a read-write request to VISA, it seems you do not need polling at full speed.
5) i dont understand why you save as waveform, when dt is 0. also, t0 should come from single source. overall, it seems you only want to save the y values together. you can append them using "build array".
6) if you really want to save independantly from the data aquisition loop, then i would suggest setup a second independant loop, dedicated to the task, with your desired timing.
good luck.
09-30-2007 09:09 AM
09-30-2007 11:20 AM
you have then 2 options:
1) you take data all the time (with some short delay i.e. 50ms), average it every minute, and save the averaged data.
2) you just take a single point data every minute or so, and save it. this option is the easier for now, as you just put a "wait" inside your loop.
case structure: you can use the express vi" time has elapsed". the output is a boolean, that you connect to a true/false structure. in the flase case nothing happens. in the true case, you can put a save on (for example), an averaged value. in such a case ,do not forget to empty the data arrays.
09-30-2007 11:34 AM - edited 09-30-2007 11:34 AM
a diagram worth 1000 words...
Message Edited by Gabi1 on 09-30-2007 06:35 PM
10-01-2007 05:38 PM
10-02-2007 02:48 AM
first thing you should do is open the context help (ctrl-H)
the reason is that each native vi (from the pallette), has a short description there and explanation of each connection. as well, you can open from there an extended help document.
if you do so, you'll discover that you can do 2 things:
1) wire a path to the vi. therefore instead of opening a dialog the vi will simply write to this path
2) set "append to file" as true. therefore if file aleady exist, the vi will just apend the data at the end
to note:
1) in your program you might want to automatically create a filename and path.
2) you can still use an express vi to do this task if you feel more comfortable. the rest is same.
i think i have a different LV version than you, which version do you use?
10-02-2007 02:47 PM
06-29-2011 01:48 PM
Can you offer an explanation of how the Wait Until Next ms Multiple Function actually works. In the Labview Help, it says "Waits until the value of the millisecond timer becomes a multiple of the specified millisecond multiple" Does this mean that you enter 10, and it causes the WHILE loop to pause until it reaches an integer multiple of 10ms, even though the execution might have an elapsed time that is not an exact multiple of 10?
So, if the true execution time of a WHILE loop is 25 ms, but the Wait Until Next ms Multiple is set to 20, then, does the WHILE loop execute again after 40 ms??? Is that a correct interpretation of how this function works?
Thanks,
Dave
06-29-2011 02:18 PM
You are correct, if the " Wait Until Next ms Multiple" is the LAST thing you execute in the while loop, then if the code in the while loop takes 25 ms, and you have set the wait to 20ms, the complete loop time will be 40 ms.
But that is ONLY if you are forcing the wait to execute last in the loop.
If you don't force the wait to execute last, the loop time will by controlled by how long time your code takes to execute compared to the wait time.
In your example the loop time will be 25ms.