Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

SR510 Serial communication error

I am trying to communicate with an SR510 lockin amplifier via serial communications.  I am looking to do a simple read write with the device.  I want to know the output value along with the sensitivity.  I am able to use hyperterminal to connect to the device and I am able to get responses back.  However, when using labview I am not able to read.  So far what I have done is use four of labviews vi I initialize the port, then write then read then close.  If I write a command that will change a setting I can do that with out the read part.  however if I give the command to see what the new value was I get no return.  I can start up hyperterminal and ask and it will give me the correct value for which my initial command made the setting.  So my real issue is that i cannot read from the port.  Any help or ideas would be greatly appreciated. 
0 Kudos
Message 1 of 12
(4,687 Views)

Your real issue may be that you are not writing the correct command. Are you appending a control character at the end of the command and how are you formatting the character if you are?

If you look at the basic serial example, a LF constant (\n) is part of the default command. In order to send this, you must have '\' Codes Display turned on or use the string constant on the String palette along with the concantanate string function. Best to post your VI and make sure that you include the text you are sending by selecting Edit>Make Current Values Default, save the VI, then attach it to your post.

0 Kudos
Message 2 of 12
(4,684 Views)
It is not that i am not writing the correct code.  I can write many commands and using hyperterminal i can check to make sure that the commands have taken effect.  For instance G 12 when entered using labview would cause the lockin to change to sensitivity setting 12.  If you type in G you should get back 12.  I can type in G 12 or other similar commands and the changes take place as confirmed by hyperterminal.  However commands that should have replies i dont get anything.  Also I have tried using different ending characters such as cr or lf.  It still seems to point in the direction of the reading of the serial port. 
0 Kudos
Message 3 of 12
(4,681 Views)
If you don't want to post the code and have someone verify it, then the only thing I can suggest is to put a small wait after you send the command before trying to do a read. I've never seen a situation where the command is correct and the read does not work unless the cable is bad. Since you can use Hyperterminal, that rules that out. Did you try using one of the shipping examples before you tried to write your own code?
0 Kudos
Message 4 of 12
(4,677 Views)
I will post the program as soon as possible.  This is my first time here so how is the best way to post the program.  Do I take screen shots or does labview allow some sort of print out of the code.  I will gladly post it if it helps resolve my issues. 
0 Kudos
Message 5 of 12
(4,664 Views)
Right underneath the message box is a box labeled Attachment and a Browse button. Just use the browse button to locate the VI. One thing to be careful of is the Preview button. If you use that, the attachment is lost. If you decide to post a screen shot, make sure it is a png or jpg.
0 Kudos
Message 6 of 12
(4,661 Views)
I am attaching the program i have tried using.  I tried to put as many notes on it as i thought would help. 
0 Kudos
Message 7 of 12
(4,651 Views)
The first thing I notice is that you are not sending the G with any type of termination character. The termination character setting for the VSIA Configure Serial Port is only for READS. It does nothing for a write. If you want to see how to use a VISA property node to set the write term character, look at the advanced serial example. Otherwise, do what I originally suggested and set the string constant for '\' Code Display.
0 Kudos
Message 8 of 12
(4,640 Views)

I guess this is where my misunderstanding comes from.  You refer to the fact that i have no character return or end character after my g and that the confiure serial port only works with reads not writes.  However, my problem is not with the write it is with the read.  I am able to write just the letter g to my device.  Imagine taking the code i had posted and deleting the read portion and just connecting the configure to the write to the close.  Where it writes a command such as g 12.  When i do that it correctly writes to the instrument and changes the sensitivity, for which g is the code, to the setting of 12.  So my next question is why do i need an termination character for one command where i want to read a sensitivity and not one for when i se it and there is no response.  I would think that I would either need a end character for both or for neither. 

I

0 Kudos
Message 9 of 12
(4,635 Views)

I guess this is where my misunderstanding comes from.  You refer to the fact that i have no character return or end character after my g and that the confiure serial port only works with reads not writes.  However, my problem is not with the write it is with the read.  I am able to write just the letter g to my device.  Imagine taking the code i had posted and deleting the read portion and just connecting the configure to the write to the close.  Where it writes a command such as g 12.  When i do that it correctly writes to the instrument and changes the sensitivity, for which g is the code, to the setting of 12.  So my next question is why do i need an termination character for one command where i want to read a sensitivity and not one for when i se it and there is no response.  I would think that I would either need a end character for both or for neither. 

I did try using the advanced serial communications example and that did not work either. 



Message Edited by University of Virginia on 05-13-2008 12:32 PM
0 Kudos
Message 10 of 12
(4,635 Views)