Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

merge two vi

Hi,

 

How could I merge two Vi together? I tried to copy 1 of them and past on the other, but when I click run button, the program only ran on the original program, not the one I added in. Should I try to put a while loop outside these two Vi.?

 

Thank you,

 

CKH

0 Kudos
Message 1 of 6
(5,554 Views)

Hello CKH,

 

Could you please provide more background information about your application, I do not have a clear idea trying to do based or your description. Please post your code so that I can see what is going on in your program. In regards to merging 2 VIs together, there is a Merge VIs option available in LabVIEW. This option can be found under Tools>>Merge>>Merge VIs on the Getting Started window of LabVIEW.

 

Paul-B

 

Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(5,539 Views)

Hi Paul,

 

I am using case structure to control both vi to process simultaneously. However, it seems not working properly, I'm not sure if this is too complicated for labview to process the work. It ,sometimes, turned off the entire labview after I start the program. The following attachment is the example of how I merge these 2 vi into 1. I dont know how I can click run, then click start, in order to execute the program. I always have to click start first before I click run, otherwise the entire program will not even start, just stop after I click run.

 

The missing icons are from the company's database.

 

Thank you,

 

CKH

0 Kudos
Message 3 of 6
(5,510 Views)

Hi CKH,

 

So this approach to having the VI start with a "Start" button won't work for the following reason: When you hit "Run" from the VI, the VI in that instant checks the state of the button and decides what to do. If in that instant the button is "False," the false case is chosen and nothing happens, so the VI ends. If in that instant the button is "True," the true case happens, so the VI runs. This means that the only thing that matters is what state the button is in that instant. If you want this to work, what you might want to use is a case structure with a while loop. This way, the while loop keeps running, and you can have the "True" of the case structure contain all your code. When you hit the "start" button, the True case will run and run your code. Does this make sense?

Ravi A.
National Instruments | Applications Engineer
0 Kudos
Message 4 of 6
(5,496 Views)

Hi Ravi,

 

The case structure in while loop works perfectly, but I'm trying to stop the motors with the stop button that I already created. Since there are 2 while loops the new one and the old one, I'm trying to keep the old one and use local variable on the new stop. This is working as I thought, any suggestion?

 

Thank you,

 

CKH

0 Kudos
Message 5 of 6
(5,486 Views)

Hi CKH,

 

So this DevZone explains to you how to use local variables to stop multiple loops. Go ahead and see if that helps.

 

http://zone.ni.com/devzone/cda/tut/p/id/7585

Ravi A.
National Instruments | Applications Engineer
0 Kudos
Message 6 of 6
(5,477 Views)