I've got a HP8673C Synthesized Signal Generator, communicating with Labview over GPIB-USB-HS cord (Labview 8.6.1 on Windows XP). There is no existing driver, so I am setting out to build one. I have never built a driver before, so here it goes.
What I've done so far:
First question: Why does the error query vi have a loop in it? When I query the message on my device ("MG") it returns a 2 digit number error code. "00" is no error, and any non "00" code is an error. When there is an error (say, "20"), then it never stops the loop of the error query (because the return number is not equal to zero). It seems like I should just take the loop out, but I wanted to check why it was there in the first place.
Second question: Using the NI-488.2 Communicator, I query the device "*IDN?". It returns "FR03000000000HZ"; this also resets the HP8673C, and shows the error corresponding to "Invalid HP-IB code" on the device... any ideas what's happening here? Is there something I should be doing to EOS? I don't really understand what the EOI is or what my device requires.
Any help is greatly appreciated. In doing this project, I am hoping to learn more about how Labview works too, so feel free to point out things that I should know in general, especially if I'm missing steps. I hope it helps other first time driver builders too.
Attached is the driver project as it currently stands (mainly so you can check the error query vi if you want to).
The basic approach you are taking is the right one, since there are no existing drivers for that instrument. There are for the 8671, but I don't know how similar those instruments are.
The first thing you have to keep in mind is that the instrument you have is old. Very old.
The second thing you have to keep in mind is that the instrument driver project wizard creates a template based on an instrument that uses the SCPI standard. The instrument you have does not use the SCPI standard. Thus, several things that the template creates will simply not work correctly for the 8673C or won't apply.
With respect to your questions:
What I would suggest doing is to make things simple by creating individual VIs for each command that you are likely to use. This will allow you to test things one at a time, building up a usable library.
Thank you for the advice. Very helpful.
Is it true to say that only VISA Write and VISA Read are valid to use with this device? Things like VISA Open, CLR, Close are all not applicable and I will have to write those portions using Write and Read codes specific to this device if I want similar functionality to Open, for example?
Open creates a VISA session and is optional. If a VISA session does not exist (i.e. when doing a write), one will be automatically created. At one point, the use of an Open was required. It is still included in most drivers, though. Same is true of the Close. You can set LabVIEW to automatically close all sessions when you exit but many (including myself) prefer to explicity close a session. I believe the wizard creates initialize and close functions with them.
A CLR can be used if you need to flush the buffers.
I got the basic functionality I wanted to start with. The resulting (very simple) driver is attached (I also submitted it to NI.com's driver submission... I'm not sure if it'll show up there).
If anyone who's actually made drivers would care to look at it and give me feedback, it'd be appreciated.
One main thing I couldn't figure out:
The HP8673C should have a "local lockout" mode, where any front panel buttons pressed won't work. I've been unable to get this to work. The commands from the operating manual for entering and leaving that state are very unclear to me. I would like to get it working if possible. Any ideas? I'd like to use that in the initialize and close VIs.
Well, I don't write drivers with the intention of following NI's guidelines as I don't write to get them submitted, so I'm not qualified to comment on what you need to do to get them to spec for that.
As for the local lockout, I would think that the instrument should respond to the IEEE REN command, which you can issue using the VISA GPIB Control REN function.
Here is some documentation for creating device drivers. These are some of the guidelines that you should follow. They should give you notes if they reject the driver for any reason.