Start stop event structure queue

Hello,
I would like for the attached vi to start logging/displaying data when the Start button is pushed, not when the VI starts. So I did some research and was led to the Event Structure (this is my 1st time using an event structure). I have been trying all sorts of things over the last few hours so what I have now is probably somewhat convoluted, however, my latest error is that my dequeue is receiving an "invalid refnum".
Could someone guide me on what I am doing wrong?
Thanks.
Solved!
Go to Solution.
Attachments:
InitFile.vi ‏20 KB
CNAP Daq Event Structure.vi ‏109 KB

Hi Nouse,
I had some free time and was bored so took a look at your vi for you. You was on the right track, had started with a good architecture which is half the battle, just needed some fine tuning:
I took your code and added it to this. All that i have taken out is the Sub vi's that get your data, i replaced this with a random number just to see some data on the wavechart and also being logged in your file. A point to notice is that your 'CNAP INIT FILE' vi has no error cluster propogation. If you run this subvi and there isnt the 'C:CNAP\' Directory (As there wasnt on my computer at first) the 'OPEN File' vi errors and halts the program, as you have no error propogation or handling in this vi you cannot handle this error.
I changed the vi slightly and added a 'Start' 'Stop' and 'Exit'. This allows you to start acquiring/logging data, stop (without exiting the program), restart acquiring/logging or exiting the program. A point to note is that if you do 'Stop' and then 'Start' again, relatively quickly your 'CNAP INIT FILE' Vi will append a previously written file, which is fine, but it will also send out a new start time. So your readings in the same file will start from 0 time. You may want to catch this and not update the new start time if appending an old file.
I have attached the VI in both LV2009 and LV8.6 as you never stated your version.
Hope this helps,
Rgs,
Lucither
Message Edited by Lucither on 03-27-2010 03:32 AM
"Everything should be made as simple as possible but no simpler"
Attachments:
Data Logger VI 2009 and 86.zip ‏229 KB

