Showing results for 
Search instead for 
Did you mean: 

Averaging multiple channels when button pressed

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).


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

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

Message 22 of 24

Thanks for the extra context tho, Kevin!

0 Kudos
Message 23 of 24

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