Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I change SampleQuantityMode.FiniteSamples limit?

Hello,
 
I must not be setting something right. I am using a PXI-6281 Daq to take voltage measurements. When I try to take 15 seconds of data at 1000Hz, I get an error that some or all of the samples have not been taken. Here are the highlights of the code.
 
myTask.Timing.ConfigureSampleClock("", 1000, SampleClockActiveEdge.Falling, SampleQuantityMode.FiniteSamples, 15000)
 
Dim rawdata25(,) As Double = reader.ReadMultiSample(15000)
 
The error occurs after execution of the above statement, but will work when there are 10000 samples - ie using the Dim rawdata25(,) As Double = reader.ReadMultiSample(10000) statement.
 
When I trap before executing the reader statement, I see that the buffer is 15000, but the SampleQuantityMode.FiniteSamples = 10178.  When I used the 6281 interface in MAC, it acquires the 15000 datapoints without issue, so I know it is capable and my code isn't correct.
 
Is there a way to change the SampleQuantityMode.FiniteSamples (I have tried and have been unsuccessful)? Maybe I am not in the proper mode to take this many datapoints?
 
Any help would rock!
Mike
0 Kudos
Message 1 of 3
(3,300 Views)

Hello Mike,

Thanks for contacting National Instruments.

By default, DAQmx tasks will timeout after 10 seconds.  With a trying to read 15000 samples at 1000 Hz will take 15 seconds which will cause the read statement to timeout before the read operation can be completed.  This default value can be changed by modifying the Timeout property for the DAQmx task:

myTask.Stream.Timeout = TimeoutValue

Where TimeoutValue is specified in milliseconds.  A value of -1 will force the reader.ReadMultiSample(15000) to wait indefinitely until all of the required samples have been read. 

The tutorial Using NI-DAQmx in Text Based Programming Environments and this forum post are great starting places for programming data acquisition in text based environments. 

DAQmx includes several shipping examples for text based languages that are also useful for building applications.  The DAQmx readme file shows the location of these examples on your computer.  This file is also installed with DAQmx and can be found in the shortcuts folder for DAQmx. 

Getting Started with NI-DAQmx and Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications are also great starting points for programming with DAQmx.  The techniques described in these documents are based in LabVIEW, but can be applied to text based programming with DAQmx. 

Regards,
Browning G
FlexRIO R&D
0 Kudos
Message 2 of 3
(3,277 Views)

BrowningG,

Thank you so much for answering so quickly. I knew it had to be some sort of default or setting I couldn't find. It works great now.

Thanks also for the references to the tutorials and other information. I will read and use them so I know more about setting parameters, etc. for future projects.

Thanks again!!

Mike

0 Kudos
Message 3 of 3
(3,271 Views)