LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed average of analog input channel

I am acquiring data on an analog input channel.  How can I continuously sample the data and generate an average value every 5 seconds?
0 Kudos
Message 1 of 5
(11,585 Views)

Hi Vkhatri,

I’m assuming that you are working in LabVIEW with the DAQmx driver.

There are several ways to do this.  I think that the simplest way would be to configure your data acquisition code to acquire 5 seconds worth of data at a time and then use the Mean function from the Probability and Statistics pallet.  This is demonstrated in the following image.

You can configure the DAQ Assistant to acquire data continuously, and set “Samples to Read” to five times the value of “Rate”. For my program, I configured the DAQ Assistant to acquire 5000 samples at a time at a rate of 1000 Samples/second.  This will generate an array of data that spans 5 seconds. Let me know if that works for you.

Thanks,

Luke

 

Message Edited by Luke G on 05-01-2007 12:07 PM

Luke
Applications Engineer
National Instruments
Message 2 of 5
(11,566 Views)

Hi Luke G,

 

I set up a VI like the one you suggested here and it works in the sense that it does read in a number of values and display the average. My problem is that when i write to file it doesn't show time as the x-value, but shows the numbers of samples read instead. Is there any way of changing this so that the x column gives the time elapsed since the start of the test?

 

Thanks

0 Kudos
Message 3 of 5
(11,027 Views)

BUMP

0 Kudos
Message 4 of 5
(11,011 Views)

vincenzol,

 

Please see this thread and more specifically the post by ravensfan where he indexes through the waveform array and then puts it back together.  This will keep your time data intact.   http://forums.ni.com/ni/board/message?board.id=170&message.id=313171&requireLogin=False

 

Tell me if this will not work for your application.

Sincerely,
Jason Daming
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 5 of 5
(10,982 Views)