I am looking for a LabVIEW driver for an SRS laser diode controller LDC501 (from the LDC500 series). I haven't found anything in the NI driver library, the SRS website, or these forums (though admittedly it was my first time using any of these things, so maybe I just missed something?). I am pretty solidly a novice when it comes to LabVIEW programming, so writing my own driver from scratch is...not ideal. Does anyone know of a driver for this instrument, or an instrument driver similar enough that I could make it work with relatively minor edits?
Edit: At the risk of exposing just how much I don't know what I'm doing: I have an NI GPIB-USB-HS I can use to connect the tool to my computer. I see that the GPIB-USB-HS seems to have its own driver software. Do I need a driver for both this connector and for my tool?
Solved! Go to Solution.
The term "driver" can have multiple meanings depending on the context with LabVIEW. If you are making a connection between the PC USB port and the instrument GPIB port, you need the underlying driver so the computer can talk over that connection. There are also "LabVIEW Drivers" which are just VIs that someone wrote to talk to a specific instrument. You would use these as the building blocks for your own code.
You need the driver that lets you talk to your instrument, so yes, install the driver for the NI USB-GPIB adapter. Then you can go into MAX and make sure your computer can see your instrument. Send some commands with the test panel and see what comes back. The commands are documented here: https://www.lambdaphoto.co.uk/pdfs/SRS/LAMBDA_LDC501m.pdf
If you don't have the VIs to send commands with LabVIEW, you will have to make them. Just navigate in your functions palette to "Instrument I/O >> VISA". You'll use VISA Open, VISA Write, VISA Read, and VISA Close to talk with the instrument. VISA Open is where you feed in the GPIB address of your instrument, VISA Write is where you send a command from the user manual, and VISA Read is where you read back the response.
Gregory's answer already told you that there are likely two types of drivers you may need to install (well possibly even three if you use the GPIB interface).
First the device supports RS-232, Ethernet and GPIB connectors on the back. As far as configuration goes, GPIB tends to be the most simple as you just need to make sure that the GPIB address in the VISA resource name matches the address set in the device (address 2 by default).
As to drivers you typically have an instrument driver which is simply a LabVIEW library that provides VIs that format strings to send to the device and parsing the response to return the data in a meaningful numeric manner to the caller. These instrument drivers usually use NI-VISA which is a middle layer driver software from NI. NI-VISA then calls into system drivers for the according hardware interface, for GPIB this is the NI-488.2 driver software which you need to install for your NI-USB-GPIB interface. For RS-232 it calls the OS specific serial port API and for Ethernet communication it calls the network socket interface provided by the OS.
For a LabVIEW driver using NI-VISA the actual interface used almost doesn't matter as VISA abstracts those differences away. There are usually only two areas where one needs to do interface specific handling in the instrument driver. One is the Initialize function where you open a connection with the device. Here you need to configure things like baudrate for serial ports and message termination character for serial and ethernet. VISA does allow to set some property to let it append the message termination character to each string send out but I prefer to do it explicitly in each command string as the additional message termination character normally doesn't hurt in GPIB operation either for devices which support multiple interfaces.
If you download the Stanford Research SR1 driver from the instrument driver Network you can see in the Initialize method that they do some specific initialization handling for when the VISA session is a serial port connection. A similar case frame would be needed for TCP-IP without the baudrate and other serial port specific properties.
Now your device is a Laser Driver so the actual commands from the SR1 Analizer won't make much sense for the most part. But it gives you an idea about how an instrument driver can be build that will support multiple interfaces with your device. If done properly your driver can work with any of the three interfaces with just using a different VISA Resource Name identifier connected to the Initialize method of the driver!
For Instruments where you don't have an instrument driver ready you can usually start with an existing driver and reuse the Initialize, Close, Revision Query, Reset, Error Query with some minor edits to make it work for your device.
The rest of the VIs in the Actiona-Status, Configure and Data subgroup is however very specific to the function of the device and often can be better thrown away right away unless it is functionally a very similar device. Even if it is functionally similar you may usually have to completely change the strings needed to send to the device unless it is from the same manufacturer and the same period. Even when from the same manufacturer it can be very different as they tend to considerably change the syntax of their devices from time to time.