how to programatically repeat a DAQ sequence?
s.r.chinn
The general scheme is (1) define a stimulus output wave , (2) start DAQ tasks for waveform generation (using the stimulus output wave), counter (trigger) generation, and repetitively triggered wave scanning (input, sampled acquisition). A scan hook function processes the input waves after each triggered scan, counts the scan iterations, and upon reaching a count limit, stops all DAQ tasks. To give concrete numbers, each scan waveform lasts 0.4 seconds, and I typically scan 6 times to be sure the stimulus-response function has settled to equilibrium. This all works with no problem.
My question concerns how to programatically change the stimulus waveform by varying an input parameter, and repeat this entire DAQ sequence. One issue seems to be how to ensure the outer procedure loop (that changes the stimulus) executes synchronously with the DAQ cycle, and does not outrun it. Most things I have tried give an error message that the waveform scanning task is running, even after it should have stopped. Various error trapping methods (as suggested in the NIDAQ Tools manual) have not revealed the source of the problem.
I welcome any suggestions, and can provide code snippets if requested.
(1) sense the scan iteration number; when appropriate
(2) stop the stimulus generation, stop the scan triggers, save relevant parameters
(3) modify the stimulus wave, retart stimulus generation and scan triggers, and repeat the cycle as desired.
This requires keeping track of and incrementing various counter indices. It's a bit ugly, but it seems to work. Fortunately, in this instance I do not need precise synchronism between the stimulus and input waveforms.
Stephen R. Chinn
April 11, 2008 at 09:54 am - Permalink
I might point out that this is the approach taken by NIDAQmxRepeatedScanProcs, supplied with NIDAQ Tools MX. After installing NIDAQ Tools MX, add this line to the main Procedure window:
#include
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
August 4, 2010 at 08:27 am - Permalink
Perhaps the /RPT flag did the trick.
August 4, 2010 at 10:57 am - Permalink