LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog Output Regeneration in NI-DAQmx (PXIe-6738)

I am trying to create a VI that will program a pin in PXe-6738 analog output with waveform and have the output regenerated using the Board FIFO without having the vi running to reproduce the waveform. as a starting point i used the vi from the examples shipped with labview and enabled AO.UseOnlyOnBrdMem. this didn't work because when i stop the vi i lose the waveform.

 

Also i followed the instructions in this solution https://www.ni.com/en/support/documentation/supplemental/06/analog-output-regeneration-in-ni-daqmx.h... but that didnt work either. 

i read through PXe-6738 documentation i see that this board supports Periodic waveform regeneration mode from onboard FIFO. 

can anybody help me with a working example or guide me to any forum or document that can help solve this issue.

attached file is the vi i am using i have Labview 2018

AO_fifo.png

 

Download All
0 Kudos
Message 1 of 4
(3,275 Views)

If you want the task to keep regenerating, don't stop or clear it. 

 

A subtler issue that might come up next is that if you were to simply remove the DAQmx Stop and Clear calls, you'd probably see the task stop anyway.  This is an auto-cleanup feature where LabVIEW releases references (such as task refnums) and other resources when code stops running.

 

You'll need to keep the task refnum "alive" to let the task keep running.   Often this is handled by feeding the refnum into a vi with a CPU-friendly blocking function.  For example, a subvi with a Dequeue function and infinite timeout.  The code stays in run state, preserving the task refnum that came in, until you send an exit message into the queue to let it unblock and revert to idle state.  (You'd then normally stop and clear the task explicitly since you have the task refnum available to do so.)

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 4
(3,268 Views)

thank you for the answer. i agree with lot of things you said but i have a hard time accepting your solution. when i read the help document from Labview https://www.ni.com/en/support/documentation/supplemental/06/analog-output-regeneration-in-ni-daqmx.h... its says"

 

"when regeneration is enabled, data written to either the user buffer or the FIFO is reused by the DAQ device. In this way, a continuous output can be achieved without LabVIEW"

 

This means you don't need the VI to have any resources alive to have the waveform generated.

0 Kudos
Message 3 of 4
(3,258 Views)

You cut off the quote before the end of the sentence.

"...In this way, a continuous output can be achieved without LabVIEW (or other ADE) having to continuously write new data to the buffer."

 

In the code you posted, this is exactly what you've already demonstrated in your loop that polls for 'Stop'.  AO generates continuously from the onboard buffer without LabVIEW writing new data to the buffer.

 

This is different than supposing you can quit executing LabVIEW entirely while regeneration continues.  When LabVIEW stops, it cleans up after itself, which would include stopping DAQmx tasks to free resources associated with them.  (Actually, I kinda think the old legacy driver from 15+ years ago *might* have allowed onboard regeneration to continue after LabVIEW code went idle.  Apparently this was considered a risky flaw that needed to be corrected by the auto-cleanup that came with DAQmx.)  

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 4 of 4
(3,244 Views)