05-15-2012 09:15 AM
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?
05-15-2012 09:29 AM
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
05-15-2012 09:34 AM
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
05-15-2012 09:37 AM
When you call the subVI, does the front panel actually open so that the user can press the stop button?
05-15-2012 09:41 AM
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?
05-15-2012 10:45 AM
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.
05-15-2012 11:00 AM
05-15-2012 11:46 AM - edited 05-15-2012 11:49 AM
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?
05-15-2012 12:24 PM
05-15-2012 12:31 PM
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?