LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

integrating a C++ driver in LabVIEW

Hello,

 

I have been assigned to integrate an x-ray source tube control to a LabVIEW program which I have written. AmeTek, the company who provided the x-ray source and controller responded to me today, telling me that they do not have specific LabVIEW drivers.

 

I was instead provided with an existing executible which an control the source and also the programming guide for Visual Basic and C++. I'm somewhat familiar with C++ Drivers, but I am not familiar whatsoever with how to integrate that with LabVIEW.

 

The C++ Driver basically seems to be a header/object defining the variables to be communicating with the X-ray source.

 

The Programming guide provides me:

1. Data Type Declaration,

2. Setting Data Type Declaration.

3. Command Enumeration

4. Status Enumeration.

 

Would somemone walk me through it please?

 

Thank you

-SJL

0 Kudos
Message 1 of 5
(4,077 Views)

Is driver in .net assembly or dll? 

 

If it is .net, you use connectivity -> .NET palette, constructor, invoke and property nodes to do the same you do when you call driver in C++. Sometimes they use standard windows libraries and it may help to search MSDN to locate them in system assemblies. Or ask here how to locate it in LabVIEW interface.

 

If it is .dll, you use Call library function node from Connectivity -> Libraries & Executables pallette. Open Help -> Find examples -> search for call dll.vi. It has examples of passing almost all datatypes into dll.

 

If you have trouble of defining specific structure in LabVIEW, you can post C++ declaration here, we will try to say what it should be in LabVIEW.

0 Kudos
Message 2 of 5
(4,064 Views)

Thank you,

the driver seems to be .dll

 

I will report back after giving it a go.

 

-SJL

0 Kudos
Message 3 of 5
(4,060 Views)

Just tto clarify/confuse a little more:

 

.Net assemblies also come in the form of DLL files, so saying it is a DLL doesn't really tell much. However if it was written in C++ then it is likely a DLL which exports a number of functions nalthough .Net assemblies can also be written in C++.

 

One compilcation could be if the C++ programmer decided to export the C++ class interfaces rather than standard C functions. The Call Library Node doesn't deal with C++ classes at all. This is basically because there doesn't exist a common ABI for C++. Each compiler tends to do this in its own way so that calling C++ classes from anything but the compiler which created the binary object module is almost inpossible even if it is delivered as DLL.

 

If you have a header (*.h) file for your DLL, then you have most likely a C/C++ DLL with exported functions. Now if this header only shows standard C function prototypes then you are most likely fine with the Call Library Node. If it shows however C++ classes either as function parameter or as complete definition then the only way to call this DLL from LabVIEW is to write another DLL wrapper which translates these class interface into a pure function call interface.

 

Your mentioninig of Visual Basic support makes me however wonder if the driver might not be an ActiveX component. They can also come packed in a DLL (or OCX). If so LabVIEW has also an Active X interface option pretty similar to the .Net palette.

 

Sorry for the confusion this may cause, but Microsoft likes to make things more complicated than it needs to be, by using the same file type for very different things.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 5
(4,031 Views)

Hello,

 

actually, that made things seem easier for me. I'm familiar with loading drivers from C/C++ through header files.

 

I am currently consecutively facing delays in the software development, as our hardware needs to qualified for safety. I am also refusing to develop anything from the software side, until I have capability to test the driver/interface step-by-step.

0 Kudos
Message 5 of 5
(3,973 Views)