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: 

HELP!!! I have struggled for way too long.

Solved!
Go to solution

I have created my main VI and everything is working. I now want to make the terminal connections on this VI so it can be used in other VIs. I want to create a test VI that would basically let me test that all the terminals are working as expected. To that end, I started that process by configuring 2 terminals. The strange thing that happens is the name assigned to the terminal by LV is not the label, but the caption. I am using both of them.

 

I then create a new VI and add the main VI to the block panel and add 2 controls to the new VI front panel wiring them to the main VI as I did so. . I then run the VI. No errors occur. But nothing happens either, except that the main VI is running. I double-click on the icon and make changes to the controls on the main VI front panel and that still works. Whenever I change a control on the new VI, it never propagates to the main VI. I even stuck a probe on both wires in the new VI, but they just say "Not executed". Then I figure I need an event structure for the controls, so I add that to the new VI, encapsulating everything in a while loop. That causes the main VI to never run when the new VI starts. So I went back to the original state, but still nothing.

 

I suspect there is some detail or setting that I just don't know about that is causing my pain. Since I did create several VIs that provided calls to a dll in the main VI, I thought I knew how to create and use VIs, but apparently not. It would seem to me that I have everything constructed correctly or I would be getting errors, but since I am not getting any data transferred to the main VI, I think it might have something to do with why LV choose the caption and not the label when I created the terminal. I know that everything is based on the label name because I discovered that you cannot change the label while the VI is running.

 

So if you can help me get this working I would be very grateful. Thanks.

0 Kudos
Message 1 of 17
(2,693 Views)

That's a lot of paragraphs, but it is hard to follow since you didn't attach your VI's that are giving you a problem for us to look at.

 

I've never of terminals getting the name of the caption rather than the labels.  Though playing with it in LV 2018 I do see what you describe.  I don't know if it is a bug, a new feature, or something that always happened but I never noticed.  I don't use captions much.  And when I do, it is for a top level VI that the user sees and wouldn't need terminals.  SubVI's that need terminals, the user very rarely sees and wouldn't need captions.

 

As for your description about the data flow, my guess is that you are not understanding some LabVIEW dataflow concepts.  Do you have a while loop in your subVI that keeps it running?  A subVI doesn't return any data to the main VI through the terminals until ALL of the code inside the subVI is done executing.

 

Attach VI's for better advice!

0 Kudos
Message 2 of 17
(2,688 Views)

Can you actually post your main VI?

 

Having the actual VI is 10 times better than a picture of the block diagram, which is 10 times better than a verbal description of the VI with the problem.

0 Kudos
Message 3 of 17
(2,686 Views)

Are all the VI properties near the default or did you mess around randomly?? (For example if you set the priority property of your "main VI" to "subroutine" priority, you would not see much.)

 

(QUOTE from the help: " In addition to not sharing time with other VIs, subroutine VI execution is streamlined so that front panel controls and indicators are not updated when the subroutine is called. A subroutine VI front panel reveals nothing about its execution.")

 

Does the subVI only have controls or also indicators (output terminals)?

 

(So the VI called Main VI is actually the subVI here. Why do you use such confusing terminology??? 🐵

0 Kudos
Message 4 of 17
(2,678 Views)

@kerplatz wrote:

But nothing happens either, except that the main VI is running. 


What do you expect to happen?

 

The output of the VI in the caller will not update until the main VI (now a SubVI) stops running (by finishing, not by aborting it). That is what dataflow is.

 

If you expect the main VI to show, you need to turn that on.

0 Kudos
Message 5 of 17
(2,627 Views)

To clarify, I wrote all those paragraphs because I do not want to give out the VI's for the project as there are many. I decided that my problem could be described instead. The one thing I forgot to give was the version of LV I am using, which is LV2018.

 

The label vs caption issue is not ideal for me, but I will just go back to using a text box instead as the only thing I used the caption for was to give the controls and indicators units. Looks weird, but will work. You see, I am doing something different with the main VI. It has to behave as a stand alone or a subVI depending upon how the customer will use our device that the main VI connects to.

 

The main VI I created is controlling a device that behaves like an instrument, i.e. a spectrum analyzer. The idea was to give the customer a VI that they would become a VI that directly controls our device when used as a front panel, or a subVI that could be dropped into a cluster of other VI's so the customer could control our device in an automated process.

 

My response to the data flow concept is that I did not know that is the behavior and yes I do have the whole mainVI running in a while loop. I am still a newbie to LV, but I have been programming in LabWindows for about 2 years. I have a degree in Software Engineering, so I do get a lot of the concepts being used in LV, but this is very different than how I am used to programming using code. Just like everything else in life, I can learn.

 

Thanks for the answers and it looks like others have given similar advice. Sorry about the length of the reply, if it is also too long. Just trying to be thorough.

0 Kudos
Message 6 of 17
(2,607 Views)

No I did not change the priority property of the VI.

 

No, it does not only have controls or indicators..

 

To clarify, the main VI has to behave as a front panel, which it does, and a sub VI if the customer who uses the VI to control our device in an automated process that contains many other VIs that would send control signals to this VI. I tried to be concise and not confusing, but I did not convey to you how this main VI was supposed to behave in my original post. I am getting the idea that this might not be possible. So my replies to other posts.

 

When writing code, I try to be as efficient as possible. Using the same exact thing for different purposes, but only having one copy or instance of it seems like the thing to do. I do not want to maintain 2 copies of the main VI that do the same exact thing, yet one has defined terminals and one does not based upon the way the VI is used.

 

0 Kudos
Message 7 of 17
(2,601 Views)

It would appear that I need to learn what dataflow is in context of a VI. My concept of a terminal was like passing in parameters of a function in languages like C and Java. I don't understand why the main VI that is now acting like a sub VI has to finish (keep running).

 

So I thought about what I just said, and I think I get it now. Since the main VI is essentially a while one loop, its execution never stops and nothing gets a chance to be passed in, but if it behaves like a function then it needs to terminate (finish) so it can be called again when new data needs to be passed in.

 

It occurs to me that what I really want is for the main VI to act like a thread. Is that possible? I do have some things to look into. Thanks.

0 Kudos
Message 8 of 17
(2,597 Views)

@Kyle97330 wrote:

Can you actually post your main VI?

 

Having the actual VI is 10 times better than a picture of the block diagram, which is 10 times better than a verbal description of the VI with the problem.


NoNoNo... it's "A picture is worth a thousand words, but a VI is worth a thousand pictures."  😄

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 17
(2,591 Views)

You still talk way too much gibberish that does not make any sense. What you are trying to do should just plain work. Period.

 

If it does not, we need to understand exactly what you are doing, but we cannot, because you don't show the code for some reason. Can't you reduce it to a trivially simple set of two VIs that show exactly how you are using things. (e.g. a subVI to add two numbers, for example).

 

If the subVI has a while loop and does not return by itself, it only gets the values wire to it when it is called first, but there are plenty of simple mechanism to communicate between two running VIs. You can even launch it asynchronously so the caller does not need to wait  for the callee to complete.

0 Kudos
Message 10 of 17
(2,588 Views)