LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I associate timing with multiple AI loops that is independant of loop execution speed

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 4
(3,008 Views)
If you want to read more than one AI at the same time, you should use a trigger.  You would need to set up the AI Trigger to an external source.  Then you would have to use a function generator or digital out to create a clock.  The clock would be wired to the AI external trigger.  When the clock goes high (or low depending on configuration), both AIs would read.  That is the method I use when needing to sync multiple AI inputs.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 4
(3,004 Views)
Thanks tbob.  I was hoping I could handle the timing with software but I will try external triggering. Can I use the timer/counter on my multifunction DAQ (wire it around to the AI external trigger)? Can the trigger be used to generate timing to associate with AI points for a spreadsheet file?
Thanks again.
0 Kudos
Message 3 of 4
(2,972 Views)
Using a Counter/Timer board wired to AI external trigger is exactly the thing to do.  You can also capture the timer signal with a Analog In or Digital In, and use the data for a reference in your spreadsheets.  Your spreadsheet would be a 2D array: row 0 column 0 would be timer signal at t0, column 1 could be AI-0, column 2 is AI-1, etc.  The next row can be for time t1, and so on.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 4
(2,948 Views)