sganap Posted May 3, 2006 Report Share Posted May 3, 2006 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 Quote Link to comment
Yair Posted May 3, 2006 Report Share Posted May 3, 2006 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. Quote Link to comment
sganap Posted May 27, 2006 Author Report Share Posted May 27, 2006 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.