Manuals >Reference >Drivers
Print version of this Book (PDF file)
prevnext

Matrix Drivers

A matrix driver is a set of USERC functions designed to control the switching matrices through an HP 4084 controller from an IC-CAP Macro program. The matrix driver supports the matrices listed in the following table.

External user functions and internal design functions are described in this section. They are designed to be compatible with HP 4062UX TIS where possible.

Source files for this matrix driver are iceswm.h and iceswm.c. The header file iceswm.h is included in userc.c so that the function names can appear in the Function List of IC-CAP.

Source code is provided with this open interface.

Table 48 Types of Matrix Drivers 
Matrix
Controller
Pins
Device
HP 4085A
HP 4084A
48
HP 4062A and HP 4062B
HP 4085B
HP 4084B
48
HP 4062C and HP 4062UX
HP 4089A
HP 4084B
96
same as above, with 2 controllers

External Matrix Driver User Functions

This section describes the matrix driver external user functions.

SWM_debug    This function takes 1 argument and sets the internal debug flag. When the argument is 1, debugging information is printed out to the Status window; when the argument is 0, printing is turned off. It always returns 0. This function does not exist in TIS. An example call is:

 x = SWM_debug(1)

Every function looks at this flag and prints out any GPIB commands it is going to send, or a string it just received from a matrix controller.

SWM_init    This function takes 2 GPIB addresses, a matrix name, and a raw GPIB interface name to which the matrix is connected. The first GPIB address is for the block 1 (usually 19) and the second is for the block 2 (22). However, a different address can be assigned for each matrix controller. For the HP 4085A and HP 4085B (both 48-pin systems), the second address is used as the controller address, and the first address is ignored. It returns 0 when successful and -1 when it fails. This function does not exist in TIS. An example call is:

 x = SWM_init (19, 22, "HP4089A", "hpib"); ! for 96-pin

or

 x = SWM_init (0, 22, "HP4085B", "hpib");  ! for 48-pin

This function checks the matrix type and sets the internal type flag for subsequent matrix calls. It closes its private entity id from a previous matrix access (when it exists), and opens the given raw GPIB device file. Then it calls an internal function swm_init_unit to reset a controller. This clears all pins and ports.

Connect    This function takes a port address and a pin number and connects the given port to the pin. The port address is either 0 or from 32701 to 32711, inclusive. The pin number is 0 or from 1 to 48/96 inclusive. When a pin card does not exist for the given pin number, it gives an error message and aborts the Macro execution.

An example call is:

 x = Connect(32701, 25);

This function sends GPIB commands to the matrix controller and either connects or disconnects the specified port and pin. The following table lists argument combinations.

Table 49 Argument Combinations
Port Address
Pin Number
Description
0
0
Disconnect all pins from all ports.
0
X
Disconnect pin X from its connected port.
X
0
Disconnect all pins connected to port X.
X
Y
Connect port X to pin Y.

As in TIS, multiple pins can be connected to 1 port by calling this function several times. Pin numbers 1 through 48 belong to block 1; pin numbers 49 through 96 belong to block 2. When a 96-pin matrix is used, do not connect block 1 and block 2 pins to 1 single port. Because this function does not include switching delay, allow enough wait time before and after measurement to prevent relay damage. Virtual Front Panel (VFP) is not supported.

FNPort    This function takes a port number and returns a port address for Connect. This allows compatibility with the HP 4062UX. An example call is:

 port = FNPort(1);

Wait    This function takes a wait time, in seconds, to give a necessary delay to wait until SMU outputs become zero for dry switching. This function does not exist in TIS. It returns 0 when successful or -1 when it fails. An example call is:

 x = Wait (0.1) ! 100ms delay;

Internal Matrix Driver Functions

The internal functions described next support the user functions. Refer to the source file for each algorithm.

swm_connect_pin     This function takes a GPIB address of a controller, a port number, and a pin number. It sends a Pin Connect command to the controller, and is called from swm_connect (Connect) to actually perform the pin connection and disconnection.

swm_connect_port    This function takes a GPIB address and a port number to send a Port Connect command to the controller, which manages input relays of an HP 4089A matrix.

swm_cut_port_pin     This function takes a GPIB address and a pin number to cut the pin connection when a 96-pin matrix is used. It also checks if the port to which the pin was connected can be turned off; if it can (both Force and Guard are off), it turns off this port.


Note


When a switching matrix controller shares a single GPIB with other instruments, set the system variable INST_START_ADDR to a value greater than the matrix controller's GPIB address. This prevents IC-CAP from accessing the controller while performing Rebuild (instrument list).


swm_init_unit     This function takes a file designator (or eid, a small integer usually obtained by calling the open system function) and a GPIB address of a matrix controller. It is called from swm_init to initialize a controller and clear all pins and ports for which the controller is responsible.

swm_parse_err    This function takes a status byte sent from a matrix controller and determines the cause of an SRQ. If there is no error, it returns 0 to allow the caller to keep running. If there is an error, it returns -1 to abort the execution of the caller.

swm_release_port     This function takes a GPIB address and a port number to send a Port Disconnect command to the controller only when a 96-pin matrix is used. Because block 1 and block 2 pins should not be connected to a single port, a disconnect request such as Connect(32701, 0) not only cuts the connection between a port and a pin, but also disconnects the input relays of the port.


prevnext