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.

Tags: NI Software

Similar Questions

  • Produce data of a loop with a structure of the event

    I'm relatively new to Labview programming (as discussed in my program below). I found a vi online which collects data from an analog USB card to 9237 bridge. The upper part of the vi is which collects the data. The original place the output into a chart, but I changed it to a digital indicator.

    The lower part, trying to get the operator to use the start, stop, buttons to interact with the system to reset. I used an event structure to do this. It all works well, except the event that the value of the load of data (from the loop above) cells. I want to follow up on the new value continuously, but is only once. All other features work fine. Can someone explain how I would best accomplish this?

    Any help would be apprciated.

    Why do you use a queue to pass data to a loop at the other?  The reason why it doesn't work once, it is the lower loop will wait until an event has occurred.

    I would eliminate the queue.  Wire the Total in a property for the total value (signalling) node.  That will trigger the occurrence for Total: change value event.

    Don't read property nodes in the upper loop when you have indicators and the son here to read from.

  • 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/...

  • problem with tab structure control and event

    Hello

    My program has a tab control. In each tab, I have an event structure to control some events.

    I encountered some problems. These are:

    1. in each tab, I set tab as an event control, to altogether from the structure of the event as tab change (for example, the image below). My first problem is that when I change the tabs, in the arch depending on whether my program is entered in the next tab environment, happening at the event: change value to main tab! And gives bad result.

    2 - I've scheduled two final tabs as below in the image. I had no routine in these two tabs. Simply, I want when I change the tab, it goes to the next case of the tab control. But when I run the program, it goes to something as busy after one or two changes tab and did not work properly.

    Could someone help me please?

    Thanks in advance

    Baran

    Rebecca wrote:

    I want to have 4 tabs, each tab having 3 Boolean control.

    If in each tab all Boolean control wins 1, a Subvi should be run.

    I wrote this code with some time within each tab loop this case hase 3 for each Boolean control. The result is true.

    But I think that if I write it with a structure of the event within each tab instead of 3 cases, the cpu load will be lower.

    Is it not true?

    Make a unique Structure of the event.

    Add events for all controls (buttons, Boolean)

    When the event is triggeredcheck for active tab control and decide what void / vi to run

    It will work fine you

  • logical AND with the structure of the event

    Hello world

    The structure of the event can manage several events at once to do the same thing: looks like an OR logical operator. But I have not found a way to sequence events to approach a logic and example: you must click on a button to draw, then enter the image would change the mouse cursor. With a structure of the event, I can handle these 2 events separately or together (i.e. change the cursor), but I can't do a sequence of events.

    Is this possible to do with a structure of the event?

    I hope that I am clear (sorry for English btw). And thanks in advance.

    Christophe

    I don't think this is possible directly. You will need to add status information to your event loop that could enforce the order of events and the rules of logic you want. Where transformation you would have to check whether the required event has occurred before this event. If that were the case, perform your treatment. If this isn't the case, ignore the event. Your first event would need set this status information. You can also include some kind of time-out for the second event were to occur within a specific period.

    This type of logic may be better treated with the help of producer/consumer architecture and a state machine in the task of the consumer.

  • Structure of the event with sub-panels

    Hi, I tried to find a simple example with a structure of the event and only two sub-panels.

    I found the 'new Event Handler.vi' and I'm doing something with two sub - vi I did 'Add.vi' and 'Mul.vi '.

    To be able to switch between the two sub-panels used in 'New Event Handler.vi', the programmer used a "time surge" which I can't locate

    anywhere, so I just copied 'new Event Handler.vi '.

    I can't get this to work.

    Take a peek inside the world

    Sincere greetings,

    Lasse

    Hi Lasse,

    Yes, there is. If you open the properties of the subVIs Add.vi and Mul.vi (Ctrl + I), you can change in the tab 'appearance of the window' to that custom... There is an option display front panel, when it is called and the close later while initially closed just sellect them. Then, you will have the effect of 'pop up' :-)

    I slightly changed the example, so that can see them in the form of pop-up windows.

    See you soon

    Angel

  • major error with the structure of the event

    IM under LABVIEW 13.0 PRO

    I don't know when this strarted bug happening, but now when I add a business to a structure of the event. Freezes in LabVIEW. I have to close labview with the Task Manager.

    It doesn't matter what code I'm working with, even a new VI, with nothing else than a structure of the event.

    I tried this on my desktop PC, my laptop and my CPU DAQ.

    The error occurs on my desktop and my laptop. But it does not occur on my CPU DAQ.

    Whenever I click on add event usually case, you get a popup to configure and add cases, but with the popup error never comes to the top and labview crashes.

    Theres no code to share the problem ocured when adding events to the event structure. It happened with any structure of the event, in any code, all the time.

    I spoke to an engineer of apllication of labview and suggested to delete the labview.ini file located in the installation of labview directory. I did this and the problem was solved.

    Still not sure what caused this to happen.

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

  • 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".

  • 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

  • Structure of the event inside while loop

    I'm still fairly new to Labview and this may seem a simple question.  I'm doing a Subvi to display, edit, and create configuration files.  I use a ListBox to list all sections of a config file and structure of the event to update the values in each section, when they are clicked.  The problem is that the structure of the event seems to be a break the while loop so that the buttons do not work until the event has executed.  What I would like is the while loop to run continuously and the event to run only when I click in the listbox control.  I hope this makes sense.  There is a peak in the diagram below. Thank you

    There are a number of issues with your code that could cause problems:

    1. You must use the FP. Open method to open the front panel of a VI and of the public Service. Close method to close. I don't remember exactly the problem, but starting with the 7 worm nor indicated that these methods were the preferred way to perform these tasks.
    2. Based on what seems to be the code, the event for the control of Presets of wood should be a change the value - not a mouse down event. After changing the type of event, use the event data NewVal to drive the indexer table index entry.
    3. The buttons Ok and cancel them should be handled in their own events to change the value. The value change event Cancel would exit the loop, while passing the output error (which indicates that cancel was pressed) and default values for the other 4 outputs. The change of the value Ok event would leave the loop by passing the values that the operator had concluded the 4 controls on the front panel.
    4. An event of timeout with a very short time (1 msec) would stop loop if an error has occurred, or the output of the gate AND is set to true.
    5. The wait function is not necessary, as is the case outside the loop structure.

    Mike...

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

  • 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 '.

  • get the structure of the event inside the while loop to wait for event occurs before the execution

    Hello

    I have a small problem, when I raise an event using a value change button, which works very well.  The problem is that the VI does not wait for me raise an event and instead runs the same event again, even if I have not pressed the button to start again.  The mechanical action of the button switch is released is.

    I was wondering how you get the structure of the event to wait for a user event, after that he executed the first time.

    James.Morris wrote:

    There is no reason that the event should be raised twice as much that the only way that it fires in your code is by the user by clicking on 'Hall measure only'.

    Oh yes, there is, and I deserve a kudo for this one.  Mechanical action on the button is set on the switch until published, so click to generate an event, on the bottom and on the square, attached is an example.

    My boy has my students hate this question, and to be honest, I hated it.  When never would you do that intentionally?  Honestly?  Anyway to change the button back to normal (as default latch when released) and move the terminal button in the structure of the event where it is managed and it will work as usual.

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

Maybe you are looking for