LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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.
0 Kudos
Message 1 of 3
(3,009 Views)
Why are you using an event for the camera?

I might suggest posting your code (or a screenshot of the diagram at least) so that we can better understand what you are trying to do, and make suggestions from there.

Off hand, it seems to me from your description that perhaps you are overusing events.

I do know that while an Event structure is executing, that it will queue events. You have to deal with them programmatically. This similar to the getchar function in C. It takes in a character, but only after the carriage return is pressed, which is queued. The next iteration of the loop will see the carriage return picked up. You have to anticipate and work around unplanned events.

Good luck.
0 Kudos
Message 2 of 3
(3,009 Views)
> 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
0 Kudos
Message 3 of 3
(3,009 Views)