10-27-2023 03:53 PM
Thank you for attaching your VI, so that I can try to understand what you want to do. Unfortunately, you are a new LabVIEW user, and are (understandably) using the latest version of LabVIEW, while I am an "old" LabVIEW user, using mainly LabVIEW 2019, and thus unable to open your VI. Could you please open it and "Save for Previous Version", specifying LabVIEW 2019?
I generally tell students that they basically need only a few functions in NI DAQmx (see "Learn 10 Functions in NI-DAQmx ..." mentioned in a previous Reply). Here are some of Bob's Simplified suggestions:
Simple AI Project
and here is its Front Panel after running, showing two (noisy) signals.
Simple AI Front Panel
Note that if you want to treat them separately, the output from the DAQmx Read is simply an Array of two Waveforms, so you can get either Channel by itself using Index Array.
Now, there is one "trick" (aha, you knew there had to be a trick!). Notice the DAQmx Start Task function -- where did I get the "Task Constant" that shows "myDAQ Two AIs"? I right-clicked the Task Index terminal (upper-left of the function) and said "Create Constant". It put in an "blank" Task Constant (see the little "I/O" on the left?). Do you see the little downward triangle on the right? That's a "Selector" -- when I clicked it, it showed me all the Tasks in the Project! There was only one, the one I created in the first step, above.
So don't be afraid of DAQmx, and do stop using the Dreaded DAQ Assistant (and its Evil Twin, the Dynamic Data Wire).
And, yes, I built this using a myDAQ (my myDAQ, I might add).
Bob Schor
10-28-2023 02:46 AM
Hi Bob.
Thanks for you reply.
I'll try soon and I'll update you with results.
10-28-2023 12:05 PM
Oops, there's a "catch" (which I hope to remedy here). I'm so used to working in "Project" view (which means I'm going to "run the code on the Development PC") that I forgot the goal is to create an Executable that can run on any PC with the proper LabVIEW Run-Time and peripherals installed. So you really need to get the DAQmx device name that you plan to use.
Fortunately, DAQmx provides the method to do this, but this is a little more advanced, but easy to use. I'm attaching a Snippet of a sub-VI I call "Find DAQ Device". It uses a DAQmx System property node to get the Device Names of all the DAQmx devices attached to the PC (obviously, you cannot run on a USB-25000 if it isn't connected!) and then lets you search for the Device you want to use. If you have several such devices attached to your PC, you can distinguish between them by Serial Number (illustrated here) if you want. If it finds the device, it passes it out, otherwise it generates a "User Error" (I choose 5001 as the Error Number -- look up "LabVIEW User Errors" to learn more) and added what I hope is a helpful Error Message. Notice I stop the For loop as soon as I get a "hit".
Bob Schor
11-07-2023 05:43 AM
Hi.
I'm triyng to understand your solution.
Should you share the file?
Thanks in advance
11-07-2023 06:03 AM
11-07-2023 01:06 PM
Do you know about "Snippets"? This is a .PNG file that LabVIEW created for me that, when dropped on a blank Block Diagram, expands into LabVIEW (2021, in this case, see upper right corner). Sometimes it doesn't work, because browsers "capture" too much stuff when you click on an Image, but if you paste what you capture into a Text file and delete some of the stuff at the end, it should work.
One reason I chose the Snippet was to encourage people like yourself to "Learn by Doing". Do you know where/how to find DAQmx on the Palette? Right-click on the Block Diagram, click on "Measurement I/O", and there is DAQmx. Open it. I presume you know what "Error In" is. The next two Items are DAQmx Property Nodes. The first two, unfortunately, are a little hard to find. Open the Advanced Palette (the last one on the first DAQmx "page") and then open System Setup. There you'll find the DAQmx System and DAQmx Device nodes. Click on the lower part to select the Property that you want (such as DevNames).
I assume you know about For Loops. You might not know you can put a "Conditional Terminal" (the little Stop sign that the While Loop uses) by right-clicking the left edge of the For and choosing "Conditional Terminal". I use it to stop searching for devices when I find the Device I want.
I trust the rest of the code you can reproduce. The Case Statement lets you specify the Product you want (the name needs to match what NI calls it, but you can modify the code to provide you with a list of all the Products that MAX can see, for example), and I also show that if you are looking for a particular device, you can "search by Serial Number". The final code runs if you do not find a match -- this is code to generate a "User Error" (5001 is what I usually use as my first User Error) and the function shown you will find on the Dialog and User Interface Palette.
Bob Schor