LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP data loss?!

Solved!
Go to solution

Hi,

I´m trying to communicate with a measurement device.  

USB and Ethernet instrument connections use the NDIS communication

method. I´m using the USB connection. The device will then be added as a new network connection and is accessible via TCP/IP.

Communication is done by sending simple ASCII messages like "MSTART" followed by a carriage return. The device will then answer with something like "OK" for example. 

I was able to communicate with the device using Windows "hyperterminal" software.

 

However it was not possible to do the same with Labview.

I created a simple VI as follows:

TcpDataLoss.PNG

I´m certain that the connection is working correctly since there are written bytes and the measurement device will also start to measure.

But I do not receive any data. I tried different modes but was not succesful. It seems to be that the device is sending an answer faster than Labview can handle it. Sending orders via Hyperterminal will give an instantaneous response.

 

Are there any possible solutions to fix the data loss?

Thanks in advance!

 

 

System: Windows XP Professional

Labview 8.6.1 Base Dev

0 Kudos
Message 1 of 3
(4,118 Views)
Solution
Accepted by topic author Exziton

Hi there

 

In CRLF-mode the TCP Read function waits for CRLF and not a single CR:

 

documentation states : "CRLF—Waits until the function receives a CR (carriage return) followed by a LF (linefeed) within the number of bytes you specify in bytes to read or until timeout ms runs out."

 

So if the device just sends a single CR the TCP Read function will not recognize the end of the messafe.

 

Try this:

 

- If the returned message has a fixed and known length call TCP Read function in STANDARD mode (see documentation for details)

- If the returned message has NOT a fixed or known length call TCP read function in a while loop in IMMEDIATE mode, append the strings received and search for a single CR in the appended string.

- Try to configure the device to send a CRLF instead of a single CR

- Use a VISA  TCP/IP socket session. Then you can configure CR as termination character.

 

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
Message 2 of 3
(4,105 Views)

Hi Chris,

thanks for your reply.

I wasn´t really sure about the expected format or end of message (CR or CRLF). I tried the immediate mode in combination with a while-loop. That one worked. I also didn´t received at least something before because my string output box only showed one line. The received string was in the second line (doh).

 

Thank you very much!

0 Kudos
Message 3 of 3
(4,083 Views)