First event fired to event structure

Hi all,
   Does anyone know what's the first event being fired to the event structure on VI startup? I set a breakpoint on the event structure and it breaks. However i wasn't able to capture whats the event.
My intention was simple; i have a table which list all the IO names and values. So during VI startup, i wan to populate the IO names first. Then in a timed-loop, the values are updated respectively. In this case, i don't need to "refresh" the table every time which waste time and resources.
It something like the OnLoad event.
Another way out is to register an user event, and have this event fired during application startup. But i wonder if anyone has a better way?
Many thanks!

j3r3mi wrote:
My intention was simple; i have a table which list all the IO names and values. So during VI startup, i wan to populate the IO names first. Then in a timed-loop, the values are updated respectively. In this case, i don't need to "refresh" the table every time which waste time and resources.
Why don't you show us some code.
Are the IO name static for the duration of the program? Are you using a regular table column or the "row header strings []" property for the IO names?
If you want to write the row headers at the start of the program, place the code before the main loop containing the event structure. No event case needed. If you have a specific event to update the table headers if needed, fire the event once at startup using a signaling value property, again with the property node placed before the main loop.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Some frontpanel controls stop firing the Event Structure

    In my main vi,I have an event structure. I created a subVI that also has an event structure. I load the subvi via a subpanel in my main vi. It runs fine for a while. But sometimes after firing events on the subpanel, most but Not All controls on the main VI stop firing the Main Vi's event structure. The Subpanel's subvi event structure always works fine. When I reload the program it works fine again for a while.

    This is the problem that's been bothering me too (big time actually). Thanks for the insight!
    First of all I love the event structure and it totally changed the way I program labview. Together with the subpanel addition, it makes for very professional looking programs. Here's my version of the same problem:
    I have an event structure on the main VI, and ~20 subpanels. I load various subvi's in the subpanel of the main VI as required. Each subvi has an event structure to handle GUI and incoming user events. I found the problem in the full blown operation, but the problem also appears when I only have one subpanel running, so only one event structure in a subpanel and one event structure in the main program.
    I had the problem with a mouse down on a table, and with a doubleclick on a listbox. And indeed I had an attribute node (reference + property node in my case) to the listbox in the event case that handles the doubleclick. When removing the attribute node, no more buttons will stop to respond on the main panel. When you try to readout or access the listbox in any way in the event case that handles the double-click, it fails. It does not matter whether the "Lock front panel until the case for this event is completed" is true or false. After it fails, you have to unload all the code and reload before LV is able to see some of the buttons on the main panel again (LV7.1.1). You do not have to close LV just the VI's.
    So my first work-around after reading your story was to drive a user event from the doubleclick event case. That user event case then does the stuff I want to do with the listbox. Did not work. I then added a delay of 1000 ms before accessing the attribute node in the other event case, that worked. I then moved all my stuff back into the original event case and added a delay there before accessing the listbox. 100 ms failed, 500 ms works. So at this point I would tend to unexpected behavior from LV which is timing dependent, not "Operator error".
    There is never a problem in any of the ~200 events in the ~20 subpanels. It is always the main panel that is affected. The event handler simply does not "see" some buttons anymore (value change), for example the "mouse down" event would still work for a boolean buttton on the main panel whereas the "value change event" would consistently fail.

  • Event Structure Freezes Vi After Capturing The First Event

    My Event structure catches the first instance of my button press but then it freezes my Vi.  The reason is because of the while loop but I need the while loop to constantly read from a serial port and send data to a serial port. The vi included is stripped down to be just a while loop that does nothing.  I have also tryed putting the event structure in the while loop, but the same thing is happening.
    Any ideas?
    Thanks,
    Cason Clagg
    SwRI
    LabView 7.1, Windows XP

    Also, put the button inside the event structure where it is acted upon, from LV help (suggest you read the entire events section of help):
    When you trigger an event on a Boolean control configured with a latching mechanical action, the Boolean control does not reset to its default value until the block diagram reads the terminal on the Boolean control. You must read the terminal inside the event case for the mechanical action to work correctly. As a reminder, a note appears in the Edit Events dialog box when you configure a Value Change event on a latched Boolean control.
    Refer to the Handling a Latched Stop Boolean Control in an Event Structure caveat for information about how to handle a latched Boolean control.
    When you trigger an event on a Boolean control configured with a latching mechanical action, the Boolean control does not reset to its default value until the block diagram reads the terminal on the Boolean control. You must read the terminal inside the event case for the mechanical action to work correctly. As a reminder, a note appears in the Edit Events dialog box when you configure a Value Change event on a latched Boolean control.
    Refer to the Handling a Latched Stop Boolean Control in an Event Structure caveat for information about how to handle a latched Boolean control.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    "It’s the questions that drive us.”
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

  • Event structure - "first run"

    Dears all,
    how can I manage the "first time" of an event structure?
    See the VIs enclosed.
    Thanks a lot at all.
    Attachments:
    Event structure - first time.llb ‏44 KB

    You don't need to mess with dynamic events. Simply add a timeout event to the event case you want to trigger.
    Feed the timeout terminal from a shift register initialized with zero and wired a -1 to the shift register on the right.
    The event case will immediately trigger once due to timeout. After that, the timeout will be infinite.
    (See attached image)
    Also have a look at my old post. The need for a generic "initialize event" has been discussed long ago in more detail, but I can no longer find the thread.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FirstRun.gif ‏11 KB

  • Firing events from a Menu using Event Structure - all in the same Event Window?

    I have an ap where I have three menus, and several selections from
    those three menus. I'm trying to keep everything within the Event
    Structure, but it seems that ALL of the events fired from the Menu must
    be contained within one "frame" of the Event Structure, that being the
    Menu Selection (user) Event. In other words, if I have 16 events that
    can be fired from the menu, do I have to put them ALL in this one event
    frame?
    I can't seem to use a T/F indicator within the Menu Selection (user)
    Event to access another Event. For example, within the Menu Selection
    (user) Event, I placed a boolean named X and can turn it on with a menu
    selection. Now, make a new Event Structure to look for X Value Change -
    doesn't work.
    Message Edited by Broken Arrow on 11-30-2005 10:24 AM
    Richard

    I use one event, Menu Selection (user). to trap all of my menu events.  Use Item Path and / or Item Tag to figure out what menu item was selected then branch code based on selection.  Wtih Booleans and menus you need to update the state of the boolean on the menu by setting it True or False.  It doesn't automatically toggle like you would expect.
    Matt
    Matthew Fitzsimons
    Certified LabVIEW Architect
    LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
    Attachments:
    menuSelect.JPG ‏45 KB

  • Multiple event structures in one program

    I know it's not good practice to have one event structure inside another event structure (I don't know exactly why). But if another event structure is in the subvi, is it safe? Please comment.

    guangdew1 wrote:
    I know it's not good practice to have one event structure inside another event structure (I don't know exactly why).
    This is because of dataflow and the way event structures work. If you have an event structure inside an event structure, both event structures will accumulate events whenever one occurs, but it is unlikely that they can be handled in the order they occur or at all. By default, event structure are set to lock the front panel until the event completes, meaning that if an inner event gets triggered first, the code will lock up, because it will no longer be possible to trigger one of the outer events. If the outer event occurs first, it cannot complete, because it requires a later firing of one of the inner events before it is ready to handle the next event that occurs in the UI. Even if it marginally works if the panels don't get locked, you are requiring the user to trigger events in a certain order. How is he supposed to know what's allowed or not?
    If this is not exactly clear to you, you need to start with a few tutorial and learn about dataflow, Then start using a single event structure and see how things work by programming scenarios and see what happens.
    guangdew1 wrote:
    But if another event structure is in the subvi, is it safe? Please comment.
    Event structures are only useful inside interactive subVIs that show their front panel. even then I strongly advise against calling anything interactive, or anything that takes excessively long, inside a main event structure. You end up with code that can become unpredictable, can deadlock, is hard to debug and flies in the face of all good programming guidelines.
    Obviously, you have some specific application in mind where you think something like that is useful, I can guarantee you that there is a much better solution is you think about this a bit longer. If you need help, please describe exactly what the program should do and how it should react to user interactions at the various stages.
    A program should always be approached from the code and UI needs. Don't start with a harebrained code construct (events inside events) and then look for a use. It does not exist! 
    Event structure only belong in toplevel loops. They should never be hidden insde squences or case structures (or other event structures as already mentioned above). If you have multiple toplevel loops that run in parallel, it is safe to place up to one event structure inside each. Each event structure can have an unlimited number of event cases. This should be sufficient to handle any programming need you might have.
    LabVIEW Champion . Do more with less code and in less time .

  • How can i use the same front panel graph in more than one events in an event structure?

    i want to display the signals from my sensorDAQ in a graph.but i have more than one event in the event structure to acquire the signal and display it in the graph.the first event is to acquire the threshold signals and its displayed in the graph as a feedback.after the first event is executed, i will call the second event,where the further signals are acuired and compared with the threshold signals from the event 1.my question is how can i use the same front panel control in more than two events in the event structure?please answer me i'm stuck.
    Solved!
    Go to Solution.

    Hi,
    I have attached here an example of doing the same using shift registers and local variables. Take a look. Shift register is always a better option than local variables.
    Regards,
    Nitzz
    (Give kudos to good answers, Mark it as a solution if your problem is Solved) 
    Attachments:
    Graph and shift registers.vi ‏12 KB
    graph and local variables.vi ‏12 KB

  • How to use a event structure with a state machine

    First, I would like to inform you that I only work on LabView part time, and have much to learn.  Anything I do learn, I usually forget until I need it again, because I only work on it part time.
    Using your StopWhileLoopMOD[1].vi, I am trying to put a state machine inside the event structure.  
    Related link: http://forums.ni.com/t5/LabVIEW/How-to-stop-while-loop-in-Event-case/td-p/465564/page/2
    Here is my application:  on the front panel, the user can select any combination of 7 different tests.  I have created cases to perform each step of each test in the correct order, but if the user presses stop, the tests won't stop because some of the cases have a while loop inside the event structure (like you mentioned is a bad idea).  The user should be able to stop the test, reselect tests to perform, and re-start the tests. 
    When the start button is pressed for the event structure, I need all the cases to run in the proper order, unless stop is pressed.
    In the past I have indexed an array and used that to run the state machine, but it won't stop immediately.  
    I have sub VIs that are built in while loops because the outputs of the product needs time to stabilize.  The state machine stops and waits up to a certain number of iterations.  If it passes the test, the while loop stops and the next state starts.  If it takes too long, it exits and reports an error.  Maybe I need to just use the state machine and not an event structure?
    Is there a good example of an event structure?
    metzler CLAD
    Solved!
    Go to Solution.

    I'm not sure exactly what you are asking, but it sounds like you want to script a bunch of tests and if the user says stop, to immediately stop the current test and abandon the others?  I'm going to assume that you know how to clear the array so that it will abandon the others, so I'm guessing that you are having trouble abandoning the current test?  If this is indeed the case, then the problem is that you are not able to propagate the message from the main VI FP which is the GUI to the sub vi which is the test, where the test may or may not have a GUI (FP visible) of it's own.  Threading was the first thing to come to mind, but this may not be necessary using events.
    You can do this by passing a refnum of the stop button to the subVI, where you can then add that wait to the event case structure.
    I've attached 2 VIs, mainvi.vi which is just a loop displays the count*2 (number of seconds passed since running) that will call subvi.vi and then check to see if the stop button is pressed.  mainvi.vi is by no means a state engine, it is just a simple loop for demonstration purposes.  subvi.vi just waits 2 seconds and leaves, it is a better structured state engine with an init state to start a poll case to wait for events and an exit state to clean up.  You can modify this any way you wish to get it to do what you want.  You will note that even if subvi.vi is being executed, it will terminate immediately when the stop button is pressed.
    Hope this helps.
    A
    Attachments:
    mainvi.vi ‏17 KB
    subvi.vi ‏33 KB

  • Load defaults from file with event structure in vi

    Hi All,
    I've been trying to figure out how to do this but have not quite got there. Taken a look at lots of posts but can't quite find the answer to the question that i've got.
    I've got a vi for controling 4 PCI cards making calls to some DLL's. I've got quite a number of controls on the FP and i use an event structure to update the values on calls to the DLL. On startup, one of the first calls that i make is initalise and that sets the cards up. I then want to load my own set of default values from a file to initalise the cards to my particular set up. While the software is running the user may change the values and wish to save a file with the new default values, or he may wish to load a different file of default values (depending on the test that he is running). I've got the Control Values:Get All [variant] and the Control Valueset [Variant] working to save all the controls values to a file and read that file in and set all the controls values. So far so good. Problem is i'm using an Event Stucture and it doesn't register that the values have changed. I could complish this by using Value(signaling) but the data from the Control Values:Get All is variant data and the Value(signaling) needs the same data type as the control. What do i do?
    One thing i have thought about is to write all the values from the file to all the conrols and then have a read Value and a write Value (signaling) to trigger the events. Problem is i don't want to set this up for every control (it'll take me ages). Can i do it programitically? Is there a better way to do it?
    Thanks,
    Phil

    You could create a boolean control/indicator and signal that value when you've updated the values on the FP.
    Name it something like "update FP". The event case for that boolean will have the code to update the necessary parts of the FP.
    André
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)

  • Maximum size of an event structure

    I have just a short question about the maximum size of a event structure, and did not found it yet in the forum.
    I have an event case with 35 event cases. How many are allowed, what is recommended and is there a huge loss of performance by seizing it up?
    Thx for answer

    As far as run-time performance is concerned, the number of event cases in an event structure should have no noticeable effect.  Worst-case scenario, when the event structure is woken up due to an event occuring in the system, it does a linear search through the list of event cases to figure out which event-handling diagram matches the event that it pulled off the queue.  These tests are pretty quick (3-4 comparisons per event-handling diagram) so I can't imagine it really would have any effect on performance.  However, this does tell you that if you want to squeeze every ounce of performance out of your event-handling code, make sure the most frequently run event-handling diagram is the first one in the list.
    The only performance issue I could see arising is what Damien mentioned - at edit time, it may take longer to make edits to the event structure (eg adding new event cases, changing the events a given diagram is associated with).  I don't know that I've seen any issues because of this (the largest application I've written has an event structure 40 different event-handling cases), but I think this is where any potential performance issues reside.
    Hope this helps.
    J
    Jason King
    LabVIEW R&D
    National Instruments

  • Save as previous version causes events to disappear in event structure

    I am using 2009 and I am trying to save a VI as previous version...saved it in 8.6, 8.5,8.2 and 8.0.
    I mass compiled the Main VI in 8.6 and tried to open it.  I get about 30 errors one for each event case and the event structure has no events added. 
     "Event Data Node:Contains unwired or bad terminal"
    I am attaching a zip file containing my 8.6 source code which I down converted from LabVIEW 2009.  I am trying to open it in 8.6
    Is this a bug or am I doing something wrong?
    Brian
    Attachments:
    8.6.zip ‏556 KB

    Hey Brian,
    This was reported to R&D (# 194525) for further investigation. A possible workaround for this issue is to save the VI to LabVIEW 8.6 and then save it to the various versions you wish to save the VI to. Also, another workaround is to manually re-enter the event specifiers to your cases.
    When I saved the VI from LabVIEW 2009 to 8.2, the only thing that seemed to be out of place was the event specifiers. You can re-configure these by right-clicking on the event structure and selecting "Edit Events Handled by This Case...". Also, when I first saved the VI to LabVIEW 8.6 and then to LabVIEW 8.2, everything seemed to be in order.
    Thanks for your feedback. Let me know if I can clarify any of my proposed workarounds.
    Hope this helps.
    -Ben
    WaterlooLabs

  • Event structure doesn't register local vars

    I have a gif of a basic FPGA topology that I want to show some loopbacks in.  As the user clicks on the booleans, vertical lines should appear, then disappear as they click them again, showing the current loopback topology.
    To conserve resources, I opted to use an event structure.  So far I have set it up for the RX_FAC and RX_TERMXCO4AU loopbacks that you see in the upper left of the picture.
    Only one RX loopback and one TX loopback can be on at a time, so one of the first things that happens when the user clicks the boolean is that it sets the values of all the other booleans in that row to false, via the use of local variables.
    The problem is - the event structure only executes when the user actually clicks the boolean true or false, but not if the boolean is set false via the use of a local var.  In other words, let's say I have RX_TERMXCO4AU true, and RX_FAC false.  If I click RX_FAC to set it true, then you'll notice RX_TERMXCO4AU goes dark/false, and RX_FAC lights up.  So the value of RX_TERMXCO4AU changed, but the event structure associated with RX_TERMXCO4AU did not execute (which is why the vertical line between RX_TERMXCO4AU and TX_FACXCO4AU stays there).
    This will make a lot more sense if you run the attached simple VI.  Right now, events only exist for RX_FAC and RX_TERMXCO4AU, but it's sufficient to explain the problem I think.
    Any help is appreciated.
    Solved!
    Go to Solution.
    Attachments:
    loopbacks.vi ‏55 KB

    bmishoe wrote:
    I learned something new today...
    One more thing you can learn, When you are passing an array input to a For loop with 'Auto indexing' enabled, you need not wire anything to For loop's 'N' terminal.
    In other words:
    If you enable auto-indexing on an array wired to a For Loop, LabVIEW sets the count terminal so you do not need to wire the count terminal. 
    In your code, you can remove the 'Array Size' nodes.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • How to determine the execution order of event structure

    Hi everyone,
    I have an event structure were it contains four events. All the four events has separate buttons to execute. Here, three events will generate numeric output, remaining one event (Finder) should find the order of those three events. For example, Three events namely A, B and C. I execute the events in the order of B, C and A. The finder event should find the order of previously executed events(B, C and A). 
    Thanks in advance.
    Solved!
    Go to Solution.

    Hello Vij@y,
    I could not look in to your VI because I dont have LabVIEW 2013 (I have 2010) but i tried to understand the situation you are explaining.
    Please find attached image of front panel I made for your reference.
    Here I generated two events sequently, no 3 first followed by no 1 and the same is displayed in sequence array. now you can use the build array function to actually add each event to this array as explained by many people in this forum.
    regarding the timeout event, either you can display the sequencer array in that event or you can display it in finder event and then you can reset the sequencer in finder event (I used reset button click event to reset sequencer back to zero value)
    regarding getting zero when you press finder/reset button before triggring any other event:- Is it not correct to have empty array when you have not trigger any event?
    I hope I put it well and may help you to find solution. 
    With Regards
    Miraz
    Kudos is better option to thank somebody on this forum
    Attachments:
    Sequence.png ‏70 KB

  • Calling a VI in a subpanel with parameters inside an event structure and using an abort button

    Hi all,
    I have a control panel with a tab control and two tabs have a sub panel in them.  At runtime I load the VIs I want in to the sub panels.  In the control panel event structure I want to start each of the VIs and monitor the execution state so I can abort the VI while it is running.  One method I use can run the VI and the abort event will work (see example).  The second method I use does not and this is what I want to do!  I have many inputs to the VI I want to pass so placing the VI in the event blocks everything else and it has to wait until the VI has completed, so I cannot monitor the execution state.
    I have attached an example of what I want to do.
    Any help appreciated.
    Martin
    Solved!
    Go to Solution.
    Attachments:
    SubPanel.lvlib ‏2 KB

    Hello,
    You can do this with queues. 
    The main vi and subpanel vi's should be based on the producer/consumer (events) and you handle the front panel events accordingly in the respective vi's. 
    Name the queues in obtain queue , for example the Main being MainQ, subpanels SubPanel1Q, SubPanel2Q. When you start the application, initialise the main vi and also run both of the subpanels (just to make sure that the queues are first obtained by themselves). Then you can use obtain queues to do inter vi communication.
    For example if you need to send data from main to subpanel1, use obtain queue and use the name SubPanel1Q, pass the required data & command and voila. Subpanel1 vi will receive your message. You can do this anyway you want. Hope this helps.
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.

  • How to implement boolean comparison and event structure?

    Hello all,
    I'm currently developing an undergraduate lab in which a laptop sends out a voltage via USB-6008 to a circuit board with an op-amp, the voltage is amplified, and then sent back into the laptop. The student is going to have to determine an "unknown" voltage which will run in the background (they can do this by a step test, graph V_in vs V_out and extrapolate to the x-axis).
    Currently, I have two loops that are independent in my VI. The first loop is used to "Set the zero." When 0 voltage (V_in) is sent out of the laptop it returns a value around -1.40V (V_out) typically. Thus, I created the first loop to average this value. The second loop, averages the V_out values that come into the laptop as the V_in numeric control changes. Then I take the "set zero" value from the first loop and subtract it from the second loop average to get as close to 0V for V_out when V_in is 0V.
    The problem I'm facing is, the event structure waits for the V_in numeric control value change, but after "SET ZERO" is pressed, if there is an unknown value, it will not be added to the average for V_out until V_in is changed by the user. So, I tried implementing a comparison algorithm in the "[0] Timeout Case." This algorithm works for step tests with positive values for V_in, but there are two problems.
    1) Negative values cannot be used for V_in
    2) If a user uses increasing positive values for V_in there is no trouble, but if they try to go back to 0, the value change event has been called and it is added to V_out as well as the timeout case.
    Sorry for the extremely long post, but I've been banging my head over this and can't figure out how to properly implement this. I'm using LabVIEW 8.0.
    Attachments:
    Average Reset Test.vi ‏371 KB

    OK you have bigger problems than Raven's Fan is pointing out.
    When the first event loop stops ( after pressing "") (the boolean text is "Set Zero")  The second loop may start- (AND PROCESSES all of the events it was registered to process before the loop started!)  that would enclude the value change event from "" (The boolean text is Stop) Being pressed bebore the loop started.  Of course, since the labels of "Set Zero" and Stop are identical nulls....................................................BOTH event trigger at the same time and are processed as soon as the event loop they are registerd to is available.
    Get it ... The two buttons labeled "" both queue Value change events to both loops registered to act on the value change of the control labled ""!
    Both loops will do what you programmed in the case of "" Value Change!  This can, (as you have observered) lead to confusing code actions.
    Do avoid controls with duplicate labels (There is a VI Analizer test for that!)  Do avoid multiple event structures in the same hierarchy. 
    DO NOT bring this to your studients to help you learn LabVIEW!  We get enough studii asking embarassing questions
    VI Analizer will help you provide sound templates.  If you need help with that hit my sig line- e-mail me and I'll always be willing to help.
    Jeff

