Jump to content

Recommended Posts

Posted

Hi,

I have a java program that I want to send a signal to Labview to activate one of the sensors. I have not worked with LabView, do you have a sample code for the TCP/IP how to connect to java?

Any help will be greatly appreciated

Regards

-Sganapat

Posted

I haven't done any LV<->Java communication, but using the LV TCP functions is simple and you can find several examples in the example finder (Help>Find Examples).

Basically, you get a byte stream which is represented as a string. Normally, in the LV implementation, the sender calculates the size of the data and sends a 4 byte string (an I32) which tells the reciever exactly how much data it's going to get. That way, you can always read 4 bytes to get the size of the data and then ask for that size. You can do a similar implementation in your code, where you would (for example) always send x ASCII characters representing the length of the data.

You can convert the string to a U8 array using one of the functions from the string palette and (if necessary) you can reverse the endianess of the bytes by using the VIs in the Advanced palette.

I would advise that you stick to sending simple ASCII characters and not try to format more complex data into something that LV will understand.

  • 4 weeks later...
Posted

Thanks that was helpful. That leads me to another question:

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

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.