How to control a VI (with a while loop and a structure of the event) from an another VI

Hello

I have the main VI which I want to be driven from an another VI. But I can't do that and I don't know what is happening.

For example: VI main, I have a while loop with a structure of the event, there is a Boolean controller controlling a Boolean LED, which is inside the structure of the event. And the other VI, there is just a Boolean controller and functions of applications to open the main VI.

How can I control the Boolean LED in VI main, changing the State of the Boolean controller in an another VI?

Thank you.

There are different options, but depending on what you want to do. For this example I can't give you a specific solution.

I do not understand why you do what you do. Why do you call your 'principle VI' dynamically? What is the advantage to do? There are also other ways to call a VI dynamically, based on real cases (for example the method "call and forget", etc...).

In you principle VI, control you Boolean ("THATCHER") is not the case of corresponding event. This is not usually a good practice, keep it inside.

Also, why you try to communicate with the caller and callee VI through such a way to twist? There are better ways to do it.

In one of my projects, I use the user event to launch orders in case of case of appellant VI.

some Associates more readings for you:

http://www.notatamelion.com/2015/03/23/how-to-make-dynamic-subvis/

http://forums.NI.com/T5/LabVIEW/Dr-Damien-s-development-event-structures-III-communicating-with/m-p/...

Tags: NI Software

