LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ VI as a sub VI. Problems!!

Hello,

 

I got a problem with have a data acquisiton file as a sub VI, then I plugged it in my main VI. My questions are;

1. Are there any problems with having a DAQ file as a sub VI. Will it be read normally? As I have tested it with the test bench, the dataflow was stuck on the sub VI block.

2. The output from the DAQ sub VI is the Data Main Stream in the main VI. I need to use many sub VI blocks to connect all wires in the diagram (you can see in my VI). Is it an issue?

 

Download All
0 Kudos
Message 1 of 21
(3,625 Views)

Does your subVI have a while loop?  When a subVI is called normally in a main VI, the main VI won't execute past the subVI until the subVI has completed its execution.  This if part of the rules of dataflow.

 

So your subVI needs to have the while loop eliminated.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 2 of 21
(3,619 Views)

Yes my sub VI has a while loop. However, I created the switch stopping the while loop as a input of the sub VI. When I import this DAQ sub VI into the main one, there is a switch to be pressed in order to continue the dataflow. You can see in my VI but I'm not pretty sure if it's a good idea to have the same sub VI connecting to every event case more than one time. Could you please take a look at my VI? then tell me what's wrong

0 Kudos
Message 3 of 21
(3,615 Views)

When you call the subVI, does the front panel actually open so that the user can press the stop button?

0 Kudos
Message 4 of 21
(3,613 Views)

Actually I don't want any stop buttons to stop the while loop in the sub VI because I want the data to be plotted at the same time as the data flows. Are there any other solutions to work around this?

 

0 Kudos
Message 5 of 21
(3,611 Views)

It makes no sense at all to have a subVI with a while loop and a stop button unless you actually display the subVI. Your subVI also has while loop and a local variable. This is bad design. You have been told to avoid locals and you still persist in using them incorrectly. Your main while loop has exactly the same problem that has already been discussed and you have not fixed that either. Stop and listen or stop asking questions. If or one am tired of seeing the same mistakes repeated and repeated.

0 Kudos
Message 6 of 21
(3,604 Views)
Sorry but this sub vi doesn't belong to me. Its from the company. My task is to comnect my vi with this vi, that's why i created it as a sub vi. Then i'll plug all connected vis to the test bench that I already have.
0 Kudos
Message 7 of 21
(3,601 Views)

Change it. Or have the person who wrote it post here. Someone will carefully explain why it is badly written.

 

p.s. That still does not explain your main VI that is simply incapable of repeatedly acquiring anything at all in the main loop. Or did you attach the wrong file again?

0 Kudos
Message 8 of 21
(3,596 Views)
Actually my vi works. The reason why you probably thought it's not working because i messed it up with the daq sub vi. If I remove the while loop in the Sub vi, im afraid that it won't work properly.
0 Kudos
Message 9 of 21
(3,589 Views)

Your subVI will work fine when it is running stand alone because of the while loop.

 

If you put that as a subVI into another VI that is the main VI, then it won't work because the subVI's while loop will keep it running and never let you give back control to the main VI since you won't be able to press the stop button that is in the subVI.

 

That is what you've been asking for, isn't it?

 

Have you taken the tutorials on LabVIEW yet?

0 Kudos
Message 10 of 21
(3,586 Views)