LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

building a hp8673C driver (first time driver builder, coaching appreciated)

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: 

  • Downloaded and installed the NI-488.2.3.0 driver
  • Watched the NI presentation on the Instrument Driver Development
  • found the operating manual for the device (link) on the Agilent website.
  • created an instrument driver project, made an icon, and started testing the codes.

 

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).

0 Kudos
Message 1 of 7
(1,574 Views)

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:

  • The Error Query has a loop since that's what most SCPI-based instruments work. They will have an error queue, and querying for an error will return the first error in the queue. You then repeatedly query the queue to get the next error until you get the response of "+0, No Error".
  • The *IDN? query is a SCPI standard. Your instrument does not support SCPI, so it does not know what that command even is. Instruments from that era had commands which were two or three characters long.
  • The Initialize VI performs an ID query (which you would need to chage to reflect the 8673's actual command and response) and then performs a reset or default setup. The Reset VI sends the *RST command, which, again, is a SCPI command. You would need to change this to the appropriate reset command for the 8673. A quick look at the table of commands seems to indicate it's probably the "IP" command. The default setup just sends REN which is remote enable. I think the 8673 should be OK with this, but you'd need to confirm it by looking at the manual. But then maybe you want the "IP" command here instead.

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.

Message 2 of 7
(1,562 Views)

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?

0 Kudos
Message 3 of 7
(1,557 Views)

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.

0 Kudos
Message 4 of 7
(1,553 Views)

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. 

0 Kudos
Message 5 of 7
(1,543 Views)

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.

0 Kudos
Message 6 of 7
(1,531 Views)

Ajolson,

 

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.

http://zone.ni.com/devzone/cda/tut/p/id/9097

http://digital.ni.com/public.nsf/allkb/F321995367AEDDE8862576B3005C4532?OpenDocument

Kyle Hartley
Software Engineer
NovaCentrix
0 Kudos
Message 7 of 7
(1,510 Views)