Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Associate time data from with multiple AI loops and controlling timing of loops

I am using Labview 7.1 and I am performing AI of voltage on different channels of the same multifunction DAQ.  I am using while loops to aquire the data.  I am writing the data to spreadsheet file with an associated time as a 2D array.  Currently I am using the 'elapsed time' interactive subVI to get the time in seconds (attempting to use the 'Get Date/Time in seconds' and converting it to DBL results in time values that do not change. My thoughts are that maybe the number of seconds is too large to display single second precision with a DBL floating point number). When I run AI on two multiple loops they execute at different rates and thus the time values from "elapsed time" are accumulated at different rates. I have tried using timed loops to control timing, but if one loop executes at a rate slower than the timing of the loop the 'elapsed time' still accumulates at different rates.  I need to be able to associate both analog inputs to the same time value in the spreadsheet value and I would like to find a way to associate a time with each data point that is independant of loop execution speed (although I would still like to control execution speed of the loops. I am pretty new to Labview and programming in general, any help would be greatly appreciated.
0 Kudos
Message 1 of 2
(3,010 Views)
 Hi Coreyrkoch,

 I've attached a quick example that shows how to acquire from multiple channels and write the data to a file. This example was created using one of our examples:
 Cont Acq & Graph - Int Clk.VI

A Write to Measurement File.VI was added inside the loop, this will append the new data to the bottom of the existing data.

The timestamp comes from the following:
  1. System clock is read when the acquisition is initiated (DAQmx Start Task), this is t0
  2. dt is 1/sampling rate
 
The waveform data type consists of:
 1. t0
 2. dt
 3. Y

Additionally, the loop rate will not affect the sampling rate for the following reason:
  When performing a buffered acquisition, the DAQmx Read VI (the part inside the loop) simply moves data from the DAQ board and into LabVIEW memory. The DAQ board begins sampling when  the DAQmx Start Task is issued; this means a buffer overrun will occur if you don't remove enough samples from the DAQ often enough.

Please post back if you have additional questions after looking at the example!

Have a great week.

Best regards,

MatthewW
Applications Engineer
National Instruments






 

0 Kudos
Message 2 of 2
(2,983 Views)