03-26-2009 08:02 AM
Hi,
I am using an USB to RS 485 converter. In the RS 485 line there are several instruments connected. Some use termination characters CR/LF (Hex 03 0D), one uses Hex 03 0D 0A FF. The communication goes through COM 1, calling each instrument by an individual hex address. I can access all instruments with a terminal program, but no response with Labview and Visa (error -1704001663). I make sure, that to address every individual instrument I open and close the port for this call. For calling the last instrument, I set use termination character to N in VISA configure serial port. I set that to Y when calling the other instruments.Is there another way I could try?
03-26-2009 08:32 AM
Are you sure about that error number? -1704001663 is undefined when I tried looking it up.
Are you sure you are sending the data in the same way out of LabVIEW as you are in the terminal program? Do you need a termination character on the end of the command you send to the instrument such as carriage return or line feed? If you are using a string control, make sure that if it has a \r at the end, you are actually in \codes display and not just normal display. In \codes, \r is a carriage return. In normal display, if you see \r, you are sending two distinct characters a "\" and an "r".
03-26-2009 10:24 AM
the problem is not with sending commands, it is reading. The instruments send their messages with different termination characters, I need to read these correctly.
03-26-2009 10:45 AM - edited 03-26-2009 10:49 AM
03-26-2009 03:06 PM
sylvester wrote:the problem is not with sending commands, it is reading. The instruments send their messages with different termination characters, I need to read these correctly.
Just trying to point out common issues when someone says "It works in Hyperterminal but not in LabVIEW". A lot of times you will enter a bunch of characters in a terminal window and hit enter. But when you programmatically put those characters in a string to send to a VISA write, you forget to put a CR or LF at the end which the equivalent of hitting enter in the terminal program.
For dealing with different terminal characters on the read from different instruments, I think your best bet is to read the bytes available at the port appending the data to a string and keep doing that in a while loop. End the while loop whenever a search of the string shows that the termination characters are a part of the string. That way you can programmatically change your stop condition (CR-LFin once case, 03 0D 0A FF in another) depending on which device you are talking to.