07-07-2016 10:24 AM
Hi,
I have a NI 9361 module in a cDAQ 9178 chassis. My workflow is as follows:
1) Create a task
2) Add a counter input channel to the task
3) Query the maximum Counter input timebase rate using DAQmxGetDevCIMaxTimebase.
4) Set the sample clock rate, using DAQmxSetSampClkRate, to the rate queried in Step 3.
5) Perform other steps such as add analog input channel or external clock to the task.
I get an error message in step 4:
Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property.
Property: DAQmx_SampClk_Rate
Requested Value: 100.0e6
Maximum Value: 40.0e6
Minimum Value: 22.250739e-309
Why is step 3 returning 100.0e6 when I can only set a maximum of 40.0e6? Should I be calling a different method instead of DAQmxGetDevCIMaxTimebase? I have attached my code for your reference.
Thanks,
Varun Hariharan
MathWorks
Solved! Go to Solution.
07-08-2016 09:43 AM
Hi Varun,
Have you tried any of the shipping examples or community examples of counter tasks online?
According to the following link, the max sample rate is actually 102.4kHz:
07-14-2016 10:18 AM
Hello,
The examples do not show what is the maximum rate that can be set for counter input channels.
Also, I am looking for a way to ask the device for that number (102.4kHz). What would be the method that I should use to get that information.
Thanks,
Varun Hariharan
MathWorks
07-15-2016 11:51 AM
Hi Varun,
The DAQmxGetDevCIMaxTimebase returns the internal timebase the module uses for its counter measurements, not the timing engine timebase. The timing engine timebase (which you can get with DAQmxGetSampClkTimebaseRate) is divided down to generate a sample clock to get data from the device. The maximum sample clock rate of the module is 102.4kHz, and you can get that information by calling the DAQmxGetSampClkMaxRate function on your task.
07-25-2016 10:15 AM
Hello Cristina,
Thanks for that suggestion. That seemed to work for the NI 9361 module on my cDAQ chassis. However, calling DAQmxGetSampClkMaxRate on a USB device such as NI USB 6211 throws the following error:
NI Error -200452: Specified property is not supported by the device or is not applicable to the task. Property: DAQmx_SampClk_MaxRate Task Name: _unnamedTask<75> Status Code: -200452
Why am I unable to call this method across all devices? Is there a different function I should be calling in this case?
Thanks,
Varun Hariharan.
MathWorks
07-25-2016 04:31 PM
Hi Varun,
I was able to read that property using a simulated USB-6211. I haven't checked for an actual device, but the simulated one should be the same behavior. How are you calling the DAQmxGetSampClkMaxRate function? Can you post a small code snippet?
07-26-2016 10:40 AM - edited 07-26-2016 10:41 AM
Hello Cody,
I have attached my code snippet. I see the same error with USB-6211 and also with a USB-6351 device (both of these are simulated devices).
Please let me know your thoughts.
Thanks,
Varun Hariharan
MathWorks
07-26-2016 06:53 PM
There's a difference in the way counters work for the NI 9361 in cDAQ and counters in other devices (including the chassis counters on cDAQ). The NI 9361 uses a chassis timing engine, so it does not require an external sample clock, and it transfers data to the backplane on every sample clock. Therefore, there's a limitation on how fast that can happen and the DAQmxGetSampClkMaxRate function allows users to query that value. Counters on the USB 6211 and USB 6351 require an external sample clock, and since they are one of the subsystems in the device, the maximum sample rate is not dependent on any data transfers or timing engine constraints, so DAQmx does not support the max sample rate property (for counter tasks). For these devices, you get an error if the counters don't have new data in between sample clocks (because the sample clock is faster than the input signal on the counter source).