LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

can i run visual c++ code under labview?

I have two instruments, one is controlled by labview and the other one is controlled by visual c++ code. is there any ways so i can run the c++ code in the labview environment. in other words, can i control the instrument which is only controllable by c++ code, with labview? does labview recognize .cpp files or .exe which is the compiled form of my c++ file ?
 
thanks
0 Kudos
Message 1 of 8
(2,947 Views)

LabVIEW cannot open and run .cpp files. You can call an exe file with the System Exec function but the amount of control depends on how you wrote the program. Does it accept command line parameters? How does it return data? If you included ActiveX support then you can access your properties and methods. You could also create a DLL instead of an exe and use the Call Library Node function.

Also, I'm curious why the instrument is only controllable by c++. What is the instrument and have you tried to find a LabVIEW driver?

Message 2 of 8
(2,944 Views)

Thank you very much for quick reply.

The instrument is a Tuner which I have only the cpp commands to control it. I have written the program and I have a Vector Network Analyzer too which is controlled by LabVIEW, so I want to control the tuner and VNA with LabVIEW.

 You told me about ActiveX and DLL, please tell me how can I use ActiveX or DLL. Do I have to compile the cpp file into a DLL file? and then how LabVIEW accepts DLL. Thanks again.

0 Kudos
Message 3 of 8
(2,922 Views)
With the Tuner I control the position so I do not need any returned data. Thanks.
0 Kudos
Message 4 of 8
(2,921 Views)
Yes, if you want to use the program as a DLL, then you will have to compile it as such. As I said, you use the Call Library Node to call functions in a DLL. For detailed information, go to Help>Search the LabVIEW Bookshelf and then open the document called "Calling External Code in LabVIEW".
 
But, it sounds like you have an "example" program in c++ for the tuner. You should also have the actual commands to control it in the programming manual for the instrument. Creating your own LabVIEW driver is really not all that difficult.
Message 5 of 8
(2,912 Views)
Could you please tell me how I can create a LabView driver?
Thanks
0 Kudos
Message 6 of 8
(2,902 Views)
Check http://www.ni.com/devzone/idnet/library/instrument_driver_guidelines.htm. Another quick and dirty way to add instrument control is to use the Instrument I/O Assistant. This is not nearly as flexible as a full driver but might be enough for you. Before attempting either, you should get familiar with the instrument's remote control commands by using the interactive control feature in MAX (right click on instrument and select "Communicate with Instrument").
Message 7 of 8
(2,898 Views)
Thank you very much. I think my problem is solved.
0 Kudos
Message 8 of 8
(2,890 Views)