Maybe you are looking for

  • HT1212 it refuses to let me restore my ipod touch, does anyone know how to restore it?

    my parents bought me an ipod touch 4th gen for christmas, it has been working fine. I changed my passcode and i forgot it. I tried entering what i thought my passcode was, but i entered it many times wrong. soon a message came up on my screen and sai

  • MEASURING FORCE ON BALANCE USING AN ELECTRONIC BALANCE FROM THE SERIAL PORT

    Hi, I am trying to measure FORCE using an electronic BALANCE from the serial port. My measurements are strange! The BALANCE sometimes give ZERO reading! Is it because of the sample rate, baud rate etc? I have attached the readings concerned. Attachme

  • Recommded DAG for 4 site Exchange Org

    Hi, I'm with client that has 4 Exchange/AD sites: Virgiinia, California, UK and Germany. All sites are well connected. Each Database has 3 copies total (CA and VA sharing copies, UK and Germany sharing copies). What would be the best solution in this

  • Proxing servlet's via Nsapi (NES bridge)

    Is there any way other than 'ppath' to proxy requests to a servlet in WLv5.1-sp3, via the Nsapi in either Nes 3.6 or 4.0? The environment is all Solaris. It doesn't seem that mime types would work, being as there isn't a file suffix (i.e. JSP, jhtml,

  • Help! Need to locate a savy programer

    I have a project that is too big for my expertise. I need to find someone who can work with me in completing the project. Must know flash, flash remoting, coldfusion and dreamweaver. Thanks.