03-22-2007 05:16 PM
03-23-2007 11:38 AM
03-23-2007 05:49 PM
03-26-2007 05:03 PM
03-26-2007 07:26 PM
Hi,
Typically, when performing digital generation, there is an onboard buffer that holds the samples to be generated each iteration. When you setup the task, this buffer is filled, and regenerated during each output. However, since you want the data to possibly change during each iteration, you will need to turn regeneration off. By doing this, you will be writing to the buffer each iteration – this will end up slowing down the output.
To do this, you will need to use the DAQmx Write property node, “Regeneration mode”, before starting the task. Wire a constant value of “Do Not All Regeneration” to this property, and DAQmx will know to rewrite the buffer during each iteration of the while loop.
There is a Knowledge Base article that includes an example program, demonstrating this exact functionality.
Continuous, Correlated Digital Output on an M-Series DAQ Device without On-Board Regeneration
I hope this helps. Please post back if you have further questions.
Ed W.
Applications Engineer
National Instruments
03-27-2007 09:42 AM
03-27-2007 04:13 PM
03-28-2007 10:38 AM
Hi,
The DAQmx Write function writes data to the device’s buffer. Although the data must be written to RAM first, it is then transferred to the device’s buffer.
The functionality of the Start Task (and Stop Task) is described in the following Knowledge Base entry.
When to Use the DAQmx Start Task and DAQmx Stop Task VIs
Using buffers does not mean that the acquisition or generation will be software timed. In fact, most of the time, buffered generation will still be hardware timed. However, the use of buffers may increase the latency of the generation, meaning the period between when the data is initially written to the buffer and then out of the device.
The property node refers to the amount of space left in the device’s onboard buffer. Because data is being constantly output at relatively high speeds, the amount of space is constantly changing.
Otherwise, because your VI is relatively large, I would recommend getting the example VI attached to the previous post’s KB entry to work, and then apply those changes to your VI.
Also, I would recommend cutting down on your use of local variables (or even better, completely removing all of them). You actually don’t need any of them to achieve the same functionality as your current program. Local variables (as well as global variables, shared variables, etc.) do not obey LabVIEW’s dataflow paradigm, and they can lead to race conditions. There is a nice Developer’s Zone article about the caveats of variables.
Are LabVIEW global variables good or bad, and when is it OK to use them?
Ed W.
Applications Engineer
National Instruments