I'm actually using Delphi and calling DAQmx functions in nicaiu.dll.
DAQmxCreateTask('', pointer(AO_TaskHandle) );
DAQmxCreateTask('', pointer(DO_TaskHandle) );
DAQmxCreateAOVoltageChan (AO_TaskHandle, 'Dev1/AO0', nil , -10, 10, {units} 10348, nil);
DAQmxCreateDOChan (DO_TaskHandle, {lines} 'Dev1/port0', {nameToAssignToLines} nil, {lineGrouping} 1);
DAQmxCfgSampClkTiming (AO_TaskHandle, {source} nil, {rate} 100, {activeEdge} 10171 {Falling}, {sampleMode} 10123 {10123=continuous, 10178=finite}, {sampsPerChanToAcquire} 100);
{ DAQmxCfgOutputBuffer is not necessary and results are the same without it }
DAQmxCfgOutputBuffer (AO_TaskHandle, {numSampsPerChan} 100);
DAQmxCfgSampClkTiming (DO_TaskHandle, {source} 'ao/SampleClock', {rate} 100, {activeEdge} 10171 {Falling}, {sampleMode} 10123 {10123=continuous}, {sampsPerChanToAcquire} 100);
{ DAQmxCfgOutputBuffer is not necessary and results are the same without it }
DAQmxCfgOutputBuffer (DO_TaskHandle, {numSampsPerChan} 100);
setlength(AO_wfm, 100);
setlength(DO_wfm, 100);
{ create a pulse consisting of one non-zero data point and the rest zero }
AO_wfm[0] := 2000;
for index := 1 to 99 do AO_wfm[index] := 0;
DO_wfm[0] := 1;
for index := 1 to 99 do DO_wfm[index] := 0;
DAQmxWriteRaw (DO_TaskHandle, {numSamps} 100, {autoStart} 1, {timeout} 1.0, pointer(DO_wfm), pointer(sampsPerChanWritten), {reserved} nil);
DAQmxWriteRaw (AO_TaskHandle, {numSamps} 100, {autoStart} 1, {timeout} 1.0, pointer(AO_wfm), pointer(sampsPerChanWritten), {reserved} nil);
DAQmxStartTask (DO_TaskHandle);
DAQmxStartTask (AO_TaskHandle);
{ the task runs and I can observe synchronized waveforms - their pulses appear at the same point in time }
{ stop the tasks }
DAQmxStartTask (AO_TaskHandle);
DAQmxStartTask (DO_TaskHandle);
{ restart the tasks }
DAQmxStartTask (DO_TaskHandle);
DAQmxStartTask (AO_TaskHandle);
Now the two pulse do not have correct timing with respect to each other. If I again stop and restart the tasks, their pulses appear at different times with respect to each other from the previous stop/restart cycle.
I've been told that LabVIEW actually calls a different dll than nicaiu.dll than Delphi does. Perhaps that other dll is configured to restart from the first data point and nicaiu.dll is not ? I do have LV 7.1 if you'd like to send me your code to try. Or if there's another language that also calls nicaiu.dll (CVI or C++ ?) could you try this with that compiler ? If this gets too involved and should be taken to email then summarized back here, how to contact you by email ? Thanks for your interest.
Steve