Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Java wrapper for DAQmx

Hi,

I've searched right through NI site and these forums to but to no avail so i'm hoping someone, anyone, can shed some light on the following question:

Our developers are all Java developers and that is not going to change. Neither are we going to invest in LabVIEW, we'd rather invest in a DAQ that works with Java than change languages....so....my question is:

We've read that the DAQmx drivers can be wrapped using Java Native Interface language. This should allow us to leverage all the DAQmx functionality using Java. Now, can some helpfull person let us know which DLLs we need to wrap ? Or at least go into a little more detail ?

We would be most gratefull for any light anyone can shed on this as I get the impression NI is very vague on the subject and have.

Many thanks in advance...

Shaun.


0 Kudos
Message 1 of 7
(6,892 Views)
Okay, can anyone at least indicate how we can find which objects we will need to wrap in order to capture output from standard Angle Encoder ? A simple example, thats all....PLEASE!!!!:womanmad:
0 Kudos
Message 2 of 7
(6,885 Views)
steorn,

As far as I know, the individual functions must be wrapped in order to use the native interface. For instance, I've seen C++ code which wraps other C functions (from DLLs, for example) as a JNIEXPORT function. You can then import these functions into Java. Wikipedia actually has a great tutorial on how to do this. If your company is going to be using DAQmx a lot, it would be wise to write a wrapper for all (or at least the most common) DAQmx functions. A quick and dirty solution would be to write the DAQ part of your application in a single C++ function using the DAQmx C API. Then, from your Java code you could call this function to get your data.

Hope this helps,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 3 of 7
(6,878 Views)
Hi there,

I have had to do this myself too. NI does not provide C or C++ code that will do this. Basically, what I needed was a 32-bit integer read from a DAQ unit, as well as the serial number of the DAQ.

I left all the main processing inside the Java, just left the actual retrieval inside the C code.

A perfect example that I used was 'ReadDigPort.c' - it contained 80% of what I wanted to do - I just had to add some code to send across a Java string and retrieve the serial number of the DAQ unit.

Hope this helps.
Chris
0 Kudos
Message 4 of 7
(6,850 Views)
Chris,

Please feel free to post your code. I believe others would benefit from it.

Thanks!
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 5 of 7
(6,829 Views)

Ryan,

I've tried to attach the code below - as you can see, it is based heavily on the ReadDigPort.c example.

 

0 Kudos
Message 6 of 7
(6,813 Views)

I've just found this one:  http://jnidaqmx.sourceforge.net

Message 7 of 7
(5,725 Views)