ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linking Visual C++ program with Labview (real time)

I have a Visual C++ program to generate output voltage value. May I know how to connect the program with Labview (in real time) so that Labview will receives these output from my program and process them?

More detailed description:

My C++ program will generates about 100 values of voltages between -2V to 2V. I am required to send these voltages to Labview. From LabView, signals will be sent to voltage supplier to supply voltage to the machine.

I have difficulty linking my program with Labview in real time.


Thanks a million.

Thanks
0 Kudos
Message 1 of 4
(3,020 Views)
Hello there,

If you are using the LabVIEW Real-time module, then the real-time portion of your code will run on a separate system running a Non-Windows Based Real-time Operating System. Obviously, the Visual C++ code cannot be run on that system.

What you can do, however, is create a LabVIEW VI that runs on a Windows host PC and interfaces with Visual C++. Then, this host VI can communicate parameters to the Real-time system. These can be the parameters that were generated by your Visual C++ code.

If you are not using the LabVIEW Real-time module, the problem becomes simpler. You will just need to build your Visual C++ code into a .dll that can then be called from LabVIEW. A tutorial to do so can be found here. After that, you would use the "call library" function to make calls to the .dll. There is a great example that ships with LabVIEW 7.X called "call DLL.vi". This example is a comprehensive look at calling .dll files from LabVIEW, and it think that it will point you in the right direction.

I hope that this helps.

Regards,
P.J.
National Instruments
0 Kudos
Message 2 of 4
(3,020 Views)
I am running a window MFC application. I noticed the call DLL function in Labview however I only have MFC based .exe. Is there a method to let my .exe communicate with Labview?
0 Kudos
Message 3 of 4
(3,020 Views)
There is an example frogram that deals with MFC calls to LabVIEW VIs. I hope that this helps.

P.J.
National Instruments
0 Kudos
Message 4 of 4
(3,020 Views)