Alternative to Event Structure

Hi,
I am an EE intern creating a testing program for an antenna pedestal.  I am using LabVIEW Base Version 11.0.1.
I am using an LV-Link VI provided by an example from the download for the Data Translation 9836 module that my company is using.  Currently, I have an array correctly storing data when the user presses the "Start/Stop" button for the first time.  I am working on the section of my VI where I prompt the user to "Save Data to File?" so that I can make the VI either save the data when the user clickes "yes" or stop acquiring data and not saving the data when the user clicks "no".
My current problem is that in my implementation, when the user clicks the "Start/Stop" button for the 2nd time to stop acquiring data, the user prompt will continuously come up because the "Start/Stop" button is in a false state as long as the button is "unclicked", and will remain that way until the user clicks "Start/Stop" again.  I do not have the event structure at my disposal because I only have LabVIEW Base which does not include the even structure(I did give a kudo to whoever was suggesting that the event structure be put into every level of LabVIEW).
I saw another thread with a similar problem here: http://forums.ni.com/t5/LabVIEW/Simulate-event-structure-in-LabVIEW-base/td-p/1008900, but I am having a hard time understanding what exactly is going on since I just learned all of the basics and am figuring out LabVIEW as I go along.  If someone could help me simulate an event-structure-like situation in my VI that I have attached, it would be greatly appreciated.
Thank you,
Aki
Attachments:
Compact Range Controller.vi ‏43 KB

