01-14-2020 10:22 AM
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.
01-14-2020 02:02 PM
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.
01-14-2020 03:23 PM
What should i do in the case where the driver is not written in visa?
01-14-2020 04:03 PM
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
01-14-2020 04:18 PM - edited 01-14-2020 04:30 PM
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.
01-14-2020 04:22 PM
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:
mcduff
01-15-2020 09:42 AM
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?
01-15-2020 10:02 AM
@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