From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Averaging multiple channels when button pressed

Solved!
Go to solution

Thanks for the feedback, Gerd. I will adjust my methodology and separate functions as much as possible going forward. For context, I'm capturing on the order of 1 kS/s.

 

To be clear, you're suggesting the following:

  • DAQ loop (producer) for all sensors. Timing is controlled by sampling rate and buffer size.
  • averaging loop (consumer) w/ average button & function. Timing is explicitly set (~100 ms wait per your snippet).

Correct?

Is it OK that I display data to front panel within the DAQ loop? What is a better practice?

0 Kudos
Message 21 of 24
(267 Views)

I looked up the X-series manual to point you to more description, and dang it!  What the X-series can do isn't particularly special after all.  It's mostly just a more friendly API for a method that worked 20 years ago with E-series devices.   It's really only suitable for situations where your frequency is very much higher than your desired sample rate.  Quantization error follows this ratio directly -- if freq is 20x the sample rate, quantization error is 1 part in 20 or 5%.

 

I guess I was thinking of a more truly new method known as "dynamic averaging" that I only know to be available in a particular cDAQ counter module (the 9361 I think?).

 

So you're probably better off using your existing "Implicit" measurement mode where the sample rate *is* the measured (and variable) frequencies.  And then put together some code to properly deal with your sometimes-expected timeout errors.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 22 of 24
(256 Views)

Thanks for the extra context tho, Kevin!

0 Kudos
Message 23 of 24
(239 Views)

Gerd, thanks so much for all your help. I implemented all your recommendations and the averaging works just like I wanted it to. I especially appreciate your logic involving the average button and the counter. I see how it enables summing to continue even after the button resets.

 

I will clean up my main VI & sub VIs and post in this thread for others to use.

 

I really appreciate your time!

0 Kudos
Message 24 of 24
(236 Views)