09-17-2009 02:34 AM
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:
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
Solved! Go to Solution.
09-17-2009 03:55 AM
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.
09-17-2009 06:36 AM
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!