LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming a RS232 interface to replace GPIB interface that is used to control a lock in amplifier SR830.

I've been recently tasked to program a RS232 interface to replace the current GPIB interface used to control a lock in amplifier. I did some research online and found that the SR830 driver supports only GPIB and not RS233. 

I'm suppose to modify the driver or rewrite another driver that supports  SR233.

However im fairly new to this and barely have any idea how to start. Can anyone point me the direction on how to do it?

Thanks alot for the help.

0 Kudos
Message 1 of 8
(2,593 Views)

Assuming the driver was written using VISA, you just need to update/replace the initialization VI to set up a serial session instead of the GPIB.  This should include setting the baud rate, start bits, stop bits, etc.  Otherwise, as long as the command structures are the same, the rest will work just fine.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 8
(2,546 Views)

What should i do in the case where the driver is not written in visa? 

0 Kudos
Message 3 of 8
(2,533 Views)

Most of us don't have this Device to look at or to test.  We also don't have the Device Manual to read, and to understand how to use it using its Driver.  It does say that it supports GPIB and RS-232 (as far as I know, there is no "RS-233") -- presumably it sends text commands over a serial line.  This reference from NI might be helpful.

 

Consider attaching the Device Manual.

 

Bob Schor

0 Kudos
Message 4 of 8
(2,526 Views)

Well, NI has a modern VXI Plug&Play style driver for this device here. However it does not implement the necessary initialization to work with RS-232. Stanford Research devices did in the past not have a serial port as standard but that was an option you had to purchase seperately. As such most devices in the field did not have such an interface installed. That's probably why the driver developer did not bother to implement that.

 

In order to make this driver work for serial one would have to do two modifications:

 

1) Change the Initialize function to set the serial port properties when the VISA resource is a serial port.

 

2) While VISA supports a property to automatically let it append a specific character to any send out string, I prefer to make all commands throughout a driver send this character out explicitly at the end of each command. For most devices it doesn't hurt on GPIB but is absolutely necessary for RS-232 operation in order for the device to recognize that a complete command has been received and that it now can start to parse that command and do whatever the command is meant to request. This device supports according to the manual a <linefeed> or <carriage return> as termination character o RS-232 and a <linefeed>  or the GPIB EOI indication on GPIB. So always appending a <linefeed>  would work for both interfaces.

 

With these changes the Plug&Play driver SHOULD work also for the RS-232 communication with the instrument. If your application uses an older driver that was directly calling the legacy GPIB nodes, you will have more work carved out for you to replace those VIs with the similar functions from the new driver. This can be a pretty easy to very cumbersome task depending how well the old drivers were written. Generally they have a fairly hackish nature so replacing them with modern VXI Plug&Play drivers can be quite a bit of work.

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 8
(2,521 Views)

What should i do in the case where the driver is not written in visa?

 

Changing from GPIB to VISA shouldn't be a problem. For the most part, there are not many differences; basically you are swapping out GPIB reads and writes for VISA reads and writes. Some possible issues:

  1. Service requests(RSQ) are slightly different between GPIB and VISA.
  2. For GIPB devices you could Serial poll in parallel with other commands; that is not possible with RS-232, you will have to do them separately.
  3. The SR830 has an internal data buffer whose contents can be downloaded in byte format; if you choose that format, (ascii also possible), you would want to turn off any termination character.
  4. The SR830 manual is well written, look at it. Note some commands only work on a GPIB interface.

mcduff

0 Kudos
Message 6 of 8
(2,518 Views)

From reading the manual, it is stated that i should use the outx command at the start of the program to direct the response to the correct interface. May i know what it means by the 'start of the program'. Does it mean i have to include a OUTX 0 at VISA write inside the intialize VI only? Or do i have the include the OUTX command at every VISA write in every VI?

0 Kudos
Message 7 of 8
(2,458 Views)

@Forelsz wrote:

From reading the manual, it is stated that i should use the outx command at the start of the program to direct the response to the correct interface. May i know what it means by the 'start of the program'. Does it mean i have to include a OUTX 0 at VISA write inside the intialize VI only? Or do i have the include the OUTX command at every VISA write in every VI?


Initialize VI only

0 Kudos
Message 8 of 8
(2,446 Views)