Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Pausing analog output using compactDAQ 9189 and NI9260

Hi everyone,

 

I'm using a compactDAQ 9189 chassis with one NI9260 24 bit analog voltage output channel. I'm using the C-library in Python to control the instrument and Windows 7 (I also have Labview installed, both produce identical results). My goal is the following

- Load a periodic waveform with let's say 1000 points per period (=100 ms). Repeat this single period 100 times and stop the task. 

- Have exact control over timing during playback of this waveform. Ideally I would pause between each sample point for a short amount of time and tell it with a trigger when to advance to the next point in the waveform. 

 

I have tried the following two approaches, based on  the cDAQ9189 manual and posts on this forum. After setting up the task and channel, I configured the pause trigger polarity at my PFI0 input of the cDAQ chassis. Then I configured the measurement to run continuously with DAQmxCfgSampClkTiming: sampleMode set to DAQmx_Val_ContSamps, and to allow regeneration using DAQmxSetWriteRegenMode. This then leaves me two options, either have the regeneration happen in the output buffer on the computer, or onboard, thereby bypassing the output buffer. Here I ran into trouble:

  1. For onboard regeneration, I tried to set the AO_UseOnlyOnBrdMem property to True, but the driver returns the error message before the task is even started (error number -200077): 
PyDAQmx.DAQmxFunctions.InvalidAttributeValueError: Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property.
Property: DAQmx_AO_UseOnlyOnBrdMem
Requested Value: 1
Possible Values: 0

Question: Does this mean that the NI9260 doesn't allow this property to be set? Since that would seem strange, what could be the other property that conflicts with AO_UseOnlyOnBrdMem?

2. If I can't use AO_UseOnlyOnBrdMem, I'm stuck with 127 samples in the FIFO buffer (see NI9260 datasheet) compared to 8192 samples otherwise. In this mode, I can successfully start the task and after receiving the first pause trigger the AO generation starts and ends when the pause trigger goes low (perfect). However, upon receiving the 2nd pause trigger to resume the AO generation the driver throws an exception. 

 

PyDAQmx.DAQmxFunctions.OutputFIFOUnderflow2Error: Onboard device memory underflow. Because of system and/or bus-bandwidth limitations, the driver could not write data to the device fast enough to keep up with the device output rate.

Reduce your sample rate. If your data transfer method is interrupts, try using DMA or USB Bulk. You can also reduce the number of programs your computer is executing concurrently.

 

I understand that 127 samples empty in about 10 ms for my example waveform. It seems the computer can't keep up with replenishing this buffer. I am using the USB Bulk data transfer mechanism, already with a low sample rate of 1.6 kHz and 20 samples in the buffer as a test. 

Question: How can I get either of these two to work so that I can step through the waveform playback using the pause trigger signals. Or maybe there's a secret option number three, and I'm open to that as well.

Another question I have is: once this is working properly, what is the time between receiving the pause trigger and continuing the AO generation?

 

I've attached a picture with the other settings I'm using for the NI9260, maybe one of them clearly conflicts with the onboard memory settings I am trying to set. I've also attached a screenshot of a Labview program that creates the problem in 1. Any help would be appreciated.

 

Best,

 

Gerwin

Download All
0 Kudos
Message 1 of 6
(2,734 Views)

Hi Gerwin,

 

From looking at the code screenshot you've attached it appears that you are doing both User Buffer and FIFO regeneration.

The following document outlines the differences between the two, have you tried just using one of the implementations?

 

Analog Output Regeneration in DAQmx

http://www.ni.com/product-documentation/3874/en/

 

Is this error present using only one of the methods?

 

Best

Alex
Hardware Engineer
0 Kudos
Message 2 of 6
(2,697 Views)

Hi Alex, 

 

Thanks for replying. I've implemented this example and the same error still persists.

I've attached a screenshot of my program again. If I use the onboard memory, I still have to write and start the task as usual I presumed..

The task runs without errors if unboard memory regeneration is set to False.

 

Gerwin

0 Kudos
Message 3 of 6
(2,693 Views)

Hi Gerwin,

 

I replicated the error here on my end, so it appears to be expected behavior.

From looking in the 9260 datasheet, I didn't see any mention of a configurable FIFO, so this device isn't capable of this property.

 

Best,

Alex
Hardware Engineer
0 Kudos
Message 4 of 6
(2,682 Views)

I am not sure why in this particular case you would want to play with the buffer.

Did you check the LabVIEW examples? It seems to me like "Voltage - Finite Output.vi" would be a good base for your program.

It already enables you to use external sampling clock and pause trigger.

0 Kudos
Message 5 of 6
(2,674 Views)

Also - this is a nice article explaining the cDAQ subsystem specifications, buffers etc.: http://www.ni.com/product-documentation/53091/en/

0 Kudos
Message 6 of 6
(2,672 Views)