Quantcast
Channel: Counter/Timer topics
Viewing all articles
Browse latest Browse all 1271

CounterReader exception: "This is not valid for acquisitions without a buffer."

$
0
0

I am trying to trouble shoot a problem with counter reading that occurs only under some circumstances.  If a certain sequence of actions happens in my software, running a multisample read on a CounterReader returns the following error:

 

 

By setting Number of Samples per Channel to -1, you indicated that all available data should be read. This is not valid for acquisitions without a buffer.

Specify a value greater than or equal to zero for Number of Samples per Channel. Do not specify a value of zero for Buffer Size when configuring the input buffer.

 

 My code is:

 

 

myXCounterTask = gcnew Task("X Counter");

myXCounterTask->CIChannels->CreateLinearEncoderChannel (..)

myXCounterTask->Timing->ConfigureSampleClock("/Dev1/PFI0", 8000, SampleClockActiveEdge::Rising, SampleQuantityMode::ContinuousSamples, numberOfSamples );

myXCounterTask->Stream->Buffer->InputBufferSize = numberOfSamples * 20;

counterXInReader = gcnew CounterReader(myXCounterTask->Stream);

array<double>^ posX = counterXInReader->ReadMultiSampleDouble(-1);

 

What is confusing is that this code works fine generally, but fails if certain sequences daqmx commands are run previously, which makes me think that I am not initializing something correctly and depending on it to be in a default state.  I'm trying to understand which buffer the error is referring to, and how I can check it's size?  It is apparently not the Task's buffer, since that is set.  Are there other buffers associated with the CounterReader?


Viewing all articles
Browse latest Browse all 1271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>