LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

C and labview interface

Hello folks,

I have a hardware interfacing project. I am curious if there is an tutorial on how to combine the interfacing code with Labview front panel GUI. The code is in C and/or C++ ( not a dot net or visual C ).

Let me know the minimum requirements from labview version number. If there are any examples , i will like to try those out.

PS: The other option was using java and Labview , do you think that is better than using C/C++ ??

Many thanks
0 Kudos
Message 1 of 4
(2,954 Views)
Have you compiled your C code?  Is it an executable .exe or a .dll?
 
If it is a dll, then you can use a Call Library Function Node.
 
As for you question at which language is better than the other, it depends on how familiar you are with both languages.  It is not a matter of quality of language, but rather how fast do you need to implement the solution and how familiar are you with Labview..  And also what the project is...
 
R
0 Kudos
Message 2 of 4
(2,943 Views)
Java wouldn't be a good choice since LabVIEW can't directly interface with it. So you would have to use JNI (which according to wikipedia is not easy), or networking (I'm sure there's a few other ways). C/C++ code can be handled with the Call Library Function Node as JoeLabView mentioned. If it's C++ code make sure to export the functions in the C format (If I remember right you need to put a extern "c" {} block around the declarations). Having LabVIEW Interface directly with C++ classes is propabably really difficult if not impossible. Structures could be troublesome depending on what's in them. If you want to interact with external things with a class sturcture then you'd probably want to use .NET or activex.

But if all the functions your calling just use numbers, arrays of numbers and strings then it's pretty easy once you figure out how to make a dll (just have to make sure the Call Library node is set up right). If you need to pass a pointer around between function calls you can treat it as a unsigned 32bit int in LabVIEW.

There's a "call dll" example if you search the examples in LabVIEW.
0 Kudos
Message 3 of 4
(2,935 Views)

"Matt W" <x@no.email> wrote in message
news:1216788005619-749146@exchange.ni.com...
> Java wouldn't be a good choice since LabVIEW can't directly interface with
it.

LabVIEW can't directly interface with C++ either. I'm sure it's possible to
make a dll form Java code (see
http://www.excelsior-usa.com/kb/000001.html ).

Regards,

Wiebe.


0 Kudos
Message 4 of 4
(2,908 Views)