Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use ai/sampleclock

Hi,

 

can anyone explain how to use "ai/sampleclock"?

 

I have an USB 6210 card and I want to read data from analog and digital in.

 

A very basic setup looks like this:

 

string dev = "dev1";

 

Task t1 = new Task();
t1.AIChannels.CreateVoltageChannel(dev + "/ai0", "", AITerminalConfiguration.Differential, -0.1, 0.1, AIVoltageUnits.Volts);
t1.Timing.ConfigureSampleClock("", 100.0, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples);
t1.Control(TaskAction.Verify);

 

Task t2 = new Task();
t2.DIChannels.CreateChannel(dev + "/port0/line0", "", ChannelLineGrouping.OneChannelForEachLine);
t2.Timing.ConfigureSampleClock(dev + "/ai/SampleClock", 100.0, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples);
t2.Control(TaskAction.Verify);

 

I get an exception at the t2.Timing.ConfigureSampleClock call (also tried with "/ai/sampleclock", /dev1/ai/sampleclock")

Is it not possible to get analog and digital data at the same time with this card?

If I understand the forum posts correctly, I can't use the internal clock to get digital data (how can I check this with the Deviceinfo class?)

What clock source would I use if I only want to get digital data?

 

Kind regards

Stephan

0 Kudos
Message 1 of 4
(5,737 Views)

Hi StephanD,

 

the USB 6210 has no own internal sample clock. What are you trying to achieve with your application?

 

Regards

0 Kudos
Message 2 of 4
(5,719 Views)

Hi FrankLp,

 

I'm trying to read analog and digital data at the same time. For analog data this works as expected. But I don't know how to get digital data with my card.

 

Regards

S.

0 Kudos
Message 3 of 4
(5,703 Views)

Hi StephanD,

 

are you trying to read simultaniously? That means that you have to use threads or processes to get a parrallel execution. Without initiating that, you only got sequentiell execution of your code.

There are good Microsoft Knowledgbase articels on how to do threading in c#:

 

http://msdn.microsoft.com/en-ie/library/ms173178%28v=vs.80%29.aspx

 

Regards

 

0 Kudos
Message 4 of 4
(5,658 Views)