LAST PAGE  BACK TO INDEX  NEXT PAGE

[8.0] VEE Instrument Drivers

[8.0] VEE Instrument Drivers

v5.0 / 8 of 23 / 01 sep 99 / gvg

* As noted in the last chapter, classic VEE instrument drivers come in two forms -- State (Panel) Drivers and Component Drivers. They are now obsolete and have been in principle replaced by by Plug&Play Drivers. This chapter provides the details.


[8.1] CLASSIC VEE DRIVERS
[8.2] VXI P&P; DRIVER SUPPORT

 BACK TO INDEX

[8.1] CLASSIC VEE DRIVERS

* When you first bring up a traditional instrument driver in VEE, it appears as a front panel to an instrument, but IDs are actually programming elements as well: they're blocks with pins going in and pins going out that can be controlled by other objects in the VEE environment by wiring the mess together.

If you select VEE's "I/O -> Instrument" menu selection, you get a dialog that allows you to configure an ID. The dialog allows you to select either an "Instrument Panel" (a front-panel driver, also known as a "state" driver), a "Component Driver" (a single-element driver), or or "Direct I/O" for that instrument. If you configure an instrument driver -- say, for an old 3478 DMM -- you get an ID panel:


   +--------------------------+
   |       hp3478(LIVE)       |
   +--------------------------+
   | [Reset] [  Main Panel  ] |
   | +----------------------+ |
   | |          ?           | |
   | +----------------------+ |
   |                          |
   | Function      [  DCV   ] |
   | Range  [Auto] [   *    ] |
   | Ndigits       [  4.5   ] |
   | Trigger       [  Hold  ] |
   | Auto Zero     [   On   ] |
   |                          |
   +--------------------------+
 
The ID panel is in the form of a VEE object, with a sequence-in pin (to activate the object) on top and a sequence-out pin (to indicate when the object is done) on the bottom. The object menu for this ID panel appears as follows:

   +--------------------------+
   |       hp3478(LIVE)       |
   +------------------+-------+
   | Move             |       |
   | Size             |       |
   | Clone            |       |
   | Help             |       |
   +------------------+       |
   | Show Description |       |
   | Breakpoint       |       |
   |*Show Title       |       |
   | Change Title     |       |
   | Terminals       >|       |
   +------------------+       |
   | Add Terminals   >| ------+
   | Show Config      |
   |(Sync)            |
   +------------------+
   | Cut              |
   +------------------+
 
This is pretty much the same menu as used for any VEE object. "Help" in this case brings up a help file for the ID, not VEE Help. Of the entries unique to an ID object, "Show Config" shows a read-only duplicate of the configuration panels used to set up the ID (to change the configuration, you have to go back to "Configure I/O" again); and "Sync" in principle allows you to sync up the ID with the instrument if the settings on the two somehow get out of agreement -- but the 3478 ID doesn't have that capability, so that entry is disabled.

You programmatically control the ID by bringing out input and output pins. You can do this through the "Terminals" entry of the ID menu -- you get a list of the available components to allow you to select the appropriate input or output object.

However, if you find the list confusing, there's an easier way -- just click in "Add Terminals" and you get:


   | Terminals        |
   +----------------- +--------------------------+
   | Add Terminals   >| Select Input Component   |
   | Show Config      | Select Output Component  |
                      +--------------------------+
 
If you specify "Select Input Component", you get a banner at the top of the screen that says:

   Select component for input terminal
 
Then you click on the component you want to set up as an input pin. For example, in the case of the 3478, you could click on the "function" box and then get the input pin:

   +-------------------------------------+
   |             hp3478(LIVE)            |
   +----------+--------------------------+
   |          | [Reset] [  Main Panel  ] |
   |          | +----------------------+ |
   |          | |          ?           | |
   +----------+ +----------------------+ |
   | FUNCTION |                          |
   |   Int16  | Function      [  DCV   ] |
   +----------+ Range  [Auto] [   *    ] |
   |          | Ndigits       [  4.5   ] |
   |          | Trigger       [  Hold  ] |
   |          | Auto Zero     [   On   ] |
   |          |                          |
   +----------+--------------------------+
 
