01-07-2011 01:22 PM
I am trying code a CVI application to communicate with a USB-6210. I want to start the acquisition to acquire 30 samples and then collect them. My problem is when I call the function DAQmxReadAnalogF64() I get this -200284 error message. In a nut shell the error message means the data has not been acquired yet. It says I should make sure my start trigger is configured properly. I was trying to use the internal clock to start the acquistion. I figure I did not set up something properly.
In the function DAQmxCfgSampClkTiming() I set the sampleMode to DAQmx_Val_FiniteSamps which I thought would make it collect the 30 samples (number_of_scans=30) when I called DAQmxStartTask(). That does not work. When I set sampleMode to DAQmx_Val_ContSamps I can collect the data. Below is a stripped down essential of my code:
returnAcq = DAQmxCreateTask ("myAcqTask", &acq_taskHandle);
returnAcq = DAQmxCreateAIVoltageChan(acq_taskHandle,physicalChannel, "acq_channel",DAQmx_Val_Diff, minVal, maxVal, DAQmx_Val_Volts,"");
returnAcq = DAQmxCfgSampClkTiming( acq_taskHandle, "OnboardClock", sweepsInterval,DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, number_of_scans);
returnAcq = DAQmxStartTask (acq_taskHandle);
returnAcq = DAQmxReadAnalogF64(acq_taskHandle, -1, 5, DAQmx_Val_GroupByChannel, Data_readings, number_of_scans, &read,0);
// Clear the task
DAQmxClearTask (acq_taskHandle);
I guess my question is: Am I set up so the internal clock will start the acquistion when I call DAQmxStartTask()? I thought when I set the second parameter in DAQmxCfgSampClkTiming() to "OnboardClock" this would make it use the internal clock.
Thanks in advance for your help,
Don Pearce
Solved! Go to Solution.
01-07-2011 02:16 PM
Don,
You are correct, your task is configured to be using an internal sample clock with a software start trigger. The error description points out several common reasons why people might see this error. What is the value of 'sweepsInterval'? I believe that as configured DAQmx should be clocking data in at the rate (in Hz) specified by sweepsInterval. By passing -1 into the numSampsPerChan input, I believe that DAQmx will attempt to read all samples for a finite acquisition (30 in your case). If you are running less than 6 Hz, the read could would timeout before this data was available.
When configured as continuous, what values is passed back in the sampsPerChanRead parameter?
Dan
01-07-2011 05:10 PM
I looked at it again and realized that sweepsInterval was wrong; it was in sample time instead of sample rate. I wanted to take a sample every 1.67 ms and I had sweepsInterval= 0.00167. So when I changed that input to 1.0/sweepsInterval everything was ok. Looks like it was the ole loose nut behind the keyboard problem. Thanks for you help.