In order to generate multiple analog waveforms through an NI-9263, I am using this VI to produce waveforms that can be edited at runtime. However, the waveforms take ~30 seconds to update regardless of the buffer size, frequency of signals, or the number of channels in use. I have found a new VI which allows me to instantaneously update my waveform output, but it only does this on one channel of my DAQ. Is there a way to modify the new VI such that I can output multiple channels of analog waveforms while keeping the ability to update these waveforms in real-time?
In response to your immediate question, you can modifiy the new VI to output to multiple channels; I've included an example of doing so below.
1) Initialize an array corresponding to the number of channels desired to output, with an waveform constant as the element.
2) Replace the elements of the array with the generated waveform. We optimize memory by pre-allocating the array and replacing the elements, rather than creating an array each time.
3) Change the DAQmx write task to multiple channels
Now, I want to step back to discuss your question in general about updating multiple channels in real time. Even modifying the new VI with the edits above, as you add more channels to the task, the update time is going to increase.
The reason is that when you call the write VI, the waveform data is copied to a temporary memory location, called a buffer, before being transferred to the device. The more channels that you are attempting to write to, the more data that is stored in the buffer that will need to be transferred to the device. How fast or slow that will happen is dependent upon your device's specifications. Here's a few resources providing some further information about buffers:
If it is critcal to have interactive control of a waveform output to multiple channels for your application, I would suggest looking at using a function generator instead.
Also, just as another note, I just realized that this was posted in the LabVIEW forums; in order to receive more views and responses, I'd suggest you post issues of this nature in the MultifunctionDAQ forum in the future.
Thank you for your suggestion, would you be able to post the VI you modified in a response? I'm trying to modify my VI in the way you suggested, but I keep getting errors.
What errors are you seeing? Did you make sure to connect the output of the array to the other shift register?
I tried to create the waveform constant in such a way that it would reference the waveform characteristics described within the while loop but was unable to. I also tried connecting the output of the array to the shift register, but it kept deleting the block structure inside of the while loop. Also, I could only enter information for the first waveform, even after I had gotten the block structure inside the loop to stop disappearing. Is there any way you could walk me through this, if you cannot post the file?
I don't really understand what you mean. You don't need to reference the waveform characteristics in the while loop. Your waveform constant doesn't need to be anything other than a default waveform constant.
I also don't really understand what you mean about the block structure disappearing. I’ll just describe the steps I performed in further detail below to see if this helps:
Let me know if that clarified the steps. See the picture in my earlier post as a reference. Have a good one!
Thank you so much for your detailed help! I followed your instructions, and was able to successfully run my VI. However, I still can only change the waveform characteristics of one waveform (there are no toggles on the front panel to change the signal properties of the 2nd waveform, as far as I can tell). Is there a way for me to add a waveform property array that allows me to change characteristics of waveforms, going from channel 0->n?
I have attached screenshots of what I have so far, and please let me know if you think I'm making an obvious mistake somewhere.
Thanks again for your instructions,
Please do not attach "screen shots" of pieces of (or entire) Block Diagrams. They are hard to see, impossible to edit, and impossible to test unless we do the laborious work of trying to duplicate your code, warts and all. Instead, attach your VI, or, even better, if you are using LabVIEW Project to encapsulate all your VIs and they are all in the same folder, compress the folder (right-click folder, choose Send To and use Compress from the drop-down), and attach the resulting .ZIP file. It's a single file, has all the TypeDefs and sub-VIs we might need, and, if necessary, we can actually try to run your code.
Thanks for letting me know about attaching screenshots. During some testing of the VI I attached in my previous response, I found that an error consistently appeared when I tried to test my VI with my physical mDAQ. This error only appears when I test the physical DAQ unit that my lab owns, but when I test a simulated DAQ created in NI MAX (which is the same NI9181 unit), I get no error. Do you have any idea why this error might be occuring, and if so, do you have any ideas about how to fix it?