Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Daqmx ReadMultiSample - always old values in buffer

Hi!

I want to read in a given period of time, 20 samples from my 6025E.

I configured my task like this:

In the constructor:
this.KraftT.AIChannels.CreateVoltageChannel("Dev1/ai0","aiChannel",AITerminalConfiguration.Differential,0,10.0, AIVoltageUnits.Volts);

this.KraftT.Timing.ConfigureSampleClock("",this.konfig.100,SampleClockActiveEdge.Rising,SampleQuantityMode.ContinuousSamples);

this.KraftC = new AnalogSingleChannelReader(this.KraftT.Stream);

analogCallback = new AsyncCallback(AnalogInCallback);
this.KraftT.Start();

In the Callback:
this.m_NICallback(NationalInstruments.Analysis.Math.Statistics.Mean(this.KraftC.EndReadMultiSample(ar)));

In the called function:
return NationalInstrume
nts.Analysis.Math.Statistics.Mean(this.KraftC.ReadMultiSample(20));

My problem:
If I call my function just one time, I get the real value. The next values are all stored in the buffer, and when the voltage is in real higher, I only read the "old-values" which are stored in the buffer.
So I need any buffer - clear method, before calling my function, because I only need the actual values.
Can I reduce the buffer size to solve the problem, or what can I do ?

Please write back soon.!
Thanks,
Klaus
0 Kudos
Message 1 of 2
(3,608 Views)
Klaus:

I just answered a very similar (same?) question at the following URL

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=50650000000800000058EF0000&USEARCHCONTEXT_CATEGORY_0=_342_%24_7_&USEARCHCONTEXT_CATEGORY_S=0&UCATEGORY_0=_342_%24_7_&UCATEGORY_S=0

If this doesn't help you, please let me know.

Thanks,

Chris W
NI .NET DAQmx Team
0 Kudos
Message 2 of 2
(3,608 Views)