At the moment, the code is still way too scattered. I meant one of multiple states of a state machine. From the current code, I cannot really tell what you want.
Maybe all you need to do is delete the orange wire in the FALSE case of the upper case structure and make the output tunnel to use default if unwired. (but make sure you don't lose the data).
Attached is a quick modification that gives you another additional true whenever the button changes. Used it to either clear the array or execute the "save" case once. 
LabVIEW Champion . Do more with less code and in less time .
Attachments:
Compact Range ControllerMOD2.vi ‏37 KB

Similar Messages

  • Event structure-Plese help

    I have made a GUI for communcation between two pc with various parameters.
    I have used an event structure for 1st PC because i have 3-4 parameters which i want to run as i press the boolean on front panel.
    However my problem is suppose I press the 1st boolean, I want the 2nd pc to receive and respond that data has been received. And since there are 3-4 parameters, i will have to use event structure for 2nd PC too. But there will be no one to control front fanel of 2nd PC.
    So, how do i do it. Any alternative to event structure in which it resoponds to data recieved and not on user input.
    Thanks. 

    In my experience with serial communications, you will want a loop for nothing but reading from the port.  You can use a global or a Notifier to tell this loop to stop.  You will want a second loop for GUI and message handling.  So I encourage the use of the Event Structure here, using User Events to send the commands/data to this loop.  Then you will want a third loop for sending commands through your serial port.  Send the commands/data to this loop using a queue.
    So the process will go like this for PC-2:
    1. Read command through serial port.  Serial Read loop sends this message to GUI loop via User Event.
    2. GUI loop processes user event, does whatever is needed, and sends the response to the Serial Write loop via a queue.
    3. Serial Write loop reads the message to send from the queue and writes it through the serial port.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How do I get the reference numbers for cursors in a waveform graph (other than through an event structure)?

    I want to control cursors in a waveform graph programmatically.  I've tried using the "Cursor list" property, modifying the cursor clusters and writing the results back to the cursor list property, but this only works sporadically.  Modifying the cursors by ref number works well, but you have to get the refnumbers  from an event structure during a cursor event.  Is there any way to get cursor reference numbers aside from through an event structure?
    Thanks!

    Hi barryinbo,
    On the controls pallette, go to refnums> Control refnum>Control. Then right click the refnum and point to select vi server class>Generic > and you will see a cursor there. This will be a "loose typed refnum" but you can right click the refnum to include data type. An alternative is to drag a cursor to the refnum, this will make it strict typed.
    Hope this helps
    Chris Co.

  • While loop with stop button within event structure locks up front panel.

    I am not sure if this is a bug with my program or a bug within LabVIEW.  If you believe that this is a bug with my program then I will post my program to be looked at.
    The problem I am having is there is a while loop within an event structure that fires when a particular value changes.  Once the "Activate" button is pressed the while loop within the event structure starts going with a polling frequency of 1hz (1000ms wired to the "wait till next ms multiple" vi).  There is a "Deactivate" button that is wired to the stop control of the while loop and an outter while loop that resets the event structure so that the activate button is being listened to again.
    Once inside the while loop, however, none of the button are responsive within the front panel.  The VI continues to run, and only 60% of my CPU is being consumed, but none of the button or scroll bars work.  The only way for me to terminate the program is with the "Abort" button next to the "Run" button.  If I remove the event structure so that the while loop in question runs as soon as the program starts, the front panel remains responsive.  I've inserted probes within the while loop and verified that it is not running prior to the "Activate" button being asserted, and it is running after the assertion of the "Activate" button with the expected polling frequency set by the "wait till next ms multiple" vi.
    Can anyone help?  Do I need to post my code?
    -Nic

    It is typically not a good idea to stall an event structure by placing loops inside event cases. What good is an event structure if it is not free to repond to events?
    Have a look at some alternative solutions, such as in the following link:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=224817#M224817
    LabVIEW Champion . Do more with less code and in less time .

  • Calling an event structure via a LED?

    Can I call a case in an eventstructure via the value change of a LED?
    The reason for this is the following:
    In my VI is a xy graph and the update of the dispaly and the x-scale takes a lot of time, so I would like to do the update outside of my main-loop to avoid that other processes get delayed. The attached VI is just an example.
    (In my real VI, I have a consumer and producer loop and lots of data processing, so in that case the disply update should not interrupt the data processing.)
    I tried to put the x-scale update in the event structure and call the event structure via the change of a boolean value, but that does not work. The event is not recognised and the x-scale does not change.
    Johannes
    LabVIEW 7.1
    Message Edited by johanneshoer on 11-11-2009 08:20 AM
    Greetings Johannes
    Using LabVIEW 7.1 and 2009 recently
    Attachments:
    Chart Test 16.vi ‏146 KB

    johanneshoer wrote:
    I don't understand. What do you mean by "resize index array"?
    Here's one example. Your code is on the left and uses two "index array" nodes. All you need is one, configured for two outputs.
    Also, of you want consecutive indices, starting at zero, you don't need to wire the index inputs.
    An alternative is shown on the right.
    Message Edited by altenbach on 11-11-2009 12:06 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    resizeindex.png ‏7 KB

  • Can you share FP Controls between different Event Structures

    I'm creating a program that will either read real-time data from an VNA on the GPIB bus, or read a saved s2p (Agilent) file and analyze it. The FP consists of 5 graphs, and various controls which handle events like printing, changing filters, or exiting. on the BD I have a case structure controlled by an operator selection pop-up. I tried using the same FP controls in the event structures I have setup in each case, as only one event structure would ever be executing at any given time, but the program doesn't seem to like it ast run-time. I've worked around the issue by creating "duplicate" controls and using the property setting to make them visible/disabled, etc., but the is seriously congesting my BD.
    Anyone know a way to share controls with seperate event structures?

    It sounds like the root problem is the overall structure of your program. I highly recommend that you check out the Queued Message Handler project template in LabVIEW 2012, that will show you how to utilize a single event structure and pass events to a consumer loop. If you program is too large to consider an architecture change at this stage of the game, then there is a workaround for your problem.
    What is most likely happening is that you have the event structures all set to lock the front panel until the event completes. However the case structure that you have wrapped around these event structures is causing all but one of these event structures to be unreachable thus preventing you from handling the event. Again, as I stated above, the "RIGHT WAY" to fix this is to select a better program structure but the "kluge work-around" fix is this: Dynamically register for the value change event on all of the controls you are trying to trap events for. Dynamic events can be deregistered and re-registered at run time. This will allow only the event structure in the active owning case structure to be registered for the events, thus no other event structures will get in your way.
    Disclaimer: This advice is given based on very minimal information and a great deal of speculation and may not be correct. Please include your code if you need further assistance.
    Charles Chickering
    Architecture is art with rules.
    ...and the rules are more like guidelines

  • Daqmx "Done" event not triggering event structure

    I would like the user to be able to abort my daqmx task by pressing a button.
    I am attempting to use the method in this VI:
    https://decibel.ni.com/content/docs/DOC-15815
    It utilizes an event structure with the daqmx Control Task VI to abort.
    The example VI above works for me, on my system with my USB-6356 device, as expected.
    When I attempt to incorporate the same method into my VI it does not--despite having an identical arrangement, so far as I can tell.
    I believe that my problem lies with the event structure, and the dynamic registration.  I am unfamiliar with this and must be using it incorrectly.
    I have attached my VI, though it is cumbersome.  The code which I am struggling with is in the "Acquire" case.  As far as I can tell, I am doing exactly the same this in this particular case as in the example mentioned.  Yet in the example, the event structure completes, or aborts, whatever you want to call it, right after the "Wait Until Done" VI executes.  In my own VI, the "Wait Until Done" and "Clear Task" VIs execute, but the event structure does not register it.
    Here are my specific questions: is there anything extra or special that one must do in order for the Task to properly trigger a "Done" event and pass through the event structure?  At what point is the daqmx task "Done"? 
    thanks,
    Matt
    Attachments:
    BoomTubeMain.vi ‏175 KB

    natasftw,
    My event structure is identical to theirs; what you are seeing are the two different cases that exist in the event structure.  In both the example and the VI, there is a <task out>: Done and a "Dynamic Event": Value Change.  In the dynamic event case, I have my abort button and relevant code--this I believe is the code you were referring to, which you thought I was missing...  Regarding my multiple event structures, they should operate completely independently as they respond to different events.

  • Stop execution of a loop in an event structure

    I tried searching the forums to avoid posting a duplicate, but most I could not open most of the vi's as they were higher version.
    I put in a dummy while loop in an event structire i intend to use. Once I start executing the while loop, I am not able to stop it using a control for some reason from the fornt panel control.
    I am not able to change the vale of the Stop control at all. I tried creating a seperate event for STOP, and I still could not stop the program when the While loop was executing.
    I imagine I am missing something really small. I would appreciate your feedback on this.
    Thanks,
    Nevil
    Solved!
    Go to Solution.
    Attachments:
    FrontPanel.vi ‏34 KB

    Right click on the event structure and choose "Edit Events" for the case that is giving you trouble.
    Be sure the checkbox to lock the front panel is unchecked.
    I suspect yours is checked, so your front panel is locked out until the event completes, thus you can never stop your loop.

  • Event structure in Sub VI

    Hello ,
     I have a developed a program which captures video and user can save images out of it. I have used .NET reference to handle the video part, and the VI is attached in this post. Now i have to make this VI as a sub VI and running this from Main VI. I tried creating event structure in Main VI which i used in sub VI , still i could not suceed. Kindly assist me in this regard
    Solved!
    Go to Solution.
    Attachments:
    Webcam-Control-Projekt-mit-Reference-Design-2013_original.zip ‏286 KB

    Hello Michael,
     I have attached a model in which Main VI calls the Sub VI using Event Structure. Two events can occur in Main VI and their corresponding event Structure is called in Sub VI using Register events. When i run this VI the out put is fine some times but other times i need to trigger event many times before i can see its effect in Sub VI, my doubt is that Register events are reliable, whenever (during the execution of LV) if event occurs will surely its code in the sub Vi gets executed?
    also I have put a indictor(numeric) in the SUb VI which i connect back to Main VI, when i run, i can see the result only in the sub VI not in the main VI.how to see in Main VI?
    I have used the this model (which is attached ) to implement my project(which i already mentioned) . one switch for starting the video and other for recording the image. The video is getting started with out any trouble, but imgae is recorded only few times when i press the button which is for image recording, most of the time second event fails to get executed. Also there are difference in output when i run with and without "Highlight execution", why this happens, is this because of Reg events?
     any more info if required let me know, i will provide.
    Attachments:
    Main_sub_VI.zip ‏18 KB

  • How to make Vi file as input file in Event structure?

    Hiii All..
    i got problems when to construct a event structure. The file input  (vi format) doesnt have source of wire connection to conect the wire (shift register) .For your information the vi that i create only contain simple mathematical equation.
    I already study the New Event Handler Example. but the file input for that example (acquire data.vi) have a source of connection. anyone can help me? 
    thank you very much
    [email protected]
    Solved!
    Go to Solution.
    Attachments:
    TOTAL.vi ‏18 KB

    Well, in your subVI you do need to wire up some inputs and outputs to your connector panel.  As I said, a basic LabVIEW skill that you will find in the tutorials.
    You have a number of inputs to your subVI.  More than you would want to attach to a connector panel.  You should perhaps use a cluster to group them together.
    To get you started, here are the steps to connect a control or indicator to the connector panel.
    1.  Open subVI.
    2. Right click on icon at upper right.  Show Connector.
    3.  Hover over a block you want to be a connector terminal, it will change to a spool of wire.  Click.
    4.  Go to the control or indicator on the front panel that you want to associate it with.  Click again.
    5.  Repeat as needed for other controls and indicators and save your subVI.  Now the subVI instance in your main VI can have wires connected to it.
    You should plan your connector panel so that controls are on the left side of the panel, and indicators on the right.  This will allow data to "flow into" and "flow out of" the subVI in a normal looking left to right orientation.

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

  • 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

  • How to use an Event Structure responding to an image control that belongs to a parent VI.

    Hi
    I am loading a subpanel vi by pressing a button located in the user interface of the main vi which also contains an image display. Subpanel vi opens up on the side and doesn't hide the image display of the main vi. Subpanel vi contains an event structure that needs to respond to user clicking on the image display of main vi.
    Since the bug that occured while creating an image reference control isn't fixed, I am passing the main vi pane reference onto the subpanel vi. From that point I've tried to edit event structure and have it respond to the image control/pane that belongs to main vi but I don't know how.
    Any help would be appreciated.
    Thanks

    Post a screenshot of your subVI code where you register the events.
    André
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)

  • Event structures used to monitor indicator change

    I am new to the event structure.
    Is it possible to monitor an indicator for a value change?  I know this works with controls, but I'm not sure you can monitor and indicator in this way.
    Thanks,
    -Nathan

    Yes, it's possible. However, in order to change the value so that an event will fire, you'll have to use the value(signalling) property of the indicator. It won't work if you simply wire a value to it.

Maybe you are looking for