LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Making labwindows CVI panel as subvi of Labview

Solved!
Go to solution

Dear All,

        Anybody know that how to use LWCVI in Labview.

        I had developed LWCVI based GUI program. Now i want to use that in labview, where i also want to use value of some Numeric control of CVI panel.

        Is there any way to call and use LWCVI program in LABVIEW.

 

 --Vishnu

0 Kudos
Message 1 of 19
(5,257 Views)

Hi

 

you can use it as a DLL:

http://digital.ni.com/public.nsf/allkb/C27830EACA6668E2862574430059F4DA?OpenDocument

Or the system exec.vi to call the CVI program as an exe.

Regards
DianaS
0 Kudos
Message 2 of 19
(5,249 Views)

Dear Diana,

          Thanks for your reply. I tried in many ways but i couldn't succeed. Actually i have LabWindows CVI6.0 and Labview7.0.

I think that is not matter very much.

 

          In my application i am executing CVI panel for setting of powersupply parameter. Then after i am using LabVIEW panel for powersupply start stop operation. I want to open CVI panel from labview panel and do some setting and back to labVIEW and operate powersupply.

 

 

--Vishnu

0 Kudos
Message 3 of 19
(5,126 Views)

Vishnu:

 

For now, I only have questions, not answers.

 

You say that you have "tried in many ways".  What have you tried?  What were the results?  Did you get any error messages?

Was your CVI panel displayed?  Did the power supply respond to the CVI program?  Was LabView able to talk to the power supply?

 

Did you build an executable in your CVI project?

Can you run it on its own?

Does your CVI project do what you want when you run it on its own?

If you can run it on its own and it does what you want, then you should be able to run it through LabView using "system exec.vi" as DianaS suggested.

If you need to pass parameters back and forth between LabView and CVI, it would probably be better if you rebuilt your project as a DLL.

Does you CVI project reset the power supply when you exit?  (It shouldn't if you want your settings to stay active for the rest of your LabView session).

0 Kudos
Message 4 of 19
(5,117 Views)

I tried with DLL and all that DLL in LabView.   At the time of configuring DLL in labview, we need to give fuction name. I put my first function from where my  program starts excuting. 

 

I had no error but no CVI panel displayed on the screen.

 

 

 

I tried with EXE also. but no result.

 

 

May me i am doing some mistake on CVI end or may be on LabVIEW end.

 

 

 

--Vishnu

0 Kudos
Message 5 of 19
(5,078 Views)

Vishnu:

 

You said the you "tried with EXE also. but no result."  Does that mean that you built an EXE in CVI and tried running it directly, without LabView?  If you did not do this, that should be your first step.

 

It may be easier if you create a new CVI project, add your existing UIR to the new project, generate the main code, and paste in your callbacks from your DLL project.

 

What does "no result" mean?  Did you debug and step through your project in the CVI development environment?  Were your callbacks working as expected?

 

You can also use the CVI development environment to debug the DLL as it is called by LabView, but it you don't have the parameters set correctly in your LabView Call Library Function node, you won't get very far.  In CVI, go to Help >> Contents >> Index, and enter debug in the search box to see help articles on debugging DLLs.

 

If you debug a CVI EXE first, using the CVI environment, at least you'll know if your problem is on the CVI side or the LabView side.

0 Kudos
Message 6 of 19
(5,070 Views)

Dear AI S,

         Thanks for your help. Actually i didn't know that the .UIR file should also with .EXE file in same folder. I copied only .EXE file in new folder and tried to link it with LabVIEW. I had error. When i have copied  .UIR in same folder with .EXE file and use system exe block in LabVIEW, it was working. 

 

          Is that any way to make .EXE with .UIR So i need not to copy .UIR with EXE.

 

          I can open CVI panel and it is working independently from LV. I  can also move from CVI Panel to LV panel for setting. But only problem is the when i close LV, the CVI panel is not closing automatically. Is there any way to solve this problem?

 

 

Thanks again.

 

--Vishnu

0 Kudos
Message 7 of 19
(4,906 Views)
in CVI, in the project settings dialog box, there is an option to embed the UIR into the EXE. if i remember correctly, this options already existed in CVI 7.
0 Kudos
Message 8 of 19
(4,898 Views)

Vishnu:

 

In CVI 6, you need to use the UI to Code Converter.

From the CVI project window, go to Tools >> UI to Code Converter...

Then click on the Help button at the bottom of the UI to Code Converter window for some good details on how to use the tool.

Here are some additional hints.

In the box titled UI Panels, click Add and browse to the UIR file you want to add.

In the box titled Output Target, enter new names for the Header File and Source File.  I usually use the original name and append _UIR.  For example, if my original UIR file is TestPanel.UIR, I'll call the new files TestPanel_UIR.h and TestPanel_UIR.c.  I give them new names to make it easier to go back to the original .UIR file to make changes.

Leave all checkboxes in their default state.

Click Generate Code.

 

In your CVI project window, add the new .c file to the project (Edit >> Add Files to Project...)

 

In your original main .c file, replace the original UIR  .h file with the new _UIR.h file.  For example, if my original UIR .h file was TestPanel.h:

Replace

#include 'TestPanel.h'

with

#include 'TestPanel_UIR.h'

 

Replace the call to LoadPanel with a call to the new BuildPANEL function.

 For example: replace

 

if ((panelHandle = LoadPanel (0, "TestPanel.uir", PANEL)) < 0)
  return -1;

 

with

 

 if ((panelHandle = BuildPANEL (0)) < 0)
  return -1;

 

Rebuild the project.  Now you no longer need the UIR file to run the project.

 

I never delete the UIR file or its .h file.  If changes are needed, it's easier for me to modify the UIR file in the UIR editor and then run the code generator again instead of modifying the UI code.

 

I'm surprised you didn't get any error messages that you were missing the UIR file when you tried to run your project without it.  But good work figuring out that was your problem.

Message Edited by Al S on 10-14-2009 08:53 AM
Message 9 of 19
(4,889 Views)

Vishnu:

 

To address your second question: is there any way to close the CVI app automatically when the LabView app exits?

 

There are multiple ways to address this, but I think the simplest and most foolproof is to create your CVI app as a DLL, and expose two functions for LabView to call: one to open and run the operator interface, and the other to close the operator interface.

 

When you're ready for your LabView app to run the CVI app, use LabView's Call Library Function Node to call the CVI DLL function that opens and runs the CVI app's operator interface.  Remember that CVI's RunUserInterface function doesn't return until you call QuitUserInterface, so don't base subsequent action in your LabView app on your CVI call returning.  That's a nice thing about the data dependency model of LabView and its automatic multi-threading: if you don't want to wait for a function (or sub-VI) to complete, just don't use any of its outputs.

When you are exiting your LabView app, then call the CVI DLL function to close the operator interface.

 

Look at the tutorial titled Building a DLL with LabWindows/CVI 8.5 for use with LabVIEW 8.5 here: http://zone.ni.com/devzone/cda/tut/p/id/7251

I know you have older versions, but it should still give you the idea on the steps needed.

0 Kudos
Message 10 of 19
(4,854 Views)