LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

event structure and while loop iteration

Solved!
Go to solution

Hello,

 

It took me time to pinpoint the issue I have, but I think I have it nailed and need help in resolving it.

 

Am I right to say that a While loop containing an Event structure will iterate only once and then wait for another event to happen before looping again?

 

The issue I have is that I need to poll a timestamp value from a DAQ (DataTaker) driver, and every time it changes Labview Event structure would take care of the rest of the incoming data.

 

So is there a way to make the While loop continue on polling my timestamps value coming from my Datataker driver so that I may create a Value(Signaling) event for the Event Structure to take care of?

 

Thank you,

 

Richard

0 Kudos
Message 1 of 4
(2,642 Views)
Solution
Accepted by topic author rcote1

Two options.

 

1.  Put the stuff you need to poll on a regular basis in its own while loop that runs in parallel to the loop containing the event structure.

2.  Put the stuff you need to poll in the timeout case of the event structure, and wire a timeout value to the upper left corner of the structure.  Now if no events occur in that period of time, the event structure will execute the timeout case and the loop will iterate again.  The only issue with this method is that the timeout case could execute irregularly, or never at all if it so happens that events are coming in more frequently than the timeout value.

0 Kudos
Message 2 of 4
(2,639 Views)

Thank you RavensFan, the second option worked, but I need to work on the timeout period because I miss about half the data.

 

Thank you,

 

Richard

 

 

0 Kudos
Message 3 of 4
(2,574 Views)

You probably should have two different loops.  One that is dedicated to collecting data.  The other designed to handle the events.

 

You could also use a producer consumer where the data collecting loop puts data into a queue for the other loop to dequeue and act on that data.

0 Kudos
Message 4 of 4
(2,561 Views)