Jump to content

Java and Labview sending digital I/o to control DAQmx


Recommended Posts

Had a project here where we combined Java and LabVIEW.

Did not have much problems getting values to LabVIEW.

Just make a DLL in labview and call the DLL from Java.

(you can find many source examples how to call DLL's in Java, it means

writing an intermediate C dll that converts between a java style

DLL and a generic windows style DLL which is what LabVIEW exports).

We made a DLL that starts up a server part in the background.

This server would take care of all the hardware communication.

The main issue we had though was passing back big arrays.

This caused some errors in the JVM, which we still have not resolved.

Seemed to be timing related...

But passing simple values was no problem.

Hope this helps,

Oskar

Link to comment
If I want to send a digital signal from java to Labview VI to trigger a DAQmx device, that takes in I/O from dev1/port0/line:7.

Any insight will be greatly appreciated.

-Sganapat

A few approaches come to mind on how to accomplish sending a signal from java to trigger a DAQmx device:

1) Create an executable of your Labview code. Use a system call from your java code (assuming it's an not an applet) to launch the executable (trivial). This is the simplest, but is limited by your task (passing data, etc.).

2) Wrap your java code using the JNI interface. Have your Labview code make a call to your java application and check if the task should trigger (CIN node? dll, or similar). If you like puzzles, this is a fun one to try. If you are comfortable using java and C/C++, this would work.

3) If you are deploying this to a desktop, does the computer have multiple serial ports, parallel ports, or USB ports? If yes, perhaps you can use the javax.comm package and loop two ports together. Setup your Labview code to listen for a specific message and then trigger the event. If this works, it would be trivial to pass data back and forth between java and Labview. This is by no means an elegant solution, but it will work reliably and is fairly trivial. I've used the javax.comm package with 115200 baud with good success.

Without more specific data on your particular application, these are all the suggestions I have.

Cheers

JMA

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.