Sal- Thanks for taking a look. I admit my post was written fast at the end of the day and perhaps wasn't as clear as it might have been.
>First lets see if I can clear up a little confusion. DAQmx is only for Windows operating systems.
>DAQmxBase is for the Mac OSX operating system. Are you developing two different sets of code (one for each)?
It is one code base with #defines to make DAQmx calls into DAQmxBase calls. There are, of course, some places where I have to add ifdef's to remove functionality that is missing under DAQmx Base.
>You said that it is working correctly in DAQmx. However, your questions all pertain to DAQmx
>function calls. I'm assuming that these are really referring to the DAQmxBase function calls
>on the Mac. Correct?
Oops. I copied the calls from the code where they appear as DAQmx calls, but they are changed to DAQmxBase calls behind the scenes. You are correct- my problems are with DAQmxBase calls on Macintosh.
>1) For some reason your acquisition is timing out. You are not getting the specified number
>of data points in the specified timeout period. Are you using an internal or external
>clock? What is your sampling rate?
The acquisition is happening during the event loop of the host application (the DAQ code is in a plug-in). The intent is to get whatever samples have been acquired so far each time through the event loop. I do that by passing DAQmx_Val_Auto to DAQmx(Base)ReadAnalogF64(). I use the sampsPerChanRead parameter to know how many samples I get each time so that I can display partial results.
This is with an internal clock; it happens with scanning rates anywhere from 10 to a few thousand samples per second. It looks to me like pretty often I make the call after the first channel has been sampled but before the second channel. In that case, I lose a data point and subsequent calls return data with the channels swapped. I'm doing this while scanning two channels; it works when scanning only one and I haven't tried three yet.
>Can you post your code for the DAQmxBase function calls?
That's difficult- my code implements functions that can be called from our application's built-in language so the code is spread around a bit. It comes down pretty much to this:
DAQmxCreateTask(taskname.str().c_str(), &h);
do this twice:
error = DAQmxCreateAIVoltageChan(h, (i->getChannelName(devName)).c_str(), NULL, (*i).getCType(), (*i).getMinV(), (*i).getMaxV(), DAQmx_Val_Volts, NULL);
And read repeatedly at more or less random times:
readerror = DAQmxReadAnalogF64(h, DAQmx_Val_Auto, 0.0, DAQmx_Val_GroupByChannel, &(dAvailableReadArray[0]), dAvailableReadArray.size(), &nSamples, NULL);
dAvailableReadArray is an STL vector of doubles.
The problem happens whether I use DAQmx_Val_GroupByChannel or DAQmx_Val_GroupByScanNumber. Naturally, my unpacking code has to take that into account.
>3) I'm not really sure what is going on here. Can you describe the issue a bit more?
The DAQmxBase function calls are in a plug-in module loaded into our main product (Igor Pro, www.wavemetrics.com). We field an kAEQuitApplication Apple event to quit. After the first call into DAQmxBase, we don't get the Apple event. I'm presuming that this is because the Labview engine (which is basically an application, right?) is eating the event.
>4) Yes, it takes LONG time to load the DAQmxBase functions. DAQmxBase was written in LabVIEW
>(not in C like our other drivers) to get the development done quickly. For this reason it
>takes a bit longer than typical to load the driver.
And has other consequences, like putting a window into our window list!
Again, thank you for taking a look. I've written a lot and not all that clearly!
John Weeks
WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com