I'd like to measure two external signals (via a single BNC cDAQ module, if that matters) and display them in separate waveform graphs. I've shamelessly ripped my VI from the "Voltage - Continuous Input" example VI, and I'm trying to modify it to accomplish this task. I learned from a YouTube video that I needed to wire one Read VI's Error Out to the other's Error In in order to not throw and error in the while loop. However, it appears that I am throwing an error when attempting to start 2 tasks at once.
I'm still learning how to stand on my own two legs without the DAQ Assistant for the inputs, and I don't fully understand the relationship between the module physically sampling the voltages, the sample clock/timing, and the "task" that needs to run from each VI to the next, so I assume that that is my issue here.
For the why: if you open the VI's front panel, you'll note that I'd like to see each input's waveform on a pretty small waveform graph, and displaying them together on the same graph would get quite busy. I would also like to expand this system to include even more inputs in the future.
I've included an image of the front panel for those who do not wish to download the VI, as well.
In the meantime, my next idea to examine whether I can use the Create VI to sample both channels from the same cDAQ module and split it up in the while loop.
Thank you in advance for any advice!
Solved! Go to Solution.
Assuming you intend to simultaneously sample two Channels from a single DAQ device, configure your Task to "sample two channels from a single DAQ device", do an "Multi-Channel, Multi-point" DAQmx Read inside the While Loop (specifying an Array of Waveforms provides a very convenient output), then simply take your output (which has a 2 x N Array, assuming you specified two Channels) and, using Index Array, send each Channel to a separate Waveform Chart (or Graph, though I suspect you'll want a Chart).
When I "got started" with DAQmx, I read Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications . As a "beginner", I used the "Let MAX help you Create Your Task" method --
Now you use the "3 DAQmx function" method to build your Acquisition Application.
Once you get the hang of it, you can learn a few other DAQmx functions and can skip "hand-coding" the Tasks in MAX (which, of course, only works on the PC that you used to configure the Task).
Thank you once again for your help, and for the extra details and advice.
For others looking into this issue: as I was pondering the problem I originally posted here, I realized that I might be able sample 2 (or more) signals via the same task. Then in the while loop, it might create a 1D array of waveforms which then could be indexed, each element going to its own graph. After wiring it up, this seems to have solved my problem and I am now getting the desired results (so far). I have attached a screenshot of the block diagram and running front panel for any others who might be searching for a solution to this problem.
Any further critique of this VI is always appreciated!
Note: You only need one DAQmx Create Channel vi. The trick is to select two channels(or more) in the physical channel control from the front panel by selecting browse from the down arrow and using CTRL click to select your 2 channels.
The error is because you are trying to use the same resource, my advice is to use the same source channel but you must select the channels that you are going to use. In this case 2 channels, then in the read output you can select if you want the data as 2D DBL or as 1D array of waveform DBL.
Select browse, then select the channels that you want.
As you can see, now you have two channels in one chart.
After this, you can "play" with the "DAQmx Read" output values and using different charts to show the data. (split the data with the array functions).