Jump to content

Calling a .NEt Assembly in labview


Recommended Posts

I have a C# code which I have compiled as a DLL class. It basically employs a Kinect camera to track an object and then spills distance of the camera from the object to a console window.

How do I retrieve the distance (given in the console window when I run the C# executable file) by calling the .NET assembly in labview.

Thank you!

Link to comment

Simple, slow solution: run your .NET application using System Exec, parse the output string in LabVIEW. But then you need to run the .NET application once per piece of data you want to retrieve; it can't run continuously (since LabVIEW won't get the output string until the application terminates).

 

Better solution: instead of writing the results to the console, push them to a UDP port, and let LabVIEW receive those UDP packets. I've used this sort of approach in several places and it's worked well. For communication between application on the same machine, UDP is simple, fast, and reliable (the loopback port shouldn't lose packets).

 

Fully integrated approach: rework the .NET code so that you can call it through the LabVIEW .NET functions, but this might involve rewriting a lot of code, especially if some part of the .NET code needs to run continuously in the background.

Link to comment

Okay. I actually tried the UDP thing this morning. Got the C# code to send the data to the UDP Port I wanted (I used an IP address of 172.22.11.2 and Port 80 which are the default for myRIO) but since my ultimate aim is to pass on the data to myRIO, I could see data on my screen but I could not ascertain the veracity as I was getting a constant string of data. I simply used the udp receiver example that came with the base development of labview but changed the ip address and udp port numbers.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.