NIDAQmx Signal Averaging

The GUI interfaces to the NIDAQ function are helpful but I've run into a bit of a problem when trying to realize a signal averaged result. Though this flag is available with the NIDAQmx interface its behavior is not what I want. The manual states the following code will give you 10 averages but multiplies the DAQ rate by the same factor.
DAQmx_Scan/DEV="dev1"/AVE=10 ...

Quoted from the manual:


This requests that runs of 10 readings be averaged. The average of the 10 readings will be returned as a single point in the wave or FIFO. Note that this increases the scanning rate- if you ask for scanning at 1000 samples/second and averaging of 10 readings, the actual scanning rate is 10,000 samples/second.

The problem with this is that if I already want to sample at 40 kS/s then you can't do more than two averages (I need somewhere on the order of 1000). So, is there a way to have the system simply co-add to a wave so I can realize the signal averaging in a different fashion?

The following code will simply operate in an oscilloscope fashion. I'd like to know how to do this and co-add to the same wave on the input trigger.

Make/O/N=10000 Wave0
SetScale/P x, 0,0.000025, Wave0
SetAxis Left -5,5
DAQmx_Scan/DEV="dev4"/RPT WAVES="Wave0, 0"

Ideal Pseudo Code:

Make/O/10000 targetWave //Make wave with desired scaling
SetScale/P x, 0,0.000025, targetWave
Variable numAves = 100
for each input trigger <= numAves: //It is important not to miss a trigger
receive tempWave from DAQmx_Scan
targetWave+=tempWave


Alternatively, is there a clever way of using a FIFO that is twice as long and achieve the same result? In short, I'm trying not to reinvent the wheel but can't seem to one rolling. I'm stumped and could really use a nudge.

Cheers,

Brian

Recent versions of NIDAQ Tools MX include a procedure file, "NIDAQmxRepeatedScanProcs.ipf". It is a bit short on documentation, but it supports the task of collecting a bunch of scans into a bunch of waves. After the fact they can be added together and averaged.

The option supported by the /AVE flag is for something like simple digital filtering- if you have a signal contaminated by 60-Hz noise, sample at 240 Hz and average groups of four samples.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com