I am using a 9401 with DAQmx drivers and using the API directly in C#.
I'd like to have a frequency output on one pin, and use the others for general purpose output. I need to be able to change the GPIO lines without disturbing the frequency output singnal.
So I have code like this to setup freq output task:
freqTask = new Task();
freqTask.COChannels.CreatePulseChannelFrequency(@"cDAQ1Mod3/ctr2",
"freq_out", COPulseFrequencyUnits.Hertz, COPulseIdleState.Low, 0.0,2000, 0.5);
freqTask.Timing.ConfigureImplicit(SampleQuantityMode.ContinuousSamples, 1000);
And I have the following to setup up digital output:
digitalTask = new Task();
digitalTask.DOChannels.CreateChannel("cDAQ1Mod3/port0/line6", "dig_out",
ChannelLineGrouping.OneChannelForEachLine);
Then I verify both:
freqTask.Control(TaskAction.Verify);
digitalTask.Control(TaskAction.Verify);
Then I start the freq output with:
freqTask.Start();
But ... when I try to change the digital output with code like the following, I get an exception stating that the resources are tied up with another task.
digitalWriter.WriteSingleSampleSingleLine(true, dataArray);
If I surround the digital output change with stopping/re-starting the frequency task, then it works. But this causes a pause in the frequency output, which I can't tolerate.
freqTask.Stop();
digitalWriter.WriteSingleSampleSingleLine(true, dataArray);
freqTask.Start();
Any ideas? Thanks for any help.