LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shared Variable between LabVIEW 2010 and C#

Hi,

 

i want to create a modular software with LabVIEW and MS C#.

All modules should be compiled (exe or dll). Perhaps one module for DAQ

and another for user administration, one the test sequencer...

 

How can I do the cyclic data exchange between the modules (for example the process image..)?

Is the shared variable the right way? I´ve tested shared variable with simple data, that´s not bad,

but with more complex data (array with cluster..) debugging (with NI-DSM) is not good.

 

Has anyone a good idea?

Thanx

 

 

...just painting code
0 Kudos
Message 1 of 9
(9,123 Views)
Message 2 of 9
(9,089 Views)

As Adnan said, there is always a possibility to exchange data thought files.

 

You could also use the .NET constructor to access your application's methods and parameter. You can find this constructor in the function palette under „Connectivity => .NET => Constructor Node“ and find help about it in the LabVIEW help under „VI and Function Reference => Connectivity VI and Functions => .NET Function“.

 

The issue with arrays in NI-DSM is known and should be fixed in a future version.

 

Regards

______________
Florian Abry
Inside Sales Engineer, NI Germany
0 Kudos
Message 3 of 9
(9,079 Views)

I don't know if it's the best way but it's simple to just use TCP to communicate between the apps. This also provides greater modularity since if you know the TCP messaging scheme being used, you can write the component apps in any language or change them later and you're pretty much OS independent if you want to run the client/servers on another computer. If both are running on the same computer, you can just use 'localhost' for the communication. It may be more efficient to do it this way as opposed to writing/reading from a file.

Message 4 of 9
(9,060 Views)

@ kgolden : this might as well work. I used it once to communicate between a C++ program and a Python one, I feel quite stupid I didn't thought about it :

 

Basic TCP/IP Communication in LabVIEW:

https://www.ni.com/en/support/documentation/supplemental/06/basic-tcp-ip-communication-in-labview.ht...

 

I was also thinking about the possibility to use shared Libraries:

 

Calling LabVIEW VIs from Other Programming Languages:

https://forums.ni.com/t5/Example-Program-Drafts/Calling-LabVIEW-VIs-from-Other-Programming-Languages...

 

There is specific examples using .NET at the end of the last link.

 

Regards

______________
Florian Abry
Inside Sales Engineer, NI Germany
Message 5 of 9
(9,055 Views)

The link that I have posted mentions TCP/IP, ActiveX and others.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 6 of 9
(9,046 Views)

Hello Adnan,

 

I´m gonna write a small test programm (compiled to a DLL) with shared variables and test ist with C#.

If it doesn´t work I try TCP/IP.

 

As soon as i have any results I will post them.

 

Thanx for the help.

...just painting code
0 Kudos
Message 7 of 9
(9,027 Views)

This looks like a pretty good example of NSV's in CVI.

Also uses the NSV callback capability, something that is missing in LV

https://forums.ni.com/t5/Example-Code/CVI-and-LabVIEW-Network-Published-Shared-Variables/ta-p/352165...

0 Kudos
Message 8 of 9
(8,997 Views)

Hi,

 

I don´t have any experience with CVI but you´re right that´s the same problem.

 

Here is the first test that I´ve programmed, just the MAIN-Programm (exe) and one
Module (Dll).

 

Please feel free to comment this stuff

...just painting code
0 Kudos
Message 9 of 9
(8,974 Views)