LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I show a sub vi whenever a boolean value changes

Sorry, disregard the sample before, the real sample with the vi is below
0 Kudos
Message 21 of 35
(1,220 Views)
0 Kudos
Message 22 of 35
(1,221 Views)
You don't have an event structure in this vi either.  Do you know what an event structure is?  Actually, you don't need one, although you could use one if you wanted to.  See the attached picture for an example of what an event structure looks like.  Also, you can put your subvi that you want to call right inside your case statement where you set the boolean to true, as shown in the attached picture.
- tbob

Inventor of the WORM Global
0 Kudos
Message 23 of 35
(1,212 Views)
sorry those last attachments wasn't my updated program, below is the updated program
0 Kudos
Message 24 of 35
(1,203 Views)
Hey buddy,

Below I have modified your "sample.vi" to suffice what you require. I guess this is what you were asking for ?? or atleast the idea should get clear !! Plzz let me know if you are looking for something more than this too...!!!
      I have even modified your "sub vi" to serve the purpose you described......:manhappy:

0 Kudos
Message 25 of 35
(1,195 Views)
I tried the modifications that you gave, but I want to sub vi to open whenever the input changes from torque to position.  Right now the way you have it, the sub vi pops up whenever it uses Torque
0 Kudos
Message 26 of 35
(1,192 Views)
Hey buddy,

I have done a few modifications to ur original vi to suit your purpose. Hope it helps !! Also I have made your sub vi properly working to ur needs. Let me know if u were lookin for the same or no...coz this is all what I could understand from ur query...???
0 Kudos
Message 27 of 35
(1,193 Views)
thanks for all of your help.  I took the event structure out and used a shift register instead and connect the old indicator and the new indicator value to an equal function and connected that to a case structure. 
0 Kudos
Message 28 of 35
(1,187 Views)
ok, I have one more question......Also in my program I have a while loop and a for loop.  (The for loop is not in the while loop)  Whenever the sub vi pops up the while loop waits for the sub vi to execute.  Is there a way that whenever the sub vi executes the for loop waits for its execution too before preceeding to the next step?
0 Kudos
Message 29 of 35
(1,184 Views)
Hello,
 
So you have a for loop that you'd like to suspend execution in right?  You could use a while loop instead, with a case structure in it with only two cases; use a boolean input to the case selector.  The idea is that one case will be whatever your current for loop code contains (let's call it the "usual" case, and the other case will be your "suspend" case.  Then when you want to "suspend" the loop, you can just change the state of the boolean wired to the case selector programatically, and the for loop will finish executing it's current iteration, and then begin executing the suspend case.  You can change the boolean back whenever you like to start executing your usual case again.  Now, there are a couple things to take note of here.  First, since you originally had a for loop, I presume you only want to execute your usual case a predetermined number of times.  Thus, in your usual case you should keep a "counting" value that increments anytime the usual case executes.  Then you can use that "counting" value to stop your while loop after you have executed your usual case the predetermined number of times.  As a final consideration, you may want to put a wait statement (wait or wait until next ms multiple) in the suspend case, otherwise your while loop will be executing that case (during suspension) as quickly as possible.  Even putting a 0 ms wait will kindly allow a thread swap.
 
Ok, I hope this helps!
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 30 of 35
(1,175 Views)