Capture Last ten Shots (Shift Registers)? 
Author Message
 Capture Last ten Shots (Shift Registers)?

Situation: -
I am continuously acquiring data on 4 channels of the DAQ card using
conditional triggering. Each loop captures 2000 samples, which are
stored in 2-D waveform arrays containing each scan of each channel.
The data is continually updated on a waveform graph for the user to
monitor. After a period of "test time" or when you press a button, the
loop will end and the last loop of waveform data gets passed to the
analysis VI where all the calcs are performed (I only perform
calcs/analysis on static data once test time has completed).

Problem: -
I now want to average the last 5-10 points prior to the while loop
ending (as the injection needle will jump around slightly shot to
shot). I can enable indexing on the while loop and then select the
points I require afterwards (i.e. the last 5-10 or whatever), but this
takes up a hell of alot of memory and the processor starts caching to
disk too often. Can you imagine just how many points are stored in
memory (2000 samples/channel, 4 channels per scan, sampling at 80KHz,
for 10mins).

There is no need to store all these points. Each time the loop
iterates, the buffer is cleared so the program runs quickly and
smoothly. All I need to do is store the last 5-10 waveform array's and
pass these on to the next VI, not the whole XXXXXX amount of

I may try and use a sequence, so that the first sequence uses disable
indexing and ends after the "Test time" has elapsed. This then
continues into the next sequence and proceeds to capture a further
5-10 shots with indexing enabled, before passing to analysis VI. This
still doesn't really capture the last 5-10 iterations, it captures the
next 5-10 iterations, but it would do.

Ideally, I want the while loop to execute with indexing disabled, and
at a certain point in time (comparing the "Test Time" with the "sample
rate"), the while loop changes to 'indexing enabled' which will build
up an array of waveform data until the loop ends (about 5-10
iterations later).

Any Ideas. If you've got time on your hands..........

Sat, 21 Aug 2004 23:24:19 GMT  
 Capture Last ten Shots (Shift Registers)?
In applications like yours, where you want to pre-trigger, I use
following mechanism.
Build a "memory vi" containing a shift-register of a 3-D array.
At every acquired shot, replace the last curve ( a rotary index:
.,8,9,0,1... ) with the newly acquired data.
When you decide to trigger, simply press a boolean that activates the
read-out of the entire 3D array.
It is usefull to use two independant vi's or parallel loops, in one
loop you acquire the data, in another you can read-out the "memory
Do an average (be careful with using the right index of the array) on
the 10 shots and voila:
The averaged curve is there.
Note: Be careful to initialise the "memory vi" at the init state of
your program.

I hope you understand what I mean.

Sat, 21 Aug 2004 23:41:33 GMT  
 Capture Last ten Shots (Shift Registers)?
I understand what you mean, but as I do not Use labview often enough
and I'm still learning, I would appreciate an example that you have.

Let me elaborate a little further. To simplify things, the set up is
like so: -
A while loop executes a conditional retieval that terminates after 10
mins, or when you stop the loop (whichever comes first).
The conditional retrieval takes the form of a Waveform array
containing 3 channels. I have got the average part to work fine
(working with the correct index arrays :) ), but at present i'm just
enabling indexing and subtracting the last ten loops to work with.

Using the above method, it creates alot of memeory uptake with
unnecessary loop of data stored. I know what I want to do, but can't
I need a Shift register that will take in 10 values, and once full
shift the first data point out and take a new point in. When my main
loop then ends, the shift reg data will be forwarded to the ouitside
loop as an array of 10 points, for me to perform average on.

Sorry mind not working today, can you help/show me an example vi.


Sun, 22 Aug 2004 00:09:36 GMT  
 Capture Last ten Shots (Shift Registers)?


> Situation: -
> I am continuously acquiring data on 4 channels of the DAQ card using
> conditional triggering. Each loop captures 2000 samples, which are

####### cut #####

Hi Ademason,
I'm not shure understandung your problem completely, but the way I see it,
you need a ring buffer.
Say you have a ring buffer buffering 10 elements. Put this in a loop,
filling the buffer with one more element each loop iteration. At the 11th
iteration, the first element gets overwritten.
You should be able to do this with two concentric while loops, I think.

There are explanations of the functioning of ring buffers some place named
like buffered DAQ, i think.
Well finally, when your iterations stop, fetch the count of the buffer
iteration terminal and scan back the last 10 element. Thats it!

Tell me please if this is what you need.


Tue, 24 Aug 2004 19:13:34 GMT  
 Capture Last ten Shots (Shift Registers)?
Is this principle basically a shift register approach.
(This is what I have reverted to using now). I just shift 5 elements
around the loop, continually overwriting the first element and
shifting out the last.

Tue, 24 Aug 2004 19:34:43 GMT  
 [ 5 post ] 

 Relevant Pages 

1. CNF: QW2002: Ten Days To Register and Save!

2. Must wire shift register through event structure

3. Resetting the shift register

4. problems about shift register

5. Empty picture vs a shift register?

6. Shift Register Initialisation

7. Clearing chart buffer using shift registers

8. while loops and shift registers

9. shift register

10. unwanted storage in shift register?

11. Shift Register Initialisation

12. adding a shift register to a while loop


Powered by phpBB® Forum Software