I am trying to do a buffered, timed read on the DIO lines on PCI-6229. I am working in C++ using VC++.net.
I greatly appreciate your help- this is a lot of stuff to read through!
I set up the read this way (just the DAQmx lines included):
string lines = "/pci6229/port0/line0:1";
if (NIerror = DAQmxCreateTask(taskname.str().c_str(), &h))
if (NIerror = DAQmxCreateDIChan(h, lines.c_str(), NULL, grouping)) // grouping set to DAQmx_Val_ChanPerLine
if (NIerror = DAQmxCfgSampClkTiming(h, clockSource.c_str(), clockRate, clockEdge , DAQmx_Val_FiniteSamps, numSamples))
clockSource is "/pci6229/ctr0internaloutput"
clockRate is 1.0 (but the counter is actually going at a rate of 10- is that a problem?)
clockEdge is 10171 (DAQmx_Val_Falling)
numSamples is 128
added to try to fix the problem:
if (NIerror = DAQmxCfgInputBuffer(h, numSamples*4))
if (NIerror = DAQmxStartTask(h))
Now I periodically use these calls to try to get the data:
uInt32 AvailableSamples;
int32 error = DAQmxGetReadAvailSampPerChan(GetTaskHandle(), &AvailableSamples);
if (AvailableSamples > 0)
{
uInt32 numChans;
error = DAQmxGetTaskNumChans(GetTaskHandle(), &numChans);
// vector
readArray(AvailableSamples*numChans, 0); // first tried this
vector readArray(300*numChans, 0); // desperation attempt to try to make it work
int32 sampsPerChanRead;
int32 numBytesPerSamp;
int32 error = DAQmxReadDigitalLines(GetTaskHandle(), readArray.size(), timeout, DAQmx_Val_GroupByChannel, & readArray[0], readArray.size(), &sampsPerChanRead, &numBytesPerSamp, NULL);
This call to DAQmxReadDigitalLines always returns error -200229. I have tried to increase the size of every buffer I can identify. Is this operation simply not something that can be done?
John Weeks
WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com