LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

precisely control timing of multiple acquisitions?

What is the best way to acquire repetitive sets of data at precisely spaced time intervals? I'm running LabVIEW 6i on Windows NT.

For example, I want to acquire say 500 scans at my top scan rate, process them, and then repeat this process every 10 msec. (I have to make configuration changes to my system during the dead time.) I need these data points taken at well controlled time intervals so I can make a meaningful waveform out of the data later.

Here's what I've tried:

1. Using a pulse train to trigger the AI Start function. When a triggered AI Start is included inside a While loop it uses all of the system resources watching for the trigger. No good. If I put in any kind of delay inside
the loop, then NT can take away priority and not give it back until the trigger event has passed.

2. Using a pulse train to gate the DAQ scan clock. Here I set the data acquisition for continuous acquire, but then turn the scan clock off during the dead time. So the system should only be taking data when the gate signal is high. My problem here is I don't know how to configure the AI Read function properly. Specifically, I don't know how to set the number of scans to read. If I calculate how many data points should be available and use that number, I'll often leave a data point or two in the buffer due to timing/rounding errors. If I set the number of points to read higher than the number I should have acquired, I get unpredictable behavior. Sometimes I read exactly the number of points I expect, sometimes 10 more, sometimes thousands more as it waits through multiple cycles to acquire more points.

I'm sure there is a better way. Any suggestions?

Thanks!

Craig
0 Kudos
Message 1 of 3
(2,358 Views)
For your approach (2), I recommend configuring AI Read number of scans to -1 (All). This should return every point captured since the last call. Be sure to do error checking to look for buffer overflows.
0 Kudos
Message 2 of 3
(2,358 Views)
How about...
If you have precise control of the DAQ scan clock, then reading n points would be the way to go. You can request 0 points to read and look at the scan backlog to detect when the next n points are available without getting locked into an AIRead call.
Or...
read data all the time and just throw out the rest of the data. Set your acquisition buffer for several seconds worth of data collection and keep track of read vs skip data.
Stu
0 Kudos
Message 3 of 3
(2,358 Views)