Stop a while loop in a sub - VI in a message in queue manager

Hi all

I am trying to program a control for certain manufacturing equipment. For this I use a message in queue manager. Within the QMH, I have a VI that controls a particle size probe (called a PPC, at the bottom of the first image. When I start the main-vi, the PPC.vi is on the case "Parsum measurement", in which measurement data are repeatedly called in a while loop (screw for call data provided by the manufacturer of the probe. Also, I am aware that I don't connect the data again. That will come later.). When I want to stop the measure, I have send the message "Exit" to the PPC.vi (last photo). However, the vi is stuck in the while loop in the case of the measure and is unresponsive. I tried to send a notifier with a constant value true, but that did not work as well.

You have any suggestions, how can I stop the while loop before you send the message "Exit"? Or is the completely different way to approach this problem?

Thank you!

I just threw together a framework very fast to help you get started.  The thing I noticed is that the library of the queue doesn't have a time-out of the waiting message entry.  Since it is your own local copy (to the project), add a timeout and connect to the element Dequeue function.  I by default set to-1 and make it "recommended".

Tags: NI Software

Similar Questions

  • Code Golf: stop two while loops with guaranteed ratio iteration

    Proposal

    In the vein of the tradition of Perl, I would like to see if there is any interest to solve a few puzzles programming in LabVIEW. Can someone post a problem and define the rules to solve.

    Here's a question for beginning/intermediate to sharpen your "palette".

    Description

    With a user action, how you would stop two while loops such as the relationship between iterations is the still the same? Concrete to view this situation is to take action: both instruments use the same source of synchronization to take measures, but second divides the clock down so that it is a little slower than the first whole factor. For example, if the slower instrument is four times slower, then at the end of the VI, the slower instrument takes 100 measures the fastest instrument took 400.

    Rules

    • You can use vi.lib
    • You cannot include any other subVIs
    • Your solution should pass for loop1 interval as low as 25 ms

    Model (joint in LabVIEW 2009)

     

    If people are interested in this, then we will find a way to improve future problems. Please post your suggestions and criticisms, but only if you also post a presentation ;-)

    MacNorth wrote:

    [..]

    If we choose the first suggestions, the VI has yet to recover the data at different speeds. You can dedicate a loop for each instrument to disassociate a jitter and latency introduced by their connectivity or the inner workings. This adds a margin of safety when there is a conflict of thread and the pilot. You can also implement a simple counting as altenbach loop and renounce the multiloop complexity.
    [..]

    It is a very good point. But I wanted to make sure, you should / need to discuss the benefits, but also the disadvantages of the design. Implementation of an application is most often a process of 'special cases '. If a framework/design for a single application model does not necessarily correspond to another application.

    Designs are always strongly according to the requirements and constraints. What gives here designs will result in educational services, of course, but not necessarily as reference models for specific applications.

    Advantage of simple loop:

    • No synchronization between several loops required
    • Can easily implement any whole factor between services (quotent & function remains for a case structure

    Disadvantage of simple loop:

    • Take advantage of the multi core systems (at least not much)
    • Can easily run out of the time constraints (material not "not responding" enough, fast manipulation of data takes too long,...)
    • Code will accumulate within the structures of the case, where the readability could suff

    The advantage of multiple loops:

    • See essentially the disadvantages of single loop (several loops solve those)

    Disadvantage of multiple loops:

    • More complex, especially for the sync switch (not beginner friendly, requires a more/better design)
    • May contain easily questions source such as race conditions and locks

    A little side note:

    Even if the equipment works different acquisition rate, this does not necessarily that the software must use different rates for data extraction. You can use the same model of an hour, but get X times more values for the task faster than the slower running. The 'only' thing to care of are the sizes of buffers and bottlenecks in the data transfer.

    MacNorth wrote:

    [..] The best advice published OR shutter multiple while loops (https://www.google.com/search?q=labview+stop+multiple+while+loops) are laughable (and the 'solution' in my model). [..]

    No, it's not laughable. For many applications, this approach to shutter at the same time several loops running is OK. The constraint: only for simple parallel running loops.

    More complex loops (producer/consumer and similar) with the more complex data relationship ships require more valiant approaches such as queues, declaring events or user.

    My 5 cents only,

    Norbert

  • stop another WHILE loop

    I have two while loops running independently.

    The first has a Structure of the event that controls the STOP button for a user by clicking.

    The second series a bed to a port.

    When I get an error messages entering the serial port, I want to provoke the other WHILE loop stop.

    What is the best way to do it?

    Connect a case structure wire to the error and write to a signaling value property of the button stop in the case of error.

  • How to stop a while loop structure in the event of a main vi

    Hello;

    Sorry for my English

    I have to stop to a Subvi my main VI, the Subvi contains a while loop and an event structure, so I need to stop this loop while I tried directly from my main vi, global variable, but it did not work

    any help please or example!

    How about something like this (solution see attachment) using a user event.

    Explore the User Interface--> range of events and dialogue. To display the dynamic event of the terminals in the structure of the event just right click and select 'display the dynamic event posts '.

  • stop a while loop in slot - VI

    Hello

    I have a Subvi, which has a while loop and it is in my main vi in a sequence structure, I want to stop the loop inside the Subvi using a Boolean value in primary vi.

    I tried global variable, but it has not worked since the stop in my main vi botton is not updated when the program is running...

    could you please help me?

    I appreciate any ideas

    Thank you

    Darya

    As a general rule, avoid using Structures of the sequence.  The reason being that they are violating data streams.  If you can control the flow of data with threads, it is the most effective way to make your program work.  The idea to get rid of your sequence structures is therefore to make an another Subvi to your expectation that also has an error and output error.  Then, you can use the cluster of error to force execution.

    And while loops inside the subVIs is a common beginner problem.  If you do not order when the loop ends based on a front panel of the mainVI control, then the loop must be in the main VI.

    I hope it's a good summary of what was said.

  • Stop a while loop with outdoor table

    Hello

    I have a problem to stop the execution of a vi that uses a while loop and outside a table with two values of time intervals. I would like to stop the VI when the different values of the array are passed. I have attached here the code if you want to help me please, thank you in advance.


  • How to stop the While loop in the Structure of the event with the same button?

    Hello

    I have a problem. I want to use a single control to activate an event in a structure of the event and the same control to end a while loop in this case.

    It is possible to use 2 controls to do this, but I need to be alone.

    Thank you

    You should NEVER place while loops inside the case of the event, and it is never necessary to do. Think about it: all you have to do is spin the code. You can easily use the outside while loop for everything. Simply place the code of the loop internal (without the inner loop) inside the case of delay and manipulate the time-out period between a pending finished and the infinite (-1), depending on the State of the Boolean value.

    A very simple example (LV 8.0)

  • start stop multiple while loops

    I have a fairly large VI that works while several loops with the strutures case inside.

    I would like to be able to close and on all looped programmatically according to events. (complete cycle or cycle started)

    I need to store my data in a table, but whenever I turned off the while loop data I gathered is lost.

    It goes like this-measure analog voltage - put it in a digital indicator... now I want to put it in a table only once by my machine cycle.

    If the opeator push the reset button, the table is available for acquisition of report generation.

    Any help would be appreciated.

    Thank you

    It's here.

  • Problem stopping very simple messages in queue manager

    Hello

    I am trying to get my head around the managers of messages queued waiting. I wrote a super simple program just to send a message and pass some Boolean flags. The program works, but it will not be closed properly. Can someone explain how this should be stopped?

    Two while loops get them a real stop icon but the gray before panal stays without the lines on the graph.

    Thank you
    Ross


  • Delay loop before stopping the while loop

    Hi all

    I modified this code to the example in the forum. I forgot what thread. The file name is "control.vi of loop speed.

    I want to measure pressure and compare with the pressure of the target. Once the pressure reading is higher than the pressure of the target, I want the output high for 5 seconds and turn it down.

    When he goes back to the bass, I want the to exit the loop, or when I pressed the stop button. I don't know how to do it. Help, please.

    Thank you

    I can't view your VI (I use LV 2014). Please see my attachment for an example. See what happens when you make the numerical value > = 1. Enable execution of mark if she makes no sense.

  • or HOW the signal to timer front door stop in while loop?

    Good afternoon

    Could someone please help. I have a project that is very basic. It performs replication of the mastermind game in labview2009 VI. I have managed to do work, but as soon as all the conditions are true my last or door sends the signal for the moment stop button loop.

    In other words, there is no time for my 'congratulations chain' to show before the game resets. What I have to do is to put a timer between the final or gate and my stop button, but all the methods I've tried don't seem to work as the data types do not match.

    Please please please a little help

    Alex


  • Start stop while loop with tab control

    I want to be able to start and stop a while loop by entering and leaving a tab.  I use a structure of the event to do so, but it seems not elegant or the right way to do it.  The only way I could get to the kind of work is by unchecking the lock front panel in case of structure.  I have attached a sample vi of what I have so far.

    The problem is that you can't even stop the program by pressing the stop button until you exit the tab, which is not a user friendly interface.

    The event should just manage basic user events.  Any given event does not take a lot of time to run.  While you are in the diagnostics tab, your code is stuck in this while loop.  Although the setting of the front panel of the lock allows you to do other things, the LabVIEW is just put on hold all these other events of the UI (like Stop button value change) and cannot handle them inside while the loop stops and allows outside while loop to go through again.

    You should have a parallel while loop to manage waveform graph.  You can use notifiers or queues or a motor of action FGV (see Ben Action Engine Nugget) to switch the starting or stopping of the update of the chart of waveform until the parallel of while loop.

  • Stopping at two while loops, running with queuing

    Hi all

    I'm using labview 8.2.

    I have two while loops in my code (called the main loop and the other average loop - seen on the screenshot file).  I just want to stop both the while loop at the same time (it's ok it the average loop takes a bit longer).  I use global variables to stop (as I have tried the local one, but I don't think that LabView sees in the middle of the subroutine).

    Please give me some suggestions on this.

    Is attached a screenshot and my labview code

    Using a ' functional global' is almost identical with a "global" variable Indeed, before the existence of "global variables", a functional overall, it is how people have this feature.

    The usual way to stop a loop containing a "wait for queue ' is to destroy the queue and use the error on the terminal of the 'expectation of queue' directly in the terminal of the judgment. In this way, you don't have to queue up some kind of end the command to stop it.

    Add a queue to destroy after the stops 'main while loop. Delete the global variable and the error from the stop "waiting in the queue" in the loop "average" it is wire terminal.

    General advice, always try to avoid using local and global variables.

  • [begineer] reboot a 'while' loop reading the serial port

    Hello! I read some data from a COM port. I want to read my like this "%d S. the unit will send data continuously and depending on when I push the button run in labview, it can start to read data from the middle (%d is a four-digit number). as: 23 S 15'

    "whenever the first character of my data is not of", I need to restart playback. I read the data in a while loop. so I need to stop the while loop. From what I found on the internet, I used a case, another while loop and shift registers.

    but in some way I'm stuck inside the while loop. My VI is attached. Thanks in advance and sorry if my code is a mess!

    PS: what should I do if the bytes I get to the port is variable? use bytes to the port?

    The device sends a character at the end of the line at the end of each message?  You are currently Setup to do this by activating the stop character (currently set to end of line/10/0xA).  If this is true, then simply set the bytes to be read on the VISA to read something rediculously high.  It will stop playback when it finds this termination character.  From there, you just have to check for the correct format.  If this isn't the right format, ignore him.  Otherwise make your recording.

    I managed to clean up your code a bit on this basis.

  • HOW TO CREATE A STOP COMMAND IN LOOP FOR

    I have a problem. I can't put a stop to the VI attached here. I want to stop an iteration without support on cancel execution, because I want to connect this VI by a Subvi to control a motor continuous.

    Thank you

    Hello

    in order to stop your first vi, you can use a stop button for the while loop to 'or' with the release of your "equal" comparison function Then you can also use a local variable created the stop button to stop the loop for, configure it with a conditional expression (right click on the loop for > conditional expression).

    This way if you press "stop"button, you will stop the while loop and the loop together foor.

    Good bye

Maybe you are looking for

  • How can I configure out of office responses on OSX Server

    I tried to look, but he doesn't seem to be a way to do this outside of the creation of a rule on your local computer and leave it on (not a great solution). It's certainly a requirement of 'must have' for OS X server as well as the possibility to del

  • Can satellite A300d-16W - I use HARD drive recovery after installing Win XP?

    I formatted my PC and installed XP. Can I reinstall Vista using HARD drive recovery?

  • How to manage Windows Vista power management features

    Hi guys I searched a bit in the technical knowledge of the Toshiba and found a very interesting article on Windows Vista power management features. * [How to manage Windows Vista power management features | http://aps2.toshiba-tro.de/kb0/HTD84026Q000

  • BlackBerry classic catastrophic autonomy

    I'm just on the edge of Blackberry abandonment after being a loyal Blackberry user for more than a decade. Until yesterday, I had a Q10 that I was very satisfied since the first day I've owned. Then the new update came last month and I've updated the

  • Adding a dongle Bluetooth for Windows 7

    I have 2 USB Bluetooth dongles that appear in 'CSR Bluetooth Chip' by Realtek Device Manager. Both report that they are working correctly. But when I try to add an a set of Bluetooth headphones, they are never detected. It's on 2 different computers