ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I set the read timeout when using channelReader.ReadWaveform?

Solved!
Go to solution

I am aquiring data using a USB-6210 A/D, and it works great until I try to take a waveform longer than 10s. 

 

When I take a waveform longer than that, I get error 200284, "Some or all of the samples requested have not yet been acquired.  To wait for the samples to become available use a longer read timeout..."

 

No problem, I thought, I'll just set a longer timeout.  I searched through the documentation, and the only timeout I found was the Watchdog timeout.  When I tried to set that to a longer value,  I get status code -200452 - specific property is not supported by the device or is not applicable to the task.

 

I am using the code from the AcqVoltageSamples_IntClk.2008 .net sample with C# in Visual Studio 2008, .net 3.5 sp1.

 

How do I set the timeout so that ReadWaveform() does not timeout?

 

Here is the code:

 

privateAnalogMultiChannelReaderchannelReader;

privateAnalogWaveform<double> awf;

 

publicList<double> GetWaveForm()

{

    try

    {

        Task getWaveform = newTask();

        getWaveform.AIChannels.CreateVoltageChannel(Channel,"", TerminalConfiguration,RangeMinimum,

                    RangeMaximum,AIVoltageUnits.Volts);

        getWaveform.Timing.ConfigureSampleClock("", SampleRate, SampleClockActiveEdge.Rising,

                    SampleQuantityMode.FiniteSamples, NumSamples);

        getWaveform.Control(TaskAction.Verify);

       channelReader = new AnalogMultiChannelReader(getWaveform.Stream);

 

       AnalogWaveform<double>[] data = channelReader.ReadWaveform(NumSamples);

       awf = data[0];

       samples = new List<double>();

       for(inti=0; i<NumSamples ; ++i) samples.Add( awf.Samples[i].Value );

 

       returnsamples;

    }

    catch( DaqExceptionexception)

    {

        MessageBox.Show( exception.Message);

     }

     List<double> l = newList<double>();

 

     return l;

}

 

Thanks,

 

Curt

0 Kudos
Message 1 of 3
(5,013 Views)
Solution
Accepted by topic author cfiedler

Hi Curt,

 

Here is a Knowledge Base that can help you set the Timeout parameter in your code:

 

Using the DAQmx Task Timeout Property in Visual Studio

Regards,
Daniel REDS
RF Systems Engineer

Help us grow.
If a post solves your question, mark it as The Solution.
If a post helps, give Kudos to it.
0 Kudos
Message 2 of 3
(4,986 Views)

Thanks!  That helps a lot!

 

Curt

0 Kudos
Message 3 of 3
(4,982 Views)