ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

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
(3,251 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: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P7OfSAK&l=en-US

 

Kind Regards, 

Applications Engineer
0 Kudos
Message 2 of 2
(3,222 Views)