From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

End a sub-VI after the snap (with IMAQdx)

Solved!
Go to solution

Hi !

So I need to display a grid on a projector and take a picture of it with a camera. My problem is that I want the program to run as fast as possible and for the moment I can only display the grid a certain amount of time.

So I would like to confirm that the picture has been taken and stop the sub vi displaying the grid. I thought that by replacing the tempo by a while structure

and sending the "stop" message after having taken the picture would work but it doesn't.

So my idea was to make a sequence and then send the "kill" message.

I've read about occurrences but I'm not sure how to use it and even if it's not too complicated.

The first picture is the main vi and the second the one I want to end.

 

question synchro.jpgquestion synchro2.jpg

0 Kudos
Message 1 of 5
(2,376 Views)

Hi,

 

- your second loop will never end (if stop is false at the start)

- the first printscreen does not show the stop condition. How do you stop the first while loop

- Since this two loops don't communicate with each other (exept a stop command) the simplest solution to have a "synchronuous" shutdown would be a local vaiable.

 

Local variable.JPG

cheers,

cheggers

Sascha
0 Kudos
Message 2 of 5
(2,367 Views)

hey cheggers,

first of all thank you for your answer !

Now that I watch my post, I realize it is not clear at all !

The two loops are not in the same VI. The first big loop is the main VI and the second "little" one is the sub VI called "Grille" in the first loop.

You can see I tried stopping the sub VI "Grille" when the snap is taken but it doesn't work.. The boolean entering the sub VI "Grille" is supposed to end the while loop. At least that's what I want it to do.

0 Kudos
Message 3 of 5
(2,358 Views)
Solution
Accepted by topic author lionel_sc

Hi,

 

sorry, i didn't get that the grille VI is actually a subVI of the mainVI. You can use a global variable to communicate your stop request to the subVI.

The question is: Do you want to stop the subVI after all four for-loop iteration? Or do you want to start and stop the SubVI in each for-loop iteration?

Here an example for the second option:

 

mainVI2.JPG

 

grille VI.JPG

now it should work. in the first frame you set the stop control to false - the subVI "Grille" will continue to execute. After the frame has been taken the "Grille" subVI is stopped trough the last frame.

 

Cheers,

Cheggers

Sascha
0 Kudos
Message 4 of 5
(2,351 Views)

Thank you ! It works great !

0 Kudos
Message 5 of 5
(2,340 Views)