LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Create Virtual instrument

Good Morning everyone,

 

how can I create a Virtual Instrument in LabWindows CVI? E.g. I want to write a VI for Logfiles to create a logfile in a certain format with a defined API.

It seems to me a VI would be the best way to get maximum modularity (rather than sharing header and source file that are prone to changes).

 

Thank you!

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

VI (or Virtual Instrument) is a concept specific to LabVIEW that is not immediately portable to CVI.

 

Within CVI you can group some code you intend to resuse, generate a library and an associated set of function panels to help the programmer incorporate functions in his code; being a compiled piece of code, the library is not subject to change unless you create and distribute a new release.

Part of this process is examined in CVI help: look at Using LabWindows/CVI >> Using Function Panels topic.

Once you have created your library and the necessary include file that defines variables and functions, you can automate the generation of function panel by means of Options >> Generate Function Tree menu item: the process is described in this tutorial.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(4,570 Views)

Thanks for your answer!

 

I probably should have been more specific. I wasn't talking about a LabView Virtual Instrument, but a CVI Instrument (that seems to be very similar though..a piece of code with a defined interface through a user interface). 

 

For clarification: Is a function panel .fp the same as a user interface .uir ?

 

Looking through the information you provided I could not really find a answer to my question. It says that I can create function panels to map it to my functions but to create a new function panel the function needs to be already mapped to a function panel?(https://www.ni.com/docs/en-US/bundle/labwindows-cvi/page/cvi/usermanual/functionpaneleditor.htm)

 

But if I understand you right, the process works like this: create code to share in .c/.h file -> compile it as a e.g DLL -> use Generate Function Tree to automatically create .fp

0 Kudos
Message 3 of 4
(4,559 Views)

You're right as to the process: create and test the code as you normally do for your functions. Once the code is tested compile it into a .LIB file. You should have a .h file that describes functions and variables/types you are using in your library. At this moment you can go into the process of creating a .fp for the library; the function panel is just an interface for the code editor: it helps you in creating the function calls when developing other software that uses the library and directly creates the associate line of code, in much the same way you create a function call for SetCtrlVal via the corresponding function panel.

 

The .FP is independent from .a UIR file: while the latter is a resource file that describes the user interface, the former is the interface to an existing library. CVI comes with several .FP complete with the corresponding source code, so you can use them as an example to study: the larger and more useful library that comes complete with source and .fp it the Programmer Toolbox ( C:\Program Files (x86)\National Instruments\CVIxxxx\toolslib\toolbox\toolbox.fp ) that supplies a set of valuable functions I extensively use in my applications: is suggest you take your time to examine it both as an example of library+function panel as I said but also as a resource you can leverage on.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(4,553 Views)