Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

readmultisample - Number of samples

I am using a USB-6210 to aquire multiple channel data. Configuring the device as follows will work.

 

ChanData = NI_Task.AIChannels.CreateVoltageChannel("Dev1/ai0", System.String.Empty, AITerminalConfiguration.Rse, 0, 5000, "Chan1Scale")
ChanData = NI_Task.AIChannels.CreateVoltageChannel("Dev1/ai1", System.String.Empty, AITerminalConfiguration.Rse, -10, 10, AIVoltageUnits.Volts)
ChanData = NI_Task.AIChannels.CreateVoltageChannel("Dev1/ai2", System.String.Empty, AITerminalConfiguration.Rse, 0, 30, "Chan3Scale")

 

NI_Task.Timing.SampleTimingType = SampleTimingType.OnDemand
NI_Task.Timing.SampleClockActiveEdge = SampleClockActiveEdge.Rising
NI_Task.Timing.SampleClockRate = 1000
NI_Task.Timing.SampleQuantityMode = SampleQuantityMode.FiniteSamples

 

NIData = DataReader.ReadMultiSample(2000)

 

If I configure the sample clock as follows, ReadMutliSample always returns 1000 samples no matter what I pass as an argument.

 

NI_Task.Timing.ConfigureSampleClock(System.String.Empty, 1000, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples)

 

What is the difference? 

 

In order to use triggering to start the aquisition, I get an error setting the SampleTimingType to OnDemand. I can get the triggering to work using ConfigureSampleClock but then I always get 1000 samples no matter what I pass to ReadMultiSample.

 

Help,

John

 

0 Kudos
Message 1 of 3
(3,651 Views)

Hello John,

 

I've been looking at the Acq-0IntClk-DigStartRef.c example in LabWindows/CVI, and it looks like the DAQmx functions look a bit different then what you're using. Could you specify which version of DAQmx you have?

In the version I'm using, there's an additional parameter for configuring the clock that specifies how many finite samples to take. It looks like this:

 

DAQmxCfgSampClkTiming(taskHandle,"",rate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,sampsPerChan)

 

According to this forum post 

 

http://forums.ni.com/t5/Measurement-Studio-for-VC/Sample-size-in-sample-clock-and-read-APIs/m-p/7685...

 

the ConfigureSampleClock command further determines the entire buffer size, so your ReadMultiSample can only pull 1000 samples from the buffer even if you specify a larger read number.

 

How are you implementing triggering? It seems like getting this to work as desired would probably involve altering that implementation.

 

Best,

 

Daniel

 

 

 

0 Kudos
Message 2 of 3
(3,617 Views)

Hi Daniel,

 

Thanks for the response. The DAQmx version is 15.1.1. which is the latest. In the .Net framework there are two overloads for this method (which I didn't notice before). They are both the same with the exception of the SamplesPerChannel parameter. Essentially this parameter is optional so I got no errors by not including the parameter.

 

I did resolve this issue by inserting the SamplesPerChannel statement before the ReadMutliSample function as follows:

 

NI_Task.Timing.SamplesPerChannel = 2000

 

NIData = DataReader.ReadMultiSample(2000)

 

This seems a bit redundant but it works. 

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