Similar Questions

  • Control of the event: how to stop the race while loop within a structure of the event

    Hello

    I have some problems with control of a while loop inside a structure of the event (see annex VI).

    I have 3 buttons (the "Start measurement, stop, exit the program"). When a measure is running, it should be possible to stop the measure by clicking on "Stop the measure", but it does not work.

    Someone at - it an idea?

    Thank you very much and best regards,

    Michael

    Hi Michael,

    create a process parallel to your measurement. You can use the design model "producer/consumer with vents. You'll find it with «File-> new...» ».

    Another possibility would be to remove the "lock frontpanel" sign, in the case of event start measurement.

    Mike

  • problems with timing in a time loop in a structure of the event

    Hello

    I'm using labview to control three motors stepper, running the three stages of different translation in different axes (X, Y and Z). Please see the attached VI, focusing on the structure of the event on the RIGHT side.

    In the Z axis, I am trying to run the engine for 5 seconds, after clicking on a button. I have attampted to do by adding a sub of elapsed time VI within a while loop, located in the tab 'Mouse before Z down' the structure of the event. A similar "elapsed time while loop" is also included in tab 'Z reverse the mouse down' the structure of the event.

    Separately these "elapsed time loops" work very well, BUT when I run a Z direction after another, say 'Z Reverse' and then 'Before Z' then they annoyingly interact. The calendar is gone, with the moment where we add, rather than rebooting.

    No idea how I can reset the time elapsed while loops? Or is there another method better do?

    Thank you very much

    Charlie

    charlieryan wrote:

    I take a wire from the 'i' of the while loop at the entrance of the Sub autoreset - VI of tiem will blink?

    No, connect you to the "reset", not "autoreset".

  • Why the execution time increases with a while loop, but not with "run continuously?

    Hi all

    I have a problem of severe weather that I don't know how to fix it because I don't know exactly where it comes from.

    I order two RF switches via a data acquisition card (NI USB-6008). One job at the same time can be selected on each switch. Basically, the VI created for this feature (by a colleague) resets all the outputs of acquisition data and active then those desired. It has three entrances, two chain simp0le controls and a cluster table, that contains the list of all the outputs and some practical information to know what is connected (specific to my application).

    I use this VI in a complex application, and I have some problems with the execution time, which increased whenever I said the VI, so I did a test VI (TimeTesting.vi) to determine where the problem came. In this special VI I record the execution time in a csv file to analyze then with excel.

    After several tries, I found that if I run this criterion VI with the while loop, execution on every cycle time increases, but if I remove the while loop and use the funtionnality "Continuous run", the execution time remains the same. In my high level application, I have while loops and events, and so the runtime increases too.

    I someone could explain to me why execution time increases and how can we avoid this? I have attached my VI test and the necessary subVIs, as well as an image of a graph that shows the execution time with a while loop and «run permanently»

    Thanks a lot for your help!

    Your SetReset_DO VI creates a channel whenever it is called.  And that you never delete a task.

    When running continuously, that it's as if it only runs once and LabVIEW has internal mechanisms to close references that will not be used again.  When a VI is used as a Subvi, LV does not know if she will be called again, and lacks these things until the first level VI stops. You have a memory leak.

    Just as you open and close your file outside the loop for, create your channel out of the loop.

    Lynn

  • An interrogation continues with the Structure of the event, please help me understand

    Dear Forum,

    I'm 3 months in LabView. I created a front panel with what I consider a reasonable set of code below with a basic entry control power boulean a case controlled set of actions. I enclose a strongly striped version to the bottom of this structure with sections deleted button so that the executed code is removed to simplify just ask questions on this control structure. After the recent webinar, I understand this form of control to call a continuous structure of vote - and it makes perfect sense and seems natural for me to the point of programming of data flow.

    But according to the webinar it is preferable to use the structure of the event.

    However, the structure of the event seems really weird to me. My main question here is certainly the structure of the event MUST be voting each of the values itself anyway, otherwise how does he know that an event had occurred?

    So what is the difference between explicitly "polling" the buttons myself with a while loop and using a complex (for me) of the event with 'hidden' polling stations under?

    The vote of the 4 buttons in my example should be done at the same time if Labview is truly multithreaded/parallel? There should be no difference in the level of the computer between my code querying and the code 'hidden' the structure of the event making the mark.

    Thank you in advance for you help to clarify my confusion.

    Sincerely,

    Robert Gibbs

    rg8766 wrote:

    Surely the process:

    Check the OS press > OS encodes this trigger to send > OS sends a trigger that the button has been pressed > Labview checks if a trigger happened > Labview decodes what action has been coded in this trigger > Labview takes appropriate, based on relaxation measurements

    has more steps and is more intensive than processor

    LabVIEW checks the key > Labview performs the appropriate action when you press the button?

    BONE is already this process in any case.  If you are in fact doubly effort without worrying.  And the OS is much more efficient that your code will be.  So just let the OS do work heavy while your code sleeps.

    And think about the trigger more as an alarm clock.  You are asleep (do nothing, with no CPU) when your alarm goes off.  You wake up and perform the task that the alarm tells you to do.  Once done, you are waiting for another alarm, so you get to sleep.

  • Can I use Ctlref in a structure of the event with a mouse to an event?

    I have a large number of controls on a front panel. I use a structure of the event that triggers the movement of a given motor when you press the corresponding button. However, I would like to avoid creating events for identical most of N, so I relied on the use of a mouse down on the front panel event, then retrieve the reference command using the Ctlref node (with gives 'Reference to the control on which the event occurred', according to manual labview) and analyze an array of references to know which engine is supposed to move. However, it seems that this node is not (contrary to what the manual said).

    I found other ways to do what I need (I thought using a table containing details of my controls and the coords in the structure of the event node), but I wanted to know why I can't find this node (that is displayed for the event "value change" for example). I'm using Labview 2013.

    No luck for you. Mouse down on the Panel does not have the refnum control because it does not work on a control. Mouse down on a control has it, and since you can configure the mouse down events on multiple controls in the same case of event, it also provides a refnum of control so that you can still use the order in question.

    This is probably also the question that Jeff might have seen. When you set up multiple events for the same frame that LabVIEW displays only the terminal event that are present in all of these events. Terminals that do not exist in at least a specific event of the multiple events for this image are more selectable.

  • How to upgrade a shift with two independent loops while register?

    Hello everyone, I have a panel with two clusters with indicators control... a left and a right. I have messages from serial port, and I'm currently updating the left and the right within their own while loops. I have a single variable, which must be updated based on updates on both sides. Basically, I need follow the last selection update on each side... If I had 1, 2 and 4 on the left side and 3 on the right side... I would need to follow 4 was the latest updated the register shift variable for uses more in my vi. Can someone give me an idea how to upgrade this a variable based on two while loops that run independently in the same sequence context? Thanks in advance, cayenne

    Thank you both of you for the suggestion.

    I managed to find a way to get the values that I needed without EI... but I read the link to the Nugget in their subject, and I can't expect a use for them in the future.

    Cayenne

  • With LabVIEW how to control an instrument with a RS232 output, using a USB RS232 converter cable.

    With LabVIEW how to control an instrument with a RS232 output, using a USB RS232 converter cable, since I do not have rs232 ports. I have two instruments I want for the control in this way. One is a guarantee of strength Imada SPAS with RS232 output. The other is a micrometer Panasonic HL-G103-S-J laser sensor which is RS422. I have done significant programming LabVIEW using GPIB, but I have no experience with devices such as these. No matter what tutorial or examples would be greatly appreciated.

    Thank you.

    When you plug the USB-RS-232 converter, it installs a driver under Windows which makes it look like any other RS-232 port.  You may need to install the driver of everything that came on the CD with the converter.  It will get a Com as Com5 port number according to what is the next available number.

  • 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)

  • Control the Structure of the event with text file

    I'm new relativaly in LabVIEW (experience only about 2 weeks). I am currently control a stepper motor using a structure of the event. Similar to the sample code given by LIFA, I entered my settings how the engine not move away, then press a button on the windows before, and it works this way. I also have other equipment that works as well in LabVIEW, as a transnational step; all components operate individually.

    Now, I'm trying to make the more automated system and to ensure that all the different equipment work in the same code. So, I tried to implement a structure of the event using a text as an input file to try to control events. The text file has a table 1 d of numbers going down vertically (only the line numbers change). So, I used a table of index function to take the numbers one by one, use a loop (while loop in this example) to go to the bottom of the column of numbers. However, the event not register the change, even if the indicator shows the value is changing.

    Attached, it's my test code and the text file that I use to try to control the structure of the event. Please let me know what I am doing wrong. Thank you.

    Oh, now I understand what you tried to say. I'm using a loop and a case structure to activate different events with the entries in the table. I thought case structures and event were the same, but you taught me the event structures are used just for the façade stuff. Thank you all!

  • How to reset a while loop based on a value change event?

    Hi all

    I work in a labview program that sends voltage to a laptop via USB 6008, tension is amplified by an op-amp, and then he comes back in the laptop. I created a program and a working circuit, but my current challenge is how to reset the average of the values of voltage coming into the laptop, after that the user changes the digital control (which controls the output voltage). In other words, I need to be able to reset the number of iteration and the sum to 0 each time this happens.

    I looked upward to reset the counters of iteration through shift registers, but I'm not sure it will work in this case, but I'm also not sure how to reset the sum of an array (if possible). I have spent a lot of time to read these forums and tutorials from various sites, so I think it can be done with the correct nesting of the case structures, structures of the event and while loops, but I don't know how. I am new to LV, just started to learn in mid-January, so any help is appreciated.

    Thanks in advance,

    Graeme

    You just need the structure of single event with the bargains.  Use the case of timeout to get your new values and find the average (100ms timeout value and get rid of the wait function (ms)).  Keep the amount and the number of items in the shift registers.  Wire these values through each case of the event.  In the event of changing the value: control, just set the values to 0.  Then add a Stop button value change event to stop your program.

  • How to manage the structure of the event with two loops

    I have a question about the structure of the user event with 2 buttons?

    key 1: START LOGGING DATA

    key 2: STOP LOGGING DATA

    How do I control my

    structure of the event so that it will work? because now that the loop is save data... I can't stop the loop, when I clicked on buttons.

    super_saiyans wrote:

    the problem with moving it is that I don't have control of the DATA RECORD STARTING?

    Of course, you do.  When you get your press conference button, you say your state machine to move to the State of logging.  You must also make sure that you return to visit the State to wait for the event to check out the events of the stop button.

  • Synchronization of 2 loops while one with a structure of the event.

    Hi fellow users of LabVIEW

    I try to incorporate a structure of the event in my current exisiting VI to Save certain values of control as shown in this post

    http://forums.NI.com/T5/LabVIEW/using-the-quot-make-current-values-default-quot-as-a-control-on/TD-p...

    It's the VI that I use as model with my exisiting VI.

    http://forums.NI.com/NI/attachments/NI/170/547715/1/defaults%20Demo.LLB

    In case the 'stop, change the value' I use in the main VI and a 'real' constant instead of Boolean control of wire structure. While the loops are not connected. The table that I use in my exisiting VI (another while loop) is indexed and unbundled to be used here.

    The work combined well screw and it gives me the results, my question is, in the long run it will give me issues. Do I still need to synchronize?

    Thanks for all the help.

    There's no problem because loop additional lower with the structure of the event.

    Personally, I worry about the top loop. Why so complicated? Why so much duplicate code? Why all these hidden indicators serve as local variables?

    Why don't simply place you the table in the entire cluster in a shift register and the index and ungroup by name wharever value, that you need to access. No hidden local variables or indicators.

  • Control 2 while loop and a queue

    Hello Mr President

    I need handel while loopps as they run in order. I can use the structure of sequence, but the question is in my program, I also have one already queued. Please help me how I can handel this question

    Thank you

    You certainly want a State Machine. You can't do what you want using a sequence structure, as you said. If you need an architecture that can operate several different cases in a certain order, but also to repeat the States if necessary.

    The Computer of State Simple model that comes with LabVIEW is really the best way for new developers to become familiar with LabVIEW using a semi scalable architecture.

    Here is a large example of the works of a state machine:

    • States: Init, slowed down, exit, DoThing1, DoThing2, DoThing3
    • Each State contains code that could take some time. Ideally, not too long because this is how long your code might not meet.
    • The idle state contains a structure of event for all of the user interactions.
    • The front panel has a button that says "do the 1 thing.
    1. Loop iteration 0: Application starts, the first State is Init. Init State made the initialization stuff and tells the application to go to the idle state when finished.
    2. Iteration of the loop 1: request goes to the idle state. He's sitting there, waiting for the structure of the event.
    3. Time passes, and then the user presses the button 'do 1 thing ". There is no code or minimal code, within the occurrence of the event. The output of this state of the event tells the application to go to the State of DoThing1.
    4. Iteration of the loop 3: Application passes to the State of DoThing1. Here, there is code that does a few things. The output of DoThing1 State tells the application to return to the idle state.
    5. Iteration of the loop 4: Application goes to a State of rest where he waits again to the structure of the event.
    • Each State can tell the application to go to any State they want. You want to reset? Return to the Init State. You want to put an end to the program? Go to the exit State. You want each State to start another (such as a sequence)? Have DoThing1 out of DoThing2, which DoThing3, which outputs Idle.
  • Creating a table with a while loop

    I want to create a table using a while loop but I don't know how to do it.  Basically, I want to do the same thing as in the image of the example VI in LabVIEW VIs, called 'Graph XY Data Types.vi' example, but with a while loop instead of a for loop.  The reason why I want to do with a while loop is because LabVIEW will not faint error or VISA data thanks to a for loop.

    LabVIEW certainly enable you to pass out a mistake or VISA through a loop for. The default value is autoindex output and thus creating a table but is a simple right-click on the tunnel exit to change that. For recent versions, it changes the Tunnel mode to "last value". You can also use a shift register.

Maybe you are looking for