LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structures??

Hello!

Thank you all for your help 🙂 I will try to read more about this eventstructure 😛 *smile*. There is just the simple case that I want to start an event when I push a button in my program. That´s it :-). Maybe the problem is that I have while-loops inside the eventstructure? Best regards and once again, thank you for your help!
0 Kudos
Message 11 of 17
(1,242 Views)
Hello!

I feel guilty now when I do not get how to do things. But I try to explain it: I have a program that read a textfile and write it out on the front panel. Now I want to have this in an eventstructure. This event shall happen when I press the button "load textfile". But when I do as you told me to, add event case, then there pop up an empty eventstructure where I are supposed to write in what will start the event. But the event that I want to start is in the eventstructure that is there from the beginning when I drag the eventstructure in the program. This is a question for me, but it is probably because I do not know how to do with the eventstructure :-/. Best regards.
0 Kudos
Message 12 of 17
(1,510 Views)
It is still unclear as to exactly where you are having a problem with the use of the event structure. You have been given some good advice on the use of the event structure but it still appears that you are having a problem. The "step by step" instructions that becktho gave you would appear to answer your question. You need to have the "load textfile" button on the front panel as the event source. You need to have your code to write the file (or preferably a queue sending data to the code to write the file) inside the event structure in the appropriate case. The Timeout event is a default event and will execute after the timeout (wired to the timeout terminal on the event structure) has been reached unless this event has been removed from the structure.

If you could attach your code so that we can better see what you're trying to do perhaps we can be of more help. Event structures are really quite useful and easy to use once you understand them.
0 Kudos
Message 13 of 17
(1,476 Views)
This seemed like a proper place to post more questions on Event structures. So lets continue the discussion.

I seem to be having some difficulty with them myself. I feel I know what my issue is, but Im not sure how to resolve it, or maybe it's more the fact I am unsure how event structures work under certain conditions.

I believe my first problem is that I have more then one even structure in my program. The event structures are in seperate while loops, and are for controlling different aspects of the program. My question then is, if an event registered to a event structure outside my current loop is called... does labview stop everything and try to enter into that event structure? Even though that structure is outside the current loop?

It seems my program will hang up when an event is registered that a seperate event structure handles outside my current loop. So am I correct in saying that it doesn't matter where that even structure is in your program, it will still read and register events?

I tried to select that option that states NOT to lock the front panel on certain Event structure calls... but all that seems to do is allow me to operate the GUI without any functionality.  Am I wrong for having multiple event structures in one program? Or do I need to take more caution in making sure I do not register events that structures elsewhere in my program handle?
0 Kudos
Message 14 of 17
(1,083 Views)
You can have separate while loops with separate event structures. First, if you have two separate while loops, both loops are "current" so both will run and process events at all times. You have to make sure that the events in loop 1 are not the same events in loop 2. If you have an event in one loop that might take some time to run, you have to make sure that the front panel is not locked until the event case completes. I don't think that placing functions that take a long time to execute or nesting other while loops in an event is wise and I think it's simpler to have only one event structure per VI. If you need separate while loops, you can use a single event structure and use queues/notifiers/occurences to control acquistion/analysis/file i/o etc in the other loops.
Message 15 of 17
(1,076 Views)
yea.. I have yet to dive into notifiers and queues... but that will most likely be my next course of action... thanks
0 Kudos
Message 16 of 17
(1,066 Views)

Hello!

 

The design you are using as for now will work fine but is not that common since you usually use one of the methods Dennis mentioned in other words queues or notifiers and similar techniques.

 

Notifiers are used in the Master/Slave design pattern and queues are used in the Producer/Consumer design pattern. There are different techniques that allow you to send various data types with queues and notifiers.

 

LabVIEW Intermediate I course describes different design patterns among other things and you can read about the course here:

 

http://www.ni.com/pdf/products/us/lvintIout.pdf

 

 
Regards,
Jimmie Adolph
Systems Engineering Manager, National Instruments Northern European Region

0 Kudos
Message 17 of 17
(1,044 Views)