LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel event structures possible?

I have two instruments that I want to be able to control compeletely independently, a CCD and a translation stage.

So inside the main program while loop, I put two event structures (yes, I set the time out on each to a few milliseconds, and made sure each event handler does not lock the front panel).

When one event structure is in a loop, it holds up all the events for the other event structure, then they all get executed AFTER the loop in the first event structure is finished.

Why can't these work independently in parallel? Is there a command to force labview to handle any built up events in the queue and then carry on?

(Similar to the concept of forcing windows to handle any windows messages that occur in a big l
oop without explicitly having to create a "worker thread".)

Attached is a simplified version of what I am trying to do that exhibits the problem.
0 Kudos
Message 1 of 3
(5,386 Views)
You have two event structures in one while loop. Both event structures must complete before the while loop repeats. So, if one event structure is busy executing code and the other times out, neither will get a shot at a new event until that first event structure stops being busy and completes.

What you want is a queued state machine driven by an event structure. You enqueue states inside the event structure and the state machine (in a separate while loop) dequeues them and executes what you want. If you need more parallelism, you can make a second queued state machine and feed it from the same event structure. Just run both queue references in to the event structure. I've included an example of an event-driven queued state machine. There's a
regular queued state machine example as well. I built the examples at a local LabVIEW user group.

Daniel L. Press
PrimeTest Corp.
www.primetest.com
Message 2 of 3
(5,386 Views)
I put the two event structures in seperate while loops. It didn't occur to me that of course each part of the loop must finish before any part of the loop can start up again, although it should be completely obvious.

Thanks!
0 Kudos
Message 3 of 3
(5,386 Views)