Similar Messages

  • How to start/stop Event Mgr. and RFID information server?

    I take over our form RFID admin (who quit) position.
    I cannot find any document which tells me How to start/stop Event Mgr. and RFID information server.
    Even the "Sun Java System RFID Software 3.0 Administration Guide" does not have this piece of info.
    Would you please help? Points guaranteed. Thanks!

    Ashley you are still not clear to me.
    Please mention what applications are these??
    Is it SAP Event Manager??
    What is the RFID Information server??
    Is it SAP based, or some other vendor??
    How is the integration done?
    Thanks

  • Strange problems about my projects(efficiency,event structure,queue)

    hey,guys,i am a labview user from china,so forgive me about the chinese words of my projest. i found something wrong with my work. .
    there are two functions in my "While loop", the first one depends on "queue" and  is to get information from UART, the second one is "event structure" to send information through UART. my problems:
    1. i can not stop while loop by pressing "停止“, and i find two ways to stop it. first, i press"停止”,then, i press any buttons that can trigger "event structure"twice, at last, while loop can stop.the second way, i press buttons for "event structure" one time, then "停止”, and then the same button for"event". it also works
    2.my work does not run efficiently. you guys can try. once you press buttons for "event structure", it responses very slowly,and if you press many times,the whole program seems like suspending.i have added a LED named test at the front panel, it should light once you press "运行“. and it also shows how slow the whole program is.
    i have attached my work, and my main vi is "串口通信 主VI".
    can any body give me some suggestions? thanks a lot
    Attachments:
    Uart.zip ‏140 KB

    Your event structure will execute exactly once per loop of the main loop, thus the other three loops must stop before handlig the next event. You will also get a race condition between the top loop and the events when writing.
    I'd put the top loop as the timeout case in the event and place the loop around the event for starters.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • Conditional stopping event structure

    Hi all
    Attached is my Vi , I want to stop the event structure in loop 1 , from the loop 2 which is continously running in parallel and getting digital input from a DAQ device.
    whats happening is first I am checking the status of teh digital input and then on that I am excuting the true structure. once I am in the True case , an event structure for user operations and a parallel while loop is used to monitor the digital input , what I  want to do is as soon as the digital daq input is low again i should be back to my fasle case in the main loop but the loop 1 with event structure is not stopping.
    help
    regards
    Regards
    Attachments:
    Untitled 1.vi ‏12 KB

    Snamprogetti wrote:
    You can't put an event structure into a case structure. It will run even if you are in the other case.
    See http://forums.ni.com/t5/LabVIEW/An-event-structure-can-freeze-the-front-panel-even-if-not/m-p/106629...
    What then, is a queued state machine? . The issue is the event structure still queues your events whether or not you are in your "idle" case. So if you don't promptly return to your idle case, events can back up in the event structure causing your program to act like it's lagging. Setting a busy cursor can help to solve this problem. I felt this should be clarified because a properly set up queued state machine is very powerful. This obviously isn't the solution for the parallel loops here but I thought I should add to your point..
    CLA, LabVIEW Versions 2010-2013

  • Unable to stop event structure manually

    Hello,
     I have a fully functional State machine program to control a stepper motor.
    However, I face a problem where I am not able to break the program inbetween execution by clicking the stop button for while loop MANUALLY.
    I dont know why it cannot exit upon User input.
    Abhilash S Nair
    Research Assistant @ Photonic Devices and Systems lab
    [ LabView professional Development System - Version 11.0 - 32-bit ]
    LabView Gear:
    1. NI PXI-7951R & NI 5761
    2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021
    OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
    CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
    MEMORY - [ 16.0 GB RAM ]
    GPU - [ NVIDIA GeForce GT 530 ]
    Solved!
    Go to Solution.
    Attachments:
    Motor-UNI_Directiona Dev 3.vi ‏53 KB
    Control 1.ctl ‏6 KB
    Control 2.ctl ‏6 KB

    Uggh. I typed a response here to your note but NI website timeout kicked me out and I lost everything I typed.
    What RavensFan mentioned is shown in attached image, you have to unclick that option on every case of your events structure so that it doesn't lock up the front-panel.
    But more importantly as Lynn and other folks mentioned, you have a bigger problem with your design implementation.  My previous example was to show how a state-machine based design can be made clean/small/efficient/etc.  I have two 30" monitors on my Mac and your block diagram extends well into my second monitor!! :-)  (I'm a bit of a neat-freak so I like making things look nice/wires laid out properly/into straight lines, no unnecessary wires crossing/etc - all that makes it easier for yourself and others to see the design.)
    Sorry, back to the main point - you should definitely follow Lynn's advice on using Consumer/Producer (events) model - a simpler start would be to separate out your events structure into its own while loop that runs parallel to your existing loop.  With that, at least you will execute events structure at a regular interval.  Another strong advice is to simplify your design so that you don't use nested (one-inside-another) state-machine design. I have decades of LabVIEW experience yet I stay away from that kind of complication because it only causes more problems as you grow your design. Why not just add more cases to your existing state-machine design rather than adding a nested state-machine structure inside it?
    -DP
    New Controls & Indicators made using vector graphics & animations? Click below for Pebbles UI
    Attachments:
    Untitled.png ‏75 KB

  • Stop events structure

    Hi all!
    Here I am! I'm using a events case in a while loop. The problem is that
    I should press twice on the stop button to stop the while loop...WHY!!!
    That my question...I set Switch when release for my stop button...(I
    must use a local variable of it...) Now, I can't stop my VI it seems
    that the value of my Stop booleen must be read before the while loop
    begin...then, when I press once my Stop booleen, then, it stay at true
    value, end it seems that the while loop start an other time...So, I
    press the control again, and the Vi stop correctly...( By closing, I
    send a false value to the stop booleen, to recover a ready to use
    control Like a latch mechanical action...)
    Now there is the problem...To figure out where is the problem,  I
    highlight this...and now,  I got no problem! each time it is highlight,
    my VI stop correctly, but in normal mode, I should push twice on the
    control to stop it...Is it common? Do you know something weird with
    event case? By the way, I need to have an event case with no time out,
    because I use some shift registry each time I make an event action...
    An other weird tings, is when I recreate the "same" thing in an other
    VI, Or even I copy paste the inner part of my VI in a brand new VI, it
    working...
    In addition, I can't send you an example, because it is a part of a
    very huge program...(So I should send you too many subVI and special
    driver...So...)
    Nevertheless, I took a picture
    Thanks for help this...
    Fakstory
    Attachments:
    Doc12.doc ‏77 KB

    Look, if you only attach a picture, we can only comment on what we see!
    The main diagnosis ("race condition"!) has already been mentioned. The point about the event structure inside a case structure is serious and could possibly cause problems like you observe, but it is not possible to tell from the picture for sure. Your picture shows very little, but what it shows does not make sense. I just pointed out the two most glaring observations. Since you say yourself that you are a noob, such comments can help. A program that is clear and does not contain unecessary things is much easier to debug.
    Typically, the quality of the answer cannot be better than the quality of the question. You don't provide enough details and the image you posted is useless to pinpoint the problem.
    Analogy:
    You don't bring a picture of your motor to the mechanic and ask why the car does not start. Unless the picture show that the motor is missing or on fire, nonbody will be able to tell what's wrong.
    All we can say for sure so far is that have a race condition. Provide some code (even broken) and we can give a more detailed analysis.
    LabVIEW Champion . Do more with less code and in less time .

  • Copy event structure

    Hi,
    I use LV DSC RT 8.2.1
    Why can't I copy&paste an event structure together with his events specification (to the same VI)?
    (I can create a copy of an event structure but his events specification are blank)
    Is there a way to do it ?
    Amitai Abramson.
    Solved!
    Go to Solution.

    Amitai Abramson wrote:
    do you have a solution ?
    Never hide event structures inside case structures. Event structures queue up events even if they are not in the datapath. Also, by default event are set to "lock the front panel until the event completes" (you can change that, but why would you?).  Since you fire an event that is not in the datapath, the event can never complete and the front panel will be locked forever!
    You also need an event for the stop button. This way you don't need to needlessly spin the loop via the timeout event.
    Here's a quick draft, modify as needed.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    EXAMPLE2_MOD.vi ‏13 KB

  • Event structure and automatic queueing of events.

    I have found out the long way that the event structure queues all the events taken place while it has been executing yur most current event.
    In other words... I understand why the locking of the front panel is an automatic option that is selected. As it will prevent you from queueing more events,  and causing yur program to execute endless event structure runs, when you wanted it to stop 15 button presses ago.
    case in point.... is in this simple VI i attached.
    My question is ... is there a way to turn off this automatic queueing of events??
    Attachments:
    EventStructureHUH.vi ‏53 KB

    Well ... the problem for me... was, for example, in the VI I posted....
    The OK button in the VI I posted, has an event triggered to it in the event structure.... So when I enter that loop after hitting the enter loop button... it registers those OK clicks...
    Say the OK button and NOT the continue button takes me out of the little loop and back into the big loop. Now, after leaving the little loop and entering into the big loop, I will immediatly enter back into the event structure to handle the OK button click.
    Basically I wanted one button to control the termination condition of the little loop, but also have an event in the event structure associated with it, so basically one button to exit the little loop AND the big loop.
    I hope Im making sense. I found a solution, by just making two buttons, when entering into the little loop, the one button dissapears... and vice versa when entering into the big loop. So to the USER it appears like ONE button... but in the code its actually two.
    I just wasnt sure if there was another way around it... it was tough to figure out what was really happenening in my code... took my about an hour or two to track down.
    EDIT: Yea.. thanks for the reply....  as for the comments in my code... yea, I get a little crazy towards the end of the day... after 6-8 hours of straight labview programming. 
    Message Edited by MJBrehm on 06-30-2006 02:21 PM

  • Event structure in sequence structure troubles

    Hello, for class I have to write a simple LabView calculator but I'm having some issues. This is my first taste of labview so I know the code isn't the best but I just would like to know what's causing my hang up. I have two similar event structures with in a sequence structure. When I run it it goes through one loop of the while loop and then hangs, I tried stepping through it but can't figure out where it goes. If I don't have the second event structure it works more or less fine. Been working on this all day and hit this wall. Thanks.
    Attachments:
    lab1_3_try.vi ‏132 KB

    You cannot have two event structures like that. Event structures queue up events, even if they cannot react to them because of dataflow. Your second event structure will also queue up all the events, but cannot execute them because it is not in the dataflow. In addition, your events are configured to lock the front panel until the event completes, and since some events can never complete, your panel is locked up forever.
    Don't duplicate code twice, just keep state (A or B) in a shift register and do everything in a single event structure in a single loop.
    What prevents you from hooking up the numeric terminals and buttons? Try to eliminate all these local variables keep the data in a shift register instead. Place each button terminal inside it's assiciated event and make them latch action. Now you can use "value changed" events instead of "mouse down".
    LabVIEW Champion . Do more with less code and in less time .

  • Labview event structure

    hello
    can anyone tell me why the terminal shown by circle 1 at the start of event structure is showing different from the circle 2 at the end of event structure
    thanks
    Attachments:
    event.jpg ‏59 KB

    This is a tunnel that has enabled the option "use default if unwired", this is the default option when working with the event structure.
    http://zone.ni.com/reference/en-XX/help/371361G-01/lvscript/conditionaltunnel_use_default_if_unwired...
    Jonathan Cruz
    CHALLENGER
    K U D O S __ B I E N V E N I D O S

  • Re-triggering event structures after queue purged

    I have a vi built with an event structure that allows the user to stop the tests.  I am using the flush queue subvi in the producer loop to remove the remaining elements.  Then the user may fix the problem and again press start, starting the tests all over. 
    About 50% of the time, the event structure will not restart, and the vi will need to be stopped and re-started. 
    There must be something I am missing that is not allowing the event structure to re-start. 
    Is the position of the flush queue correct in my snippet?  
    What could cause the event structure to not respond and how can I troubleshoot it?
    Thanks.
    metzler CLAD
    Attachments:
    producer snippet.png ‏56 KB

    You should take more care about your error handling. Propably you just miss the errors that cause this behavior.
    * At the while loop, use shift-registers for the error wire.
    * I also recommend you to place a case around the event structure that catches errors and stop the loop.
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml

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

  • Can I get the event structure to NOT queue events?

    I was wondering if it is possible to have the event structure not queue events that happen while the vi is executing code associated with another event. Basically, I have a toggle switch that, when "on", captures a live feed from a camera and displays it to the screen. This is done in a while loop that executes until the toggle switch is turned off. At this point, that event is done and the vi returns to the uppermost level of the event structure and resumes looking for events. The trouble is that the whole while the video capture was happening, the event structure was queueing events that were occuring during that time when the user was hitting other front panel buttons that had their own event associated with th
    em and would not execute at that time. When the video capture toggle is turned off the event structure then executes any other events that were queued during that time and I don't want it to. I can't lock the front panel while the video capture is happening so the user can't push buttons because they have to be able to push the button to turn the video capture off. Any suggestions? Thanks in advance.

    > I was wondering if it is possible to have the event structure not
    > queue events that happen while the vi is executing code associated
    > with another event. Basically, I have a toggle switch that, when
    > "on", captures a live feed from a camera and displays it to the
    > screen.
    I think there are lots of other articles about this on devzone.
    To summarize them, the key is that the event structure intentionally
    synchronizes events with diagram execution. The typical way to do what
    you want is to have the event start up another loop or subVI running
    asynchronously.
    Usually there ends up being one loop with an event structure in it.
    Another loop that executes a statemachine, possibly as simple as just
    two states of acquiring and not. Use the events to pr
    od the other loop
    between states via locals, globals, occurrences, etc.
    Greg McKaskle

  • How to stop While Loop in Event Structure with same button?

    Hello,
    I have a problem. I want to use one control to activate an event in a event structure, and the same control to terminate a while loop in that event.
    It is possible to use 2 controls to do this, but I need it to be only one.
    Thank you  
    Message Edited by Heinen on 02-19-2009 06:16 AM
    Message Edited by Heinen on 02-19-2009 06:20 AM
    The Enrichment Center is required to remind you that you will be baked, and then there will be cake.
    Solved!
    Go to Solution.

    Hello,
    I have a bit different problem.
    I have a tab control, with several buttons on different pages.
    In the current situation, we can talk about two pages, where one page ("Settings") in the Image, has a START and EXIT button, while second page ("Wait") has an EXIT button.
    In a while loop, I have event structure, which handles events of the START and EXIT buttons of the Settings page. This is fine. But I also want to control the Exit button of the Wait page.
    The control works like this:
    When I click on Start in the Settings page, the front panel shows Wait page and attempts to connect to a datasocket server on the remote computer. If the user wants to stop this process, he can click on Exit on Wait page too. But, this doesn't give any immediate effect. On the even of Start button, the front panel is not locked, so the user can actually click the Exit button on the next page when it's visible. But it's of no immediate effect. Means, what the LabVIEW does is, finishes the execution of event in Start button's click, and while this executes, it doesn't consider the Exit button's refreshed value (shown in Red circle in the block diagram).
    Simple question: Is there any way to check the updated (latest/live) value of a control during some event's execution? Or if I write an Event "Value Changed" for the Exit button and pass it to some variable. Is it the only solution?
    Thanks ahead.
    Vaibhav
    Attachments:
    terminate event_diagram.jpg ‏200 KB
    terminate event_front_1.jpg ‏63 KB
    terminate event_front_2.jpg ‏63 KB

  • Which is the best structure for start/stop data logging?

    Hi everybody,
    hope I can explain my problem good enough that anyone can help me:
    I have a VI which continuely shows on a graph the voltage of a Analog Input of a DAQ device. Now I want to allow the user to start/stop with a click on a button data logging. Means that a second loop writes to a selected path every ms the data to a spreadsheet file.
    At the moment my VI works like this:
    You run the VI and Labview asks you one time for the file path, then you can start and stop the data logging. But you can do it only one time. If you want to log a certain time later another file, you have to close and open the whole VI again which is not very professional...
    My target is:
    It is onlyl necessary to start the VI one time. Then you can select a new file path, log data, select another file path, logging data again....and so on...
    Which programm structure is necessary, can anyone help me as a labview beginner with that issue? I attached the VI if someone just wants to edit that...
    Thank you for your help!! Markus
    Attachments:
    Logging voltage.vi ‏93 KB
    screenshot.JPG ‏98 KB

    @NaruF1 and GerdW
    you are right, there is a mistake, both loop rates should be the same (10 ms) :-)
    @NaruF1
    yes you understood correctly that the file dialog should appear every time the user wants to start writing a new log-file. The voltage we measure is a analog signal, so there will be several interesting periods we want to save for a later analysis in Excel.
    To your 2nd point: if it works with a array it will be fine. But it must be possible to log data for lets say 5 minutes, so the array won´t be too large? (5 min @ 10  ms loop rate will be 30000 rows..
    attached is the VI, saved as LV2009..
    Thanx a lot!
    @GerdW
    ..you ask why I didn´t create a structure like you recommended with notifiers or queues? The simple answer would be that I am not familiar with all this.. just began to write my first Labview programm. I will have al look to the LV help with all that stuff... Thank you a lot
    Attachments:
    Logging voltage.vi ‏80 KB

Maybe you are looking for

  • Plans for enhanced access controls inside of workspaces?

    Hello, Are there any plans to do the following, Provide 'participant' role to most documents inside of a workspace, while and also granting 'viewer' role to same person for a few files in that workspace? Provide the ablity to assign 'viewer' role to

  • Techniques Needed To Create The Following Nice Looking Look

    I saw the following nice looking tool tips, created using JavaScript JQuery Toolkit. I was planning to implement a similar look in my Java standalone application. I was wondering what is the techniques needed to create such effect? [http://sites.goog

  • Customize live authentications dashboard

    Hello, is it possible to customize the live auth dashboard to see only the failed authentications? Also is it possible to extend the view and to see the last 100 failed authentications? The filters one can apply to the live authentications dashboard

  • Application to download Internet Explorer

    I am trying to work on a website that says it is only supported by IE 6 or above. I tried to download it, but it said I needed to choose an application to do so. Is there one I should use? I also remember hearing something about IE no longer being su

  • Logging DSL downtime using SNMP.. HELP!!!!

    Our office has been having a ton of short lived DSL outages which is causing havoc for our developers. The general manager has asked me to write a tool to monitor our internet connection and log whenever the DSL goes down and how long the outage last