From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Integrate SERIAL .vi with DAQmx .vi

Solved!
Go to solution

Hey everyone,

 

I've searched the forums looking for examples of integrating two .vi's, but have run out of keywords to search for. So here's my question.

 

I have two separate .vi's that operate independently. The first collects data from the DAQmx and writes the data a binary file. The second collects data from the serial port using VISA read and writes the data to a .csv file.

 

My main .vi is the DAQmx read as it has all the GUI's on the front panel. I'd like to take and display 5 string variables from the VISA .vi and display it on the DAQmx .vi. But I just can't seem to do it!

 

I've tried creating two parallel loops in the DAQmx .vi but when I do that, the VISA file doesn't run.

 

Any help will be great, as I believe this problem to be more simple than I am making it. Thanks in advance!

 

 

- Yao

0 Kudos
Message 1 of 6
(2,277 Views)

My suggestion is to keep the VIs separate and create a higher level VI to run each subVI in their own loop. This way you have better control of each type of acquisition. Trying to "integrate" the serial VI into the DAQmx VI isn't such a good idea, as you want to keep your code modularized for easy debugging and modifications.

0 Kudos
Message 2 of 6
(2,275 Views)

Thanks for the quick reply.

 

I'm a little hesitant to create a higher level VI because the DAQmx VI contains 5 charts that update constantly. In addition, this VI is set up in two while loops that will record back-to-back files at 5-minutes each.So with that, I guess I don't feel comfortable going that route.

 

I'm imagining calling the SERIAL VI from my DAQmx VI, and just having the serial and daqmx read/write simultaneously.

 

At this point, by calling the serial VI and placing it in a parallel while loop from the DAQmx VI, the SERIAL data isn't updating dynamically. What it's currently doing is waiting until the DAQmx VI ends (or I press stop) and then the SERIAL vi will write one seconds worth of data to the .csv file.

 

I guess I'm not wiring the parallel wire loops correctly.. Any examples will be greatly appreciated.

 

Thank you!

 

- Yao

 

 

0 Kudos
Message 3 of 6
(2,265 Views)
Solution
Accepted by topic author chaoy

Post your VI.  If one loop isn't running until another loop ends, then you don't have parallel loops.  You must have a data dependency caused by a wire running from one to the other.

Message 4 of 6
(2,261 Views)

Lets get some terms/names straight. Is the VI you are calling DAQmxvi actually one of the DAQmx functions on the palette is it really a top level VI that is calling DAQmx functions? Calling your main vi 'DAQmx read' as you did in your original post is very confusing if its not the actual DAQmx Read function on the palette.

 

If your parallel loop is not working, you are going to have to show some code. There should be NO wiring between the loops.

0 Kudos
Message 5 of 6
(2,260 Views)

Thanks for all the replies. It was a boolean wire running between the two loops.

 

Thanks again!

0 Kudos
Message 6 of 6
(2,254 Views)