LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Any way to sample segment length longer than loop iterations w/o shift registers?

Solved!
Go to solution

Hi all,

 

My loop iterates approx every 0.06s and now i've been asked to add to the program a function which will sample the most recent 3s of data and return the max/min value for two of the signals.  I can think of a programmatically clumsy way to do this with shift registers- take the max/min for each iteration, save-repeat-compare until you have enough iterations to fill 3s of time.  But I can't help but think there has to be a cleaner(better?) way to do this. 

 

Any help?

Thanks

 

0 Kudos
Message 1 of 3
(2,345 Views)
Solution
Accepted by topic author drock07

Hi there,

 

Try looking into a circular buffer.  

 

http://zone.ni.com/devzone/cda/tut/p/id/7188

 

Once you've determined how often you're putting entries into the buffer, you'll know exactly how big of an array to grab and do the Min/Max on.  

 

Another option is to use a circular array.  

 

http://decibel.ni.com/content/docs/DOC-3414

 

I would set this up to function a little like a Functional Global or an Action Engine.   The subVI would then be used in your DAQ loop to "stack" new data.   And then called in another loop or part of your code to be read every three seconds.  

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 2 of 3
(2,340 Views)

Thanks Patrick, it looks like thats going to work.

0 Kudos
Message 3 of 3
(2,327 Views)