Quantcast
Channel: Measurement Studio for .NET Languages topics
Viewing all articles
Browse latest Browse all 1999

9401 with frequency output and simultaneous async digital output?

$
0
0

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.


Viewing all articles
Browse latest Browse all 1999

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>