08-02-2015 12:54 PM
08-02-2015 01:28 PM
You don't need an example for how to wire a constant, Instead of a wire from "Bytes at Port: going into the VISA Read, you put a constant.
Regularly opening and closing the serial port is generally a bad idea.
How do you have a different termination character for different messages? Any real communication protocol uses a termination character such as the new line/linefeed character, or a carriage return, consistently, and doesn't change it between messages.
If you ever do need to change the termiantion character, there is an input for that in the Serial Configuration subVI.
Turn on Context Help and hover over those functions.
08-02-2015 05:37 PM
08-02-2015 07:00 PM - edited 08-02-2015 07:01 PM
Reread my last post.
1. Turn on Context Help.
2. There is an input for the termination character in the SERIAL CONFIGURATION subVI. To be more specific, it is called "VISA Configure Serial Port"
Do you know what the termination character is for your instrument? Have you read the manual about the communication protocol?
08-02-2015 08:46 PM
Sorry, I am really new to labveiw and this is a learning experience for me.
When I looked at the instrument manual, here is what I found:
"When sending commands that require a value, the commands must end with a carriage return (Enter key or Return on most keyboards), comma, or a period."
When I format the string, I am adding commas between each command.. Would I need to add a carrige return at the end of the formatted string as the termination character?
Also do you have to use a constant wired into the byte count AND a termination character or will only one of these options suffice?
Thank you again for all your help,
Mridu
08-02-2015 09:30 PM
Yes. You need to end your strings that you write with a carriage return. If you set your strings to \codes display, then it will look like \r.
Yes you need to set the termination character, Wire the value 13 decimal or 0D hex into the appropriate terminal of the VISA Configure Serial Port. (I'm assuming that the since it tells you to end the commands with a carriage return, the responses it sends you will end with a carriage return.
Yes you need to write a constant into the VISA write. You already know you have to wire something in because you had a broken VI when you didn't.
If you are new to LabVIEW, you really need to take the tutorials.
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
08-03-2015 12:18 PM
Hi RavensFan,
Do you mean I need to wire a constant into the VISA read?
Also I am making progess, but now when I run the program I get the error "timeout expired before the operation completed". From what I understand, the timeout would only expire if it is not picking up on the termination character, which I have put in.. Can you look at my code maybe and tell me what may be the problem?
Thanks in advance,
Mridu
08-03-2015 12:28 PM - edited 08-03-2015 12:29 PM
@mnanda98 wrote:
Hi RavensFan,
Do you mean I need to wire a constant into the VISA read?
Isn't that exactly what I said?
Also I am making progess, but now when I run the program I get the error "timeout expired before the operation completed". From what I understand, the timeout would only expire if it is not picking up on the termination character, which I have put in.. Can you look at my code maybe and tell me what may be the problem?
It looks like you've set the termination character to be a carriage retrrun (decimal 13) just fine. So if you are getting a timeout error, that means you are either not sending the commands correctly and the device is not responding, or the termination character is not actually a carriage return like you said.
Do you have any software that the vendor of the device might have supplied that can prove to you that it is communicating correctly? Is any data returned in the string indicators when it finally times out?
Thanks in advance,
Mridu
And why do you still have the VISA Close inside the loop closing the port on each iteration? It belongs after the while loop.
08-03-2015 12:45 PM
Hi RavensFan,
When I tried to put the VISA close outside the two for loops, I got the following error: "you have connected two terminats of different types"
08-03-2015 12:48 PM
Did you look more closely at the error? Hover over the wire? It will tell you why they are two different types.