Skipping a step in while loop when boolean is switched

Hey guys,
I have a program that controls a ventilator which pumps in gas at a certain rate. This whole process is executed in a while loop. When we switch gases by a toggle that's on the front panel, we'd like to skip one ventilating cycle immediately and then goes back to pumping gases at the previous rate, but we don't know how to realize this. Can you guys give any advices? Thank you!
Sincerely,
Le Z.
Solved!
Go to Solution.

Make sure the mechanical action for the HP button is set to Latch When Released.  The button will automatcially reset when the terminal is read that way.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

Similar Messages

  • I have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    i have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    Hi fais,
    Following through with what JB suggested. The steps involved in replacing the inner for loop with a while loop are outlined below.
    You can replace the inner for loop with a while by doing the following.
    1) Right-click of the for loop and select "Repalce" then navigate to the "while loop".
    2) Make sure the tunnels you where indexing on with the for loop are still indexing.
    3) Drop an "array size" node on your diagram. Wire the array that determines the number of iterations your for loop executes into this "array size".
    4) Wire the output of the array size into the new while loop.
    5) Set the condition terminal to "stop if true".
    6)Drop an "OR" gate inside the while loop and wire its output to the while loops condition terminal.
    7) C
    reate a local of the boolean "stop" button, and wire it into one of the inputs of your OR gate. This will allow you to stop the inner loop.
    8) Drop a "less than" node inside the inner while loop.
    9) Wire your iteration count into the bottom input of the "less than".
    10) Wire the count (see step 4 above) into the top input of the less than. This will stop the inner loop when ever the inner loop has processed the last element of your array.
    Provided I have not mixed up my tops and bottoms this should accomplish the replacement.
    I will let others explain how to takle this task using the "case solution".
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to stop a while loop when using tab control

    How do you use a tab contol to stop what is happening on one tab when you switch to another tab?  In the test example I attached, I have a while loop nested inside a case structure controlled by the tab control.  When I tab to page two the elapsed timer starts but when I switch to another tab it does not stop.  I can't come up with an easy way to stop or exit the while loop when I change tabs. 
    Thank you
    Danny
    Attachments:
    tab control.vi ‏24 KB

    I played with it a little more and came up with this fix.  This fixes it but is not tied to the changing tabs as I was looking for.  Is this just too many nested loops and a bad idea?
    Danny
    Attachments:
    tab control fix maybe.vi ‏26 KB

  • How to stop while loop when a specified function is terminated?

    I want to make a program which has 2 thread, one of which is to control some devices, and the other is to measure outputs of the devices.
    To do that, I should make a 2 independent loops, but there comes a problem here.
    I want to terminate 2 loops at the same time, but it's difficult for me to do that, because when I try to notify upper sequence's termination to lower loop by some value change, they have some dependency.
    That's why I need your help. I want to know how to stop lower loop when the upper sequence's termination keeping their independency.
    Please let me know. Thank you.
    Attachments:
    help.JPG ‏200 KB

    Is the upper loop commanding the lower loop at all?  I would think you would have some type of communication between the loops.  Just use that communication to send a stop command.  Or the next best way is to just simply use a notifier.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • I am using the "Menu Selection With Events.vi" example alongside other while loops, When I select exit from the new menu it stops the other while loops but not the menu/event while loop

    The event driven menu example works fine and I've integrated it into my application. I have built in simple local vars to link menu selections to existing GUI buttons. The problem is that I cannot get the File-Exit menu option to switch off/terminate the application. The [1] "Stop": Value Change panel of the event structure simply switches off the other while loops but leaves the event while loop running. Add a while loop to the axample using a local var from the event while loop to terminate 2nd while loop to get the effect.
    Help appreciated, Chris

    Attached you will find a modified version of your VI.
    I documented what I did on the block diagram.You were right on you just needed to add a variable with a true wired to it.
    Have fun with it.
    Joe
    Joe.
    "NOTHING IS EVER EASY"
    Attachments:
    Menu_Selection_with_Events_%26_while_loop[1].vi ‏76 KB

  • How to stop a second while loop when the condition in the first one is met for different VIs

    Hi, am running two seperate Vi's. am new to labview so please help accordingly.
    I have introduced a comparison test  in one Vi through ashift register. i would like now the second Vi to stop when this comparison condition in the first Vi is met. 
    I dont want the first Vi to stop, it should only stop the second Vi while awaiting for the next input.
    waiting for your help guys

    Thanks so much guys. am now starting to pick some ideas. i have attached the Vis as requested for best identification of the help.
    waiting help guys
    best regards
    Alex
    Attachments:
    first Vi.vi ‏132 KB
    second vi.vi ‏149 KB

  • Re: exit from a while loop in sub vi

    I think the mail didn`t get through first time. Repeat posting - Sorry if
    this occurs twice
    Shane
    Hallo,
    Can the use of occurrences solve this problem?
    The Main program can create an occurrence which can be passed to the
    sub-VIs. Upon pressing the button to cancel the loop, the occurrence can be
    set, instantly transmitted to all other VIs sharing which were passed the
    same occurrence. Of course a small handling routine has to be written (say
    a sequence parallel to the executing while loop waiting for the occurrence
    and then setting the exit parameter to "true") but this is trivial.
    I have checked this with a small program splitting an occurrence to three
    seperate VIs and it works.
    If you want, I can send a cop
    y of it.
    It may well be possible with notifiers or something else, but I have far
    less experience with them.
    Hope this helps
    Shane
    >pcu schrieb in Nachricht
    ><[email protected]>...
    >>Main vi has several sub-vi's. Each sub vi has a while loop and Boolean
    >>button. When program runs, sub-vi front panel appears, and I can
    >>stop/continue the while loop. But when I stopped a while loop in a
    >>sub-vi, I cannot control other while loops in other sub vi.
    >>I need exit function from a while loop, not stop function of entire
    >>program.
    >>Thanks.
    >
    >
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

    The notifier is probably better than occurence at this case - than it is not neccessry to write a parallel sequence.
    The use of notifier is very simple, just follow an example in Help/Search example -> Advances -> Execution control -- Synchronization -> SubVI notification.
    Good luck
    Ferda

  • Exit from a while loop in sub vi

    Main vi has several sub-vi's. Each sub vi has a while loop and Boolean button. When program runs, sub-vi front panel appears, and I can stop/continue the while loop. But when I stopped a while loop in a sub-vi, I cannot control other while loops in other sub vi.
    I need exit function from a while loop, not stop function of entire program.
    Thanks.

    Hallo,
    Can the use of occurrences solve this problem?
    The Main program can create an occurrence which can be passed to the
    sub-VIs. Upon pressing the button to cancel the loop, the occurrence can be
    set, instantly transmitted to all other VIs sharing which were passed the
    same occurrence. Of course a small handling routine has to be written (say
    a sequence parallel to the executing while loop waiting for the occurrence
    and then setting the exit parameter to "true") but this is trivial.
    I have checked this with a small program splitting an occurrence to three
    seperate VIs and it works.
    If you want, I can send a copy of it.
    It may well be possible with notifiers or something else, but I have far
    less experience with them.
    Hope this helps
    Shane
    pcu schrieb in Nachr
    icht
    <[email protected]>...
    >Main vi has several sub-vi's. Each sub vi has a while loop and Boolean
    >button. When program runs, sub-vi front panel appears, and I can
    >stop/continue the while loop. But when I stopped a while loop in a
    >sub-vi, I cannot control other while loops in other sub vi.
    >I need exit function from a while loop, not stop function of entire
    >program.
    >Thanks.
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

  • Getting data from a while loop while running.

    Hello,
    I did a program that call a sub-VI which is doing experiment and have its own timer.
    The sub-VI is a while loop and the stop condition of this loop is the elapsed time of my timer.
    What I want to do is to be able to get the elapsed time in my main program during the execution of the sub-VI (every second of its execution).
    First I assign the elapsed time in the sub-VI as an output of it. But of course the elapsed time is only updated in the main VI only when the while loop has finished. So I tried several solution: property nodes, local variable, global variable.
    When I am using global variable, I can see the elapsed time being updated during the while loop when I open the global variable VI. But the result is always the same: in the main VI the elapsed time is only updated at the end of the while loop.
    I think that is the global variable is updated every time, I could be able to get its data to my main VI?
    Does anyone have an idea?
    Thank you,
    Meach

    I tried using shared variable and reference without succes.
    I will keep searching.
    I enclose my VI that I simplify the most but with still keeping the shape of my real program. If you can take a look I will really appreciate.
    The goal is on the top-level VI to be able to see the updating data time in real time.
    Thanks,
    Meach
    Message Edited by Meach on 07-23-2008 04:13 PM
    Message Edited by Meach on 07-23-2008 04:14 PM
    Attachments:
    Elapsed Time.zip ‏25 KB

  • Delay to start a "while loop"

    Yes I would like to run a while loop only after I switch on a start button. For some reason the loop does not start. I put the while loop in a Case structure which I want to make true with the start switch.

    Hi,
    ALT 1: If the button is false, the case does nothing, and the program is
    finished. So, you'll have to put the entire program in another while loop
    (that quits whenthe program is done), or use the run continuously button to
    start the program.
    ALT 2: Make a while loop before the while loop that you have. Wire the
    button to the stop criterium, and change the stop criterium to "stop when
    true". Wire anything (e.g. the button wire) to the second while loop, just
    to synchronise the execution.
    Put a "wait ms", with e.g. 50 ms, in the while loops, or your program will
    use up 100% processor time. This is not nesseccary if the while loop only
    runs for a short (<200 ms) period.
    Regards,
    Wiebe.
    "JShaw" wrote in message
    news:5065000000080000003C80000
    [email protected]..
    > Yes I would like to run a while loop only after I switch on a start
    > button. For some reason the loop does not start. I put the while loop
    > in a Case structure which I want to make true with the start switch.

  • Timing in parallel while loops

    Hi,
    I'm having some issues with timing of while loops when two loops execute in parallel.
    I have one loop which writes to a GPIB device every x ms to produce a regular signal, and another that reads from another device continuously (no delay time) to produce a trigger when it recieves a specific output.
    Both of these loops work fine alone, but together they screw up the timing. I can't simply add a delay to the second loop, since the trigger signal must be read and executed straight away, even 1ms delay might cause me to miss the effect I'm looking for...
    Thanks for any help!

    Did you even try Lynn's suggestion of placing a "0ms" wait in the fast loop? Did it work? The problem you are seeing is due to the fact that a loop without any wait will hog the CPU for many iterations, thus potentially stalling the other loop for extended times (see also).
    Depending on your hardware, the two loops can also run on mutliple cores.
    How are you detecting the signal in the fast loop. Can you show us some code?
    I also agree that you need LabVIEW RT or FPGA to implement this in a robust way. Do you need to react to the trigger in a predictable way or do you simply need to ensure that it is not missed?
    LabVIEW Champion . Do more with less code and in less time .

  • Notifier not received when other code in while loop exists

    I am attempting to improve my logging code to be separate from the main UI/logic.
    I was hoping to implement a 'Send Notification' upon my trigger, to start logging in a separate while loop.
    To test this, I tried the following. When my trigger goes True, a notification is sent and my 'Notification received' boolean goes True.
    When I wire anything to the while loop, this no longer works:
    Can someone tell me why? I was hoping to put my logging logic into this while loop to grab data from the waveform wire (brown) to log my data.
    Thanks!

    belopsky wrote:
    How do I have the waveform be sent for as long as I need it to be, in order to log?
    You just make a queue of type Waveform (or if multiple channels use Array of Waveforms).  You read from the DAQ and then just write into the queue.  The logger loop will then just read data from the queue as it comes in and log it.
    Just look into the Producer/Consumer if you need any more help on this.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • While loop stuck in LabVIEW when VI called by TestStand only

    LabVIEW 8.5, TestStand 4.0, Windows XP-SP3
    The issue I’m facing is a different behavior of a LabVIEW VI whether it is called independently (in the LabVIEW environment: normal behavior) or from TestStand (unexpected behavior).
    In the same VI, I've wired in parallel, so they can execute in parallel:
    a call through “System Exec”, to a program which prompts for a user's answer. The case I’m concerned is when the answer will never come...
    a while loop, managing a timeout which finally kills the program above when it waits infinitely for a user's answer
    Just to be more precise for those who’d try reproducing the issue (but you might just have a look at the enclosed VI): in my case the program is the command line WinSCP.com. WinSCP prompts when it wants you to accept the host’s private key which is not in its cache. Don’t be afraid if you’re not used to WinSCP, the concern here is LabVIEW + TestStand.
    What happens when we’re stuck in the “System Exec”:
    under LabVIEW: it works fine, as expected; while stuck in the “System Exec”, the while loop executes in parallel
    when the same VI is called in a TestStand sequence step (ActiveX automation server to the LVdevelopment system), it does not run the while loop (we're stuck in both System Exec and inside the loop). The only way to release everything is to manually kill the program called by the System Exec through Windows Task Manager.
    For information, all tasks: TestStand (SeqEdit), LabVIEW and program (WinSCP) show 0% CPU and their memory usage is stable.
    Have you an explanation for this unexpected / different behavior of the VI, only because it is called from TestStand?
    Enclosed is the VI.
    If you actually want running it, you might have WinSCP installed and a valid session to an accessible host (adapt path to WinSCP and session name), and do not put the host key in the cache!
    Note: you won't see the same issue with other programs or commands called by System Exec (e.g. netsh, ftp...) even if they await a user's prompt.
    Thanks for your help!
    Solved!
    Go to Solution.
    Attachments:
    CheckLabVIEWLock.vi ‏26 KB

    Have you tried changing the Preferred Execution System of the VI from 'same as caller' to 'other1'.
    Regards
    Ray Farmer

  • Sharing booleans across while loops

    I am new to Labview and I am attempting to use an angular encoder as a type of switch.
    I want to take continuous measurements of the encoder angle and turn on an analog output signal whenever a certain angle is reached. When the encoder drops below that angle, I need the signal to be turned off. 
    To do this I am attempting to run two parallel while loops. One measures the angle of the encoder while the second creates the output signal. What I want to do is put a logical statement in the measuring loop that will register 'true' if the maximum angle is reached. I am attempting to pass this 'true' statement to the signal generation loop as a kind of trigger to turn on (using an case structure and 'DAQmx Start Task.vi') the output. The issue I am having is that the 'true' statement can't leave the measuring loop until the loop is complete. But since I am running this continuously, the loop never ends. Thanks.
    Solved!
    Go to Solution.

    Create a local variable of the boolean in concern.  Right click on the local and select Change to Read.  Put this local inside the other loop.  So you have one loop that writes to the boolean and one loop that reads from the local.  Now you can remove the wire that comes from one loop and feeds the other.  Then your loops will run in parallel (if there are no other data dependencies between the two loops).
    As alternatives to local variables, you can use a queue to pass data from one loop to another.  One loop (the producer) will write to the queue.  The other loop (the consumer) will read from the queue.  See examples on Producer-Consumer architecture for more info.
    - tbob
    Inventor of the WORM Global

  • How to use one single boolean button to control a multiple while loops?

    I've posted the attached file and you will see that it doesn't let me use local variable for stop button, but I need to stop all the action whenever I want but more than one single button on the front panel would look ugly... The file represents the Numeric Mode of
    HP 5371A. thanks for your time
    Attachments:
    NUMERIC.vi ‏580 KB

    In order to use a local variable, you can change the mechanical action of stop button (Switch When Pressed will work), or create a property node for it and select values. You'll also have to do a lot of work changing those for loops into while loops so that you can abort them.

Maybe you are looking for

  • Strange Firefox Display problem

    I don't understand why one of my pages isn't displaying properly in Firefox. You'll notice that the main photo window is cut off. It's fine in all other browsers. I'm stumped - any thoughts would be greatly appreciated! http://thewoodshopmalvern.com/

  • Dump error in mb1a(SAPSQL_ARRAY_INSERT_DUPREC)

    Dear Friends,                        We got a dump error(SAPSQL_ARRAY_INSERT_DUPREC)                        when relesing particular material of the production order in mb1a. the detail error is as follows. ABAP runtime errors    SAPSQL_ARRAY_INSERT_

  • Help!!! ipod won't restore on itunes

    my ipod won't restore on itunes because it says this check your network connections are connected and your network connection is active or try again later. i have no idea what this means and i have tried again later and it hasn't worked. also if i ca

  • Some key features are missing in photoshop

    Hello I am very active on the UX side lately. I have been using photshop since the very first days, and above all i am a adobe fan, you guys do amazing stuff. However, some parts could be better in my oppinion, here is a list. please look into these

  • Have a t-mobile account. Can't connect to network in France.

    Nokia Lumia 820. Connected OK for 14 hr after crossing channel but unable to since. Sim works fine still in someone else's phone. Tried tweeting for help but no reply from EE after 16 hr. Phoned 150 on someone else's phone and waited 20 min before sp