キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Labview SubVI

Hi Folks,

I need a help from you regarding SubVi.

I have a subvi in which two boolen inputs , two ouputs(one boolean and one string value)


Now i wanna start using one of the inputs and it goes in to a  while  loop infinitly. I have to stop the loop and exit from the subvi by using the other input .

Displayin the two outputs ....Bool and string

 

Can someone help me?

Boldness has genius, power and magic in it!'
0 件の賞賛
メッセージ1/10
4,217件の閲覧回数

Care to share you VI?  How do you plan on stopping the loop?



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 件の賞賛
メッセージ2/10
4,208件の閲覧回数

this is my subVI . I wanna use it  in my  final VI .

 

Boldness has genius, power and magic in it!'
0 件の賞賛
メッセージ3/10
4,200件の閲覧回数

None of this code makes sense to me.  What are you trying to do with this subVI?



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 件の賞賛
メッセージ4/10
4,187件の閲覧回数

You can only provide the inputs to the subVI at the time you call it, therefore if you call your subVI and it enters an infinitely running while loop then you cannot stop it from the calling VI. If this subVI needs to be stopped at some stage then make the condition for stopping the while loop settable from within the subVI itself.

 

If your while loop is meant to repeat a task until a particular output is achieved, ensure a pass state causes the while loop to exit. Do not wire one of the subVI inputs to the while loop conditional terminal because once set by the calling VI this input cannot be changed (sensibly).

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 件の賞賛
メッセージ5/10
4,184件の閲覧回数

Hi Guys thanks a lot.

My Aim is to give the user to deicide whether the photodiode works fine .

There will be a block in front of it and so till that time the program is running continously.

Later it is stopped when he decides it ok or not .

 

I think i am clear in my explaination,.

Boldness has genius, power and magic in it!'
0 件の賞賛
メッセージ6/10
4,139件の閲覧回数

Hi MaveenD,

 

I think it would be easy for people to help you if you post your main vi and sub vi. Looking into it, the experts in the forum will definetly able to suggest some approach(if any) that can help you to meet your requirement.

______________________________________________
Kudos are welcome
0 件の賞賛
メッセージ7/10
4,131件の閲覧回数

Hi MaveenD,

do you know to use Variables? That could help you with stopping a While Loop from outside or from another VI.

 

More information about Variables:

 

Tutorial: Local Variable, Global Variable, and Race Conditions

http://www.ni.com/white-paper/7585/en

 

Best Regards,

 

Martin

 

0 件の賞賛
メッセージ8/10
4,091件の閲覧回数

This design doesn't require a sub-vi, just a while loop in your main vi inside a case structure.  Pressing a start button enters the while loop, the stop condition is wired to a Stop button on the front panel for the user.

 

As others have stated, the problem with trying to do this in a subvi is that the inputs are only evaluated at the time the subvi is called (your main code will not do anything until the subvi has finished running so a stop button on the main vi will do nothing and you subvi will NEVER stop).

 

To truly achieve this, you would have to run the two vi in parallel, opening the second one using VI reference and invoke node to run.  The data would be passed between the two using either a global variable or a functional global variable.  The problem with this, is that the user could still tell the main VI to run code which could interfere with the second vi, unless you programatically disable certain controls in this situation.

 

All in all, your desired function for this code sounds simple enough that it should just be inside your main vi.  

0 件の賞賛
メッセージ9/10
4,086件の閲覧回数

Why is everyone suggesting using global variables. There are much better and preferred methods for passing data. I would recommend using queues, notifiers or user events to pass data between VIs.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 件の賞賛
メッセージ10/10
4,064件の閲覧回数