LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Configure channel scan list for many samples of multiple channels for noise reduction averaging

How can a DAQmx multiple channel scan list be configured to do noise reduction by averaging many samples (hundreds) of a signal ?  The individual channel samples used in the average should be acquired as simultaneously as possible by having a fast channel clock or short interchannel delay.  The scan clock or overall effective rate of the averaged samples is a relatively slow 1 Hz.  There seem to be several approaches.  One is to acquire all samples from one channel and then sample the next channel's samples as in (Dev1/ai0, Dev1/ai0, Dev1/ai0, Dev1/ai1, Dev1/ai1, Dev1/ai1).  Passing such a string to DAQmx Create Channel produces an error that the channel already exists.

 

Another approach would be to alternate channels in the list (Dev1/ai0, Dev1/ai1, Dev1/ai0, Dev1/ai1, Dev1/ai0, Dev1/ai1) but the same error results.

 

For averaging hundreds of samples over 8 channels, the channel scan list be be long.  The string could be created using loops but does DAQmx do compression if the list is longer than the FIFO size ?

 

Another approach is to sample continuously (Dev1/ai0, Dev1/ai1) and throw away samples outside the averaging window.  The channel sampling would be alternating.

 

Steve

 

0 Kudos
Message 1 of 5
(3,029 Views)

Hey Steve,

Use events structure to fire events every sec and accquire a sample for each line and use shift register for moving average. Else check this document. Let me know if this helps.

 

Lab

0 Kudos
Message 2 of 5
(3,009 Views)

I have setup a timed while loop that fires at my desired overall interval.  Within that, a For loop executes once for each desired channel.  Each For loop execution acquires many points from one channel at the daq card's fastest rate and averages them to provide one effective data point.  In this manner, i only need to define one channel in the task and a Finite number of points to acquire.  This avoids the issue of passing a long list of channels and distinct channel names to the task setup.  I tested the time required to configure a DAQmx channel task, define its timing and start the task.  That "only" takes 5 msec which for my relatively slow overall rate of 1 Hz is ok.  The Timed while loop has low jitter, the my overall sampling interval will be accurate enough.

 

Steve

 

0 Kudos
Message 3 of 5
(3,006 Views)

Hey Steve,

Check out this example I think it does what you want it do.

 

-Lab

0 Kudos
Message 4 of 5
(2,986 Views)
That's basically what I am now doing, although since I need to be able change the number of channels and the acquisition rate programmatically, I use various DAQmx functions instead of DAQ Assistant.
0 Kudos
Message 5 of 5
(2,983 Views)