Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

sequence interrupting while loop

Hi,

 

I am currently having some problems with my IMAQ vi.

 

I am trying to acheive the following:

1. Stream video from USB camera - working

2. Track points in the image - working

3. Calculate a distance from the tracked point to a reference point - working

4. Use the distance to define the movement of a mechanical stage, where the stage vi is part of a sequence - not working like I want it to.

 

The problem I am having is that I have a sequence of events that I want the stage to perform. This sequence is inside a case structure in the While loop.

 

When I start the VI, the video streams perfectly, and the distance is calculated. However, when I press the a button to trigger the case structure (and thus the sequence), the video stream is interrupted until the sequence has finished.

 

I would like the video to continue streaming and calulating while the sequence is executing also. How can I achieve this?

 

I have tried to place the case structure outside the While loop, however, I cannot pass the calculated values to the strucutre when the While loop is still running.

 

Any help is much appreciated!

Thanks in advance!

 

David

 

0 Kudos
Message 1 of 2
(2,914 Views)

Hi David,

 

If you look at the LabVIEW templates (File > New > From Template) then take a look at the "Producer/Consumer for data" pattern, this allows you to run 1 loop quickly i.e. acquire data and the second loop to perform any CPU intensive steps by keeping a queue of the data. The queue basically keeps buffering the information without effecting the acquisition: http://digital.ni.com/public.nsf/allkb/DD7DBD9B10E3E537862565BC006CC2E4?OpenDocument

 

Kind Regards, 

Applications Engineer
0 Kudos
Message 2 of 2
(2,885 Views)