Labview And Dot Net Combo Part 2
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:
Exporting
Start a Labview project, add the virtual instrument file and right-click on Build Specifications, select New -> .NET Interop Assembly.
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.
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.
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