ScanImage 2018 : Daq Task Get Max Sample Rate

 

Description:

The 'Daq Task Get Max Sample Rate' utility is a MATLAB function that is provided as a workaround for the bug in DAQmx 9.8.0f3 where 'sampClkMaxRate' reports faster clock rates for multi-channel AOs than supported by hardware (observed with PCIe-6321).

 

Directory Location:

<ScanImage Application Directory>/+scanimage/+util/

 

Syntax:

        rate = scanimage.util.daqTaskGetMaxSampleRate(hTask, numChans)

 

Input/Output Parameters:

  • hTask
    'hTask'

  • numChans
    'numChans'

  • rate
    'rate'

 

Details:

The following was communicated with NI:

Hardware: PCIe-6321, PXIe-6341

DAQmx version: 9.8.0f3

Problem description:

According to the specifications, the PCIe-632x and PXIe-634x support the following AO sample rates:

      • 1 channel: 900 kS/s
      • 2 channels: 840 kS/s per channel
      • 3 channels: 775 kS/s per channel
      • 4 channels: 719 kS/s per channel

When configuring an AO task with multiple channels on one of these cards, the maximum sample rate of 917431.19 Hz is returned by the property SampClock.MaxRate, regardless of the number of channels within the task.

 

Expected behavior: SampClock.MaxRate should return the maximum sample rate for the AO task that is actually achievable. (For AI tasks, this works already in DAQmx 9.8).

  Setting a sample clock that is too high should coerce the value to an achievable rate and/or return an error.

 

Actual behavior: If the sample rate of a task with multiple AO channels is set to the value of SampClock.MaxRate, it will abort with error -200018: 'DAC conversion attempted before data to be converted was available.'

Steps to reproduce:

  • Install a PCIe-632x or PXIe-634x.
  • Open the attached VI.
  • Run it with one channel -> no error occurs
  • Configure 2 channels and start -> error -200018 occurs. Note that the maximum reported sample rate is incorrect (according to the specs).
  • Workaround: Set the Sample Clock Reduction Factor to 0.92 and run the task again -> the task should be executable now.