cancel
Showing results for 
Search instead for 
Did you mean: 

I have a problem about SubVi Run

adavb
Member

I have a problem about SubVi Run

When you click Hardware Button (red area ) in Main.vi,

SubVi is running. But SubVi doesn't work. Why?

 

I upload this picture!

 

plz help me

11 REPLIES 11
adavb
Member

RE: I have a problem about SubVi Run

Message contains an attachment

Sorry, I upload pictures

Bob_Schor
Knight of NI

Re: I have a problem about SubVi Run

The pictures are absolutely no help to me.  Attach your VI.

 

Bob Schor

adavb
Member

Re: I have a problem about SubVi Run

Message contains an attachment

I'm sorry. I can't show you this because it's company work.
I think if you press the button on the main.vi,

the subvi will be in infinite loop.

So I can't do anything about both Mainvi and Subvi.

Can you tell by watching Subvi only?

RavensFan
Knight of NI

Re: I have a problem about SubVi Run

We can't watch anything because there is nothing to watch.  Just some pictures that barely show sections of code.

 

If you can't attach the actual VI's, create some simple VI's that show your basic concept.  In the process of doing that, you may even figure out on your own what is going on.

 

The fact you say the subVI is in an infinite loop worries me.

adavb
Member

Re: I have a problem about SubVi Run

Message contains an attachment

aa.PNG and aaaaa.PNG are Main.vi 

 

Thank you your help

RavensFan
Knight of NI

Re: I have a problem about SubVi Run

Message contains a hyperlink

.png's aren't VI's.  They are pictures.

 

Your workTargetSelect.vi is a VI.  But it is only 1 VI.  It doesn't have any subVI's in it.

 

In that VI, use block diagram cleanup.  It is hard to tell which way wires are runnign.

Also, Index Array is resizable.  You can stretch the bottom border downwards to get multiple inputs.  Instead of dozens of Index Arrays, you might be able to use just one or two.

Also, Those Concatenate strings are rather complicated.  If you used Format Into String, you could put all those string constants into the Format String and only need the dozen wires or so for the data.  You won't have to wire up all those quotes and labels like ""Tag No. ="

 

So if the VI you attached is actually the subVI, since you have 2 infinite while loops in there, how will that subVI ever end so that it allows execution to go back to the main VI? 

 

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

 

Why does the upper while loop run infinitely fast waiting for the search button to be pressed?  Why is it in a loop?  None of the inputs ever change.  Shouldn't it just run once when the subVI starts?

 

What do you do with the outputs of this VI besides writing them to a text file?

 

It seems this VI should be just 1 or even no while loops.  And it if is a while loop, you should have a "Close" button on it so that it will end the loop and return control back to the main VI.

adavb
Member

Re: I have a problem about SubVi Run

I haven't made a Close yet.Don't you have to use infinite loop because you don't know when the search button is pressed?

I want to run by clicking the button on main.vi. and i thought Subvi = workTargetselect.vi I'm sorry if I made you misunderstand, I'm still immature in the labview.

adavb
Member

Re: I have a problem about SubVi Run

Message contains an attachment

and Nothing works in this situation.

RavensFan
Knight of NI

Re: I have a problem about SubVi Run

 


@adavb wrote:

I haven't made a Close yet.Don't you have to use infinite loop because you don't know when the search button is pressed?

I want to run by clicking the button on main.vi. and i thought Subvi = workTargetselect.vi I'm sorry if I made you misunderstand, I'm still immature in the labview.


Put the search button in the event structure.

 

Why do you need a search button at all?  Why wouldn't it just do the search as soon as the subVI starts?

 


@adavb wrote:

and Nothing works in this situation.


What situation?

 

Please take the tutorials.

Then when you are ready to start coding your project, but before you actually start coding it, sit down with a pencil and paper and draw out a flowchart of how you want to your program to work.