Hi Neuvos,

I'm trying to understand the problem clearly in order to provide
proper advice.

The first thing is to understand the constraints..

What do you mean by "specified length of sample"?  Do you mean time
(ex. 3 sec) or filesize, or something else?  It looks like you mean
time.

If your vi runs in the background waiting for you to press the "Store"
button, then it proceeds to save samples for 3 seconds (continuously),
then you can implement something like this:

If you run this for a single event:

Have a loop which monitors for the "store button" action.  For
instance it can be a while loop which stops when the button is
pressed. The vi then goes to another while loop which is initialized
by a timestamp and runs until timestamp = timestamp + 3 sec.  In this
same while loop, you can also initialize a shift register which acts
as a buffer for the incoming data.  You combine (add) the new data to
that from the previous loop by using the appropriate function
(concatenate string, build array, etc).  When the loop ends, you do
what you want to do with the output of the shift register (save to
file, etc).

If you run it for multiple events, you could combine the second while
loop within the first one.

I'm sure you get the idea.

The above assumes that the length of data was based on time
constraints.  You can change the constraint by using another
constraint to the conditional terminal (loop condition).

The reason I split the single and multiple event is because it looks
like you want to change scanrates, etc when running the vi.  If that
is the case, then you may want to place either a Case Structure that
is true if a certain amount of time has elapsed.  Within this Case
Structure, you can change the instrument settings. This can be inside
the second while loop which saves the data.

You also mention "buffer size".  If that was the constraint, then
replace all refernce to time by buffer size.  You can get the size of
the data within the second while loop and use that as a condition for
loop or for the case structure to change the instrument settings.

Hope this helps...

JLV

Reply via email to