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: 

Qeustion about opening/closing two IMAQ VI's so that you don't have to struggle with the File already open problem

i have included a VI to explain my problem that's how my application is build only then a lil more complicated but i left it to the basics since i can't share my full VI. The case is that if you press start the program should start and load a movie however if you either go to the other tab or when you click 'start' again the program should close the IMAQ file i just get strangled by the fact that i have no clue which loop to stop and where to close the video. Help would be greatly appreciated

0 Kudos
Message 1 of 4
(1,928 Views)

Hello Rinus,

 

According to what you've written, finding the Vis is not really a problem.

The issue is rather in how to make everything happen at the right moment in time.

For this I would advise you to use one of the Design Patterns in LV.

 

Are you familiar with some Design Patterns in LV?

If not, then I would advise you to first read up on the following Design Patterns:

http://www.ni.com/white-paper/7605/en/

 

This will help you understand how you can handle certain actions one after the other.

If this does not help you along or still leaves you confused about how to program everything, then please let me know so that I can help you.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 2 of 4
(1,892 Views)

ah i might have made the title wrong i meant more i have a problem with finding where in the while loop i should close the video to ensure i can open that same video once i go to the next tab or make the start button false...

 

0 Kudos
Message 3 of 4
(1,888 Views)

Hello Rinus,

 

I think having two parallel while loops in this case doesn't seem necessary (and should be avoided).

 

As you said, you want to close/stop the video "stream" in the first tab when you open the second Tab (and probably also the other way around).

 

This would mean that you'll have to use a "framework" that allows you to have several states and can detect a change between tabs, correct?

 

The easiest way to implement this is by using a Design Pattern as starting point.

 

Can you make a flow chart that fully explains what the requirements are of your program?

This will allow you to choose the right design pattern.

 

If you are not comfortable with flowcharts, then a more complete description of the requirements would allow me better to guide you to an appropriate "framework".

 

Based on the current requirements a simple state machine could maybe do the trick, but this of course depends on the additional (not yet mentioned) requirements you might have.

I'm asking this especially because you refer to a "more complicated" top level application.

 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 4 of 4
(1,883 Views)