Per Erik Strandberg /cv /kurser /blog

In the wonderful world of mixed environments I hereby add my latest discovery: Labview code executed in .NET. This is slightly less complicated than importing .NET code into Labview (see Labview And Dot Net Combo Part 1), I have also another tutorial on the Labview Native Cansi Combo.

A simple virtual instrument

First you create a simple virtual instrument in Labview. This will be the "method" you import in Visual Studio.

I make an instrument to compute the "slope" for a line between two point (see [1] if you have never encountered a line before). This is my attempt:
http://www.pererikstrandberg.se/blog/labview_in_dotnet/1my_vi.png

Exporting

Start a Labview project, add the virtual instrument file and right-click on Build Specifications, select New -> .NET Interop Assembly.
http://www.pererikstrandberg.se/blog/labview_in_dotnet/2build.png

Now you need to complete the wizard and make sure your vi-file is added. Take special care to verify the name of the method and the order of the arguments.

Importing

In Visual Studio you need to add the dll. Right click on References and add by browsing for the correct dll.
http://www.pererikstrandberg.se/blog/labview_in_dotnet/3import.png

Visual Studio 2010 assumes you want to build for .NET 4, but Labview lags a bit here - so I selected .NET 2.0 as the Target Framework.
http://www.pererikstrandberg.se/blog/labview_in_dotnet/4targetframework.png

Output

The magical output from this little example was of course 1.5 since the points I used were (1, 2) and (3, 5).


See also Labview Native Cansi Combo
See also Labview And Dot Net Combo Part 1
This page belongs in Kategori Programmering