03-19-2010 02:20 AM
Hello,
I was trying out the examples in the "ANSI C Examples" folder and ran into a snag with the example in:
"\DAQmx ANSI C\Analog In\Measure Voltage\TDMS-Cont Acq-Int Clk"
When I run it as it is, I get the following error:
DAQmx Error: Requested Every N Samples Event Interval is not supported for the given Data Transfer Mechanism and buffer size.To keep DMA or USB Bulk as the Data Transfer Mechanism, modify the buffer size and/or the Every N Samples Event Interval so the buffer size is an even multipleof the Every N Samples Event Interval. To keep the same Every N Samples Event Interval and buffer size, change the Data Transfer Mechanism to Interrupts if supported.Property: DAQmx_Every N Samples Acq Into Buffer Event IntervalRequested Value: 1000Buffer Size: 12288Task Name: _unnamedTask<0>Status Code: -200877End of program, press Enter key to quit
As I was typing this, I did a quick test. I commented out this line in the code:
/*********************************************/ // DAQmx TDMS Configure Code /*********************************************/ DAQmxErrChk (DAQmxConfigureLogging(taskHandle,"C:\\example.tdms",DAQmx_Val_LogAndRead,"GroupName",DAQmx_Val_OpenOrCreate));
and it worked, as I suspected.
My gut feeling was that the DAQmxConfigureLogging function expects a block of 12288 bytes, and in rest of the code the number of samples is set to 1000, with a sampling rate of 10000.
Anyhow, I fixed it by changing 1000 to 1024 (because 1024 * 12 = 12288) everywhere in the code, hence solving the original problem.
I do have a couple new questions now:
1. Was this an error in example, or am I missing something?
2. How do you change the default 12288 size that DAQmxConfigureLogging() is expecting to lets say 5000?
Thanks you.
Sidhant
Solved! Go to Solution.
03-19-2010 05:15 AM
03-19-2010 03:01 PM
Hey Sidhant,
This is actually a bug with that example. It ships with the 1000 value for the sample interval incorrectly since it is a logging example. When logging is enabled on a task, the default buffer sizes are slightly different than the defaults without logging. This is because the typical default buffer sizes are powers of 10, whereas hard drives prefer powers of 2. This is a performance maneuver since we stream to disk directly from the DAQmx buffer.
I believe you should be able to use 1024 as your sample interval instead of 1000 in this example. The default value in this example will be changed so that it does not immediately error (Corrective Action Request #177199).
03-19-2010 04:05 PM
Andrew,
Thanks a ton for the response. I suspected it was a bug.
So that comment on the power of 2 vs. 10 also answers my second question, which is that it is not possble to change the data block that Logging expects to powers of 10.
Thanks!
Sidhant
03-19-2010 04:09 PM