LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem running a sub vi

Hi everybody!

I've got one big question, i created this vi which simulate an R-S flip flop with priority to set. Since i wanted to use it as a sub vi, i wired the A button(which is my set terminal), B button(which is my reset terminal) and the stop button as input terminals and the boolean indicator as my output terminal.When i tried to placed it in another vi(as a sub vi) and wire input controls i've got nothing as output....it seems that the sub vi is not running ......any suggestions will be appreciated!
0 Kudos
Message 1 of 9
(4,092 Views)

Your subVI is running.  You just have no way to stop it!

 

When the VI starts, it takes the inputs going into it.  A, B, and Stop which is probably unpressed and False when the main VI starts.  So the subVI has a false on its stop terminal.  There is no way to stop the subVI.  You basically want to take the loop out of the subVI.  Even if you press the Stop button on your main VI, it doesn't get read again until the subVI stops, the code in that iteration of the loop in the Main VI completes, and the loop in the Main VI starts again.

 

You will need to learn how dataflow works in LabVIEW.  It seems like you are a new user, so I would recommend looking at the online LabVIEW tutorials, first.
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

Message Edited by Ravens Fan on 09-08-2008 05:24 PM
Message 2 of 9
(4,080 Views)

Of course, you could use a control reference for the Stop button.

 

With respect to the code, can you think of a better way to implement this code that you put in:

 

 

Think about it for a second. Smiley Wink 

Message Edited by smercurio_fc on 09-08-2008 05:34 PM
Message 3 of 9
(4,061 Views)
Smercurio_fc.....any ideas?
0 Kudos
Message 5 of 9
(4,013 Views)

the only problem is that you have place a  while loop in the sub vi,

try remoe the subvi and run again

0 Kudos
Message 6 of 9
(4,001 Views)

sorry should wrote , try removing while loop from the subvi

 

and this is not the only problem but it is a start... 

0 Kudos
Message 7 of 9
(3,998 Views)

Hello riot,

if you start your subVI with stop=false, your subVI is in an endless loop, which can't be stopped from your main VI.

 

How many times do you want to calculate your new flip-flop output value? I think 1 time is enough. Wire a TRUE constant to the conditional terminal, so your sub VI will execute only once and gives control back to your main VI.

 

BTW, use a Wait (ms) in your main loop to reduce CPU time.

 

Hope this helps.

Uli

0 Kudos
Message 8 of 9
(3,991 Views)

Smercurio wrote:

 

With respect to the code, can you think of a better way to implement this code that you put in:


 

How 'bout this.......Smiley Wink

 

Message Edited by BCL@Servodan on 09-09-2008 06:57 AM
Don't forget to rate a good Answer....
---------------------------------------------------------
Here should be some cool signature

But there's NOT

LabVIEW 2012-2017
---------------------------------------------------------
Message 9 of 9
(3,975 Views)