Similarly, if you specify "Select Output Component", you could select the display and get an output pin:

   +-----------------------------------------------+
   |                  hp3478(LIVE)                 |
   +----------+--------------------------+---------+
   |          | [Reset] [  Main Panel  ] |         |
   |          | +----------------------+ |         |
   |          | |          ?           | |         |
   +----------+ +----------------------+ +---------+
   | FUNCTION |                          | Reading |
   |   Int16  | Function      [  DCV   ] +---------+
   +----------+ Range  [Auto] [   *    ] |         |
   |          | Ndigits       [  4.5   ] |         |
   |          | Trigger       [  Hold  ] |         |
   |          | Auto Zero     [   On   ] |         |
   |          |                          |         |
   +----------+--------------------------+---------+
 
Of course, you can't make an output (like the display) an input pin -- you can only get an output pin if the component performs an input action (though even a query to validate an output command will do) -- and you can't make an input (like the function selector) an output pin.

Once you've set up input and output pins, then you can "wire" the ID object to other objects, with the constraint that the objects have to provide compatible data types. With the display output pin -- "Reading" -- that's easy, since it just outputs a real number and most VEE objects swallow that easily.

However, this is more complicated in the case of the function selector, since it provides control over a list of the functions that the 3478 can be set to; the elements in this list are numbered, so the object that drives the input pin has to provide the number of the list item to select the proper function.

* Configuring a driver can become a complicated task ... often because they are not particularly well documented. There are a few tricks that can help, however. The user was using a spectrum analyzer ID with the front panel view:


   +-------------------------------------------------------------+
   |             newDevice10 (hp8990_1 @ (NOT LIVE))             |
   +--+----------------------------+--------------------------+--+
   |  |                            | [Reset] [  Main Panel  ] |  |
   |  |                            |                          |  |
   |  |                            | Timebase     [  100 u  ] |  |
   |  |                            | Sweep Mode   [  100 u  ] |  |
   |  |                            | Trg  [1][   0   ][ Pos ] |  |
   |  |                            | CH1  [    1 m   ]        |  |
   |  |                            | CH2  [  500 m   ][  1  ] |  |
   |  |                            | CH3  [  500 m   ][  1  ] |  |
   |  +----------------------------+ CH4  [    1 m   ]        |  |
   |  | [Dig ] [ Autoscale ] [Run ]|                          |  |
   |  | [*CH1] [ CH2] [ CH3] [ CH4]|                          |  |
   +--+----------------------------+--------------------------+--+
 
Once the instrument panel is on the HP VEE screen, he could identify the different components by moving the mouse over the component he wanted to control -- then, while holding down the Shift key on the keyboard, clicking the left mouse button. This would display the value of that component.

The "Timebase" component above has a value of "100u" (100E-6). If he moved the mouse over the box with the "100u", held down the shift key on the keyboard, and clicked the left mouse button, he would get this value in a pop-up window:


   +-----------------------+
   |  Value for TIME_SENS  |
   +-----------------------+
   |         100 u         |
   |                       |
   |        [ OK ]         |
   +-----------------------+
 
Note this gives the component name: TIME_SENS.

* The ID's help menu provides a full (if terse) list of the component. If you bring up the toaster menu and select "Help", you get a table of contents for the Help topics. Select "Components P-Z" at the bottom of the list.

This give a list of component definitions from P onward, where you can find an entry for TIME_SENS. It specifies that its valid values are REALs from 2E-9 through 5, and the initial value is 100E-6 (100u).

