09-05-2012 01:17 PM - edited 09-05-2012 01:20 PM
I don't have Measurement Studio, but I'm using the .NET 4 support available with DAQmx.
The following code throws a timeout on the ReadMultiSample() call. Can someone please tell me what I'm doing wrong? I'd like to get 40,000 samples with a sample rate of 20 kHz. I've renamed by USB-6216 device to "Meas1" using MAX.
[edit] I should point out that I'm using AnalogMultiChannelReader because I intend to be capturing more than one channel once I figure this out.
Thanks in advance!
using (Task task = new Task()) {
task.AIChannels.CreateVoltageChannel("Meas1/ai1", "", AITerminalConfiguration.Differential, -0.2, 0.2, AIVoltageUnits.Volts);
task.Timing.SampleQuantityMode = SampleQuantityMode.FiniteSamples;
task.Timing.SampleClockRate = 20000;
task.Timing.SamplesPerChannel = 40000;
AnalogMultiChannelReader reader = new AnalogMultiChannelReader(task.Stream);
task.Start();
samples = reader.ReadMultiSample(40000); // <-- Timeout occurs during this call
task.Stop();
}
Solved! Go to Solution.
09-05-2012 01:43 PM
I forgot to set the SampleTimingType:
task.Timing.SampleTimingType = SampleTimingType.SampleClock;