* Checking out some of the components in the list can be instructive. For example, consider SWEEP_MODE. The list gives the valid values AUTO, TRIGGER, and SINGLE, and the initial value is AUTO. The component definition (as obtained by the tricks at the beginning of this note define it as "SWEEP_MODE (Enum, 0 to 2)", or an "enumerated list" -- basically a numbered list -- where:


   0 = AUTO
   1 = TRIGGER
   2 = SINGLE
 
Now this is where things get tricky. Under VEE you have an "enum" data type that allows you to specify a list of items -- in a variety of formats, very often a list of buttons -- and so the obvious conclusion would be that you can use a VEE "enum" object to drive this pin, as follows:

   +-------------+   +----------------
   |    enum     |   |
   +-------------+   +------------+----
   | <*> AUTO    |   |            |
   | < > TRIGGER +-->| SWEEP_MODE |
   | < > SINGLE  |   |            |
   +-------------+   +------------+----
 
Unfortunately, this won't work. The pin requires the numeric values of 0, 1, or 2, not the list items "AUTO", "TRIGGER", or "SINGLE", which is what the "enum" outputs. Why this contradiction? Because the instrument driver technology predates VEE -- they were originally designed for our ITG product -- and the terms "enum" mean different things to the driver and to VEE. It would have been better to change the driver terminology to something different, like "discrete" instead of "enum", but we're stuck with it.

Not really a problem, though. You can use a VEE "ordinal" function to convert the list item into its list numbering and get the desired result:


   +-------------+                   +----------------
   |    enum     |                   |
   +-------------+                   +------------+----
   | <*> AUTO    |   +-----------+   |            |
   | < > TRIGGER +-->| ordinal() +-->| SWEEP_MODE |
   | < > SINGLE  |   +-----------+   |            |
   +-------------+                   +------------+----
 
Select "AUTO" and the "ordinal()" function converts it to "0"; select "TRIGGER" and "ordinal()" converts it to "1"; and select "SINGLE" and "ordinal" converts it to "2". Note that since the driver is only using the numeric value obtained from the enum object, you can modify the labels on the enum object as you please, as long as the list ordering is correct.

* In this fashion you can configure an ID to operate as a VEE object, and wire it into VEE programs. Note that each time you activate a panel driver by firing its input or sequence-in pins, all the settings on that panel are sent to the instrument (or, at least, all of the settings that differ on the panel from the instrument's current state are sent); that is why a panel driver is also known as a "state" driver, since it sends a complete "state" to the instrument.

* You can also (where speed is desired or you only want minimal functionality) set up a so-called "component driver", which only contains exactly the elements you want. If you go through I/O configuration but this time select a component driver for the 3478, you get a dull featureless box:


   +------------------+
   |   hp3478(LIVE)   |
   +------------------+
   |                  |
   +------------------+
 
You can add terminals through the object menu, just the same way as you do for the full panel ID. You have to use the "Terminals" menu, of course, since with a component ID "Add Terminals" doesn't make any sense (no elements to select with a mouse, right?). Adding the same terminals as before with the panel ID gives a component ID of the form:

   +---------------------------------------+
   |              hp3478(LIVE)             |
   +----------+------------------+---------+
   | FUNCTION |                  | Reading |
   |   Int16  |                  |         |
   +----------+------------------+---------+
 
You can add more terminals as you like.

Note the major distinction between the operation of panel and component drivers. If you "ping" the sequence-in pin of a panel driver, as noted, all the settings of that instance of the panel driver will be updated to the instrument. This means all the settings. Any different settings made earlier to the instrument are changed.

This means you cannot (as one user did even though we told him it wouldn't work) chain together three panel state through their sequence-in and sequence-out pins, bring out pins for different settings on each panel driver, and expect to get intelligent results. The settings made for one panel driver were promptly set back to the defaults by the next one in the chain.

If you want to establish settings in this way, you need to use a component driver. A component driver establishes only the setting you tell it to set. Of course, this may have side-effects, but nobody ever said -- well, at least nobody who knew what they were saying -- that instrument drivers would allow you to use a complicated instrument without having a fairly good idea of how that instrument works.

 TOP OF PAGE

[8.2] VXI P&P; DRIVER SUPPORT

* VEE 3.12 was the first version of VEE to support VXI Plug&Play drivers, but it was a rudimentary Call-Function based scheme that had little value. VEE 3.2 provided a better solution, though the scheme is still very different from the traditional HPIB drivers in that Plug&Play drivers are essentially C function libraries, and in that they are accessed through the standard VISA I/O library rather than the HP SICL library.

A P&P driver comes as a set of four files:

These are installed into the appropriate directories set up by the VISA installation utility.

This done, you can then go to "I/O->VXIplug&play Instruments->Configuration" to configure the instrument:


   +-----------------------------------------------------------------+
   |              VXIplug&play Instrument Configuration              |  
   +-----------------------------------------------------------------+
   |  Currently Configured Instruments:                              |
   | +-------------------------------------+  [  Add Instrument   ]  |
   | | newDevice(hpvisa@GPIB0::12::INSTR   |                         |
   | |                                     |  [ Delete Instrument ]  |
   | |                                     |                         |
   | |                                     |  [  Edit Instrument  ]  |
   | |                                     |                         |
   | |                                     |                         |
   | |                                     |                         |
   | |                                     |                         |
   | |                                     |                         |
   | +-------------------------------------+                         |
   +-----------------------------------------------------------------+
   |               [  OK    ]  [ Cancel ]  [  Help  ]                |
   +-----------------------------------------------------------------+
 
This is very similar to the traditional instrument configuration box (if not exactly the same). If you want to add or edit an instrument you get:

   +---------------------------------------------------------+
   |            VXIplug&play Device Configuration            |
   +---------------------------------------------------------+
   |                                     +-----------------+ |
   |  HP VEE name (eg dvm):              | MyDriver        | |
   |                                     +-----------------+ |
   |                                     +---------------+-+ |
   |  VXIplug&play Driver Name:          | HPE1410       |v| |
   |                                     +---------------+-+ |
   | +- Parameters to init() call -------------------------+ |
   | |                                +------------------+ | |
   | | Address (eg GPIB0::12::INSTR): | GPIB0::12::INSTR | | |
   | |                                +------------------+ | |
   | | [*] Perform Identification Query                    | |
   | |                                                     | |
   | | [*] Perform Reset                                   | |
   | |                                                     | |
   | +-----------------------------------------------------+ |
   +---------------------------------------------------------+
   |            [  OK   ] [ Cancel ] [  Help  ]              |
   +---------------------------------------------------------+
 
The "HP VEE Name" is an arbitrary string to designate the driver. Spaces are significant but the name is not case-sensitive. The "VXIplug&play Driver Name" is, naturally, the name of the driver file.

The parameters are obvious: the address follows the VISA format rather than the standard VEE format. The two flags allow you to perform an ID query to confirm what the instrument really is and to reset the instrument on driver initialization.

* Once you have configured a driver, you can then select a To/From VXIplug&play object from the "I/O->VXIplug&play->To/From VXIplug&play". It looks just like any other transaction box:


   +---------------------------------------------------+
   |                 To/From NewDevice                 |  
   +------+-------------------------------------+------+
   |      |                                     |      |
   |      |                                     |      |
   |      |                                     |      |
   |      |                                     |      |
   |      |                                     |      |
   +------+-------------------------------------+------+
 
However, when you select a transaction you get something very different from the usual transaction-configuration dialogue, something that more looks like a "browser" into the VXIp&p library:

   +-------------------------------------------------+
   |            Select A Function Panel              |  
   +-------------------------------------------------+
   | [ ] HPE1410                                     |
   |  |                                              |
   |  +-[-] High Level Control                       |
   |  |  |                                           |
   |  |  +-[+] Measure                               |
   |  |  +-[ ] Configure Current Settings            |
   |  |  +-[f] Read Using Current Settings <--       |
   |  |                                              |
   |  +-[-] Low Level Control                        |
   |  |  |                                           |
   |  |  +-[f] Initiate Measurement                  |
   |  |  +-[f] Abort Measurement                     |
   |  |  +-[f] Fetch Data from Instrument            |
   |  |  +-[f] Execute Immediate Trigger             |
   |  |  +-[ ] Configure                             |
   |  |  +-[ ] Calibration                           |
   |  |                                              |
   +-----------------------------------------------+-+
   | Places the multimeter in the wait-for-trigger |^|
   | state and transfers readings directly to the  | |
   | output buffer after receiving a trigger.      |v|
   +-----------------------------------------------+-+
   |            [   OK   ]  [ Cancel ]               |
   +-------------------------------------------------+
 
This "browser" is hierarchically arranged with "folders" that open up in a tree fashion until you reach actual functions (designated by "f" above). You can think of this as much like a file manager, with function groups replacing directories and functions replacing files.

Once you select a function you get a tabfolder dialogue to set its features. There are two tabs: "Panel", to allow you to set the contol values to the function, and "Parameters", which allows you to specify the parameters to be passed to and returned from the function:


   +--------------------------------------------------------------------+
   |           Edit Function Panel for hpe1410_measure_Q()              |  
   +--------------------------------+-----------------------------------+
   |             Panel              |           Parameters              |
   |                                +-----------------------------------+
   |                                                                    |
   |           function    +-+               reading                    |
   |            Frequency -| |           [0.0000E+000   ]               |
   |               Period -| |                                          |
   |    4-Wire Resistance -| |                                          |
   |    2-Wire Resistance -| |                                          |
   |           AC Voltage -| |                                          |
   |        AC+DC Voltage -| |                                          |
   |           DC Voltage -|H|                                          |
   |                       +-+                                          |
   |   Session Handle                                   Status          |
   |   [0           ]                                [#H0           ]   |
   +--------------------------------------------------------------------+
   | hpe1410_measure_Q(vi, hpe1410_CONF_VOLT_DC, reading)               |
   +--------------------------------------------------------------------+
   |           [   OK   ] [   NOP  ] [ Cancel ] [  Help  ]              |
   +--------------------------------------------------------------------+

   +--------------------------------------------------------------------+
   |           Edit Function Panel for hpe1410_measure_Q()              |  
   +--------------------------------+-----------------------------------+
   |             Panel              |            Parameters             |
   +--------------------------------+                                   |
   | +- function -----------------------------------------------------+ |
   | |                                                                | |
   | | Parameter Type:   <*> Constant  < > Variable                   | |
   | |                                                                | |
   | | Name: [ hpe1410_CONF_VOLT_DC       ] [ ] Create Input Terminal | |
   | +- reading ------------------------------------------------------+ |
   | |                                                                | |
   | | Parameter Type:   < > Constant  <*> Variable                   | |
   | |                                                                | |
   | | Name: [ reading                   ] [x] Create Output Terminal | |
   | +----------------------------------------------------------------+ |
   |                                                                    |
   +--------------------------------------------------------------------+
   | hpe1410_measure_Q(vi, hpe1410_CONF_VOLT_DC, reading)               |
   +--------------------------------------------------------------------+
   |           [   OK   ] [   NOP  ] [ Cancel ] [  Help  ]              |
   +--------------------------------------------------------------------+
 
Once done, then the function is sent up in the To/From VXIp&p box with the appropriate input and output terminals:

   +------------------------------------------------------+
   |                  To/From NewDevice                   |  
   +------+-------------------------------------+---------+
   |      | hpe1410_measure_Q(vi, hpe1410_CONF_ |         |
   |      |                                     |         |
   |      |                                     | reading +-->
   |      |                                     |         |
   |      |                                     |         |
   |      |                                     |         |
   +------+-------------------------------------+---------+
 
If you select Help from the object menu, you get the driver's help file in a real live Windows (or Windows-like on UX) help utility.

Note that the Bus I/O Monitor does not work with VXIp&p drivers. Note also that VXIp&p drivers are always in live mode. If you run a program you have to have instruments connected (though you can set up function calls without any instruments available).

 TOP OF PAGE


 LAST PAGE  BACK TO INDEX  NEXT PAGE