Using an Alias to address PXI instruments

Knowledge Base Article # Q200187

Read Prior Article Read Next Article
Summary The PXI/PCI Explorer application can be used to assign an Alias to an instrument, which can be used to initialize the instrument in place of the slot number. This article presents a simple example of how to do this.
When writing a test program, often you must "hard code" the configuration of the test system into your application; for example, the PXI slot numbers of the instruments.  If a future system upgrade necessitates reordering the instrument slot numbers, you would need to modify the test program code to accommodate those changes - often requiring recertification of the test program before it can be released for use.

A more flexible approach, and one that avoids code recertification, is to use PXI/PCI Explorer to assign a text Alias in place of the instrument slot number, and reference the alias in your system configuration code.  The alias can remain the same regardless of which slot the instrument is installed in, so reordering instrument slots will not affect the test program code.  The following example illustrates this concept.

Assume you have two GX5282 Dynamic Digital I/O modules installed in slots 15 and 17 of your GX7000A system.  And assume that the GX5282 installed in slot 15 is going to be used for providing 32 channels of digital stimulus patterns to the UUT, and that the GX5282 installed in slot 17 will be used to capture 32 channels of digital response patterns from the UUT.  Using ATEasy to write your test program, you could initialize these instrument using the Driver Shortcut slot settings (figure 1), or by directly calling the initialization driver procedure, as shown below:

nMaster1:  Short=1
nMaster2:  Short=2
nSlot1:  Short=15
nSlot2:  Short=17


Using an Alias to address PXI instruments
Figure 1:  Setting the GX5282 Driver Shortcut slot number parameter

In both cases, if later the instrument slot positions were changed, the test program would need to be modified, recompiled and possibly recertified before the new program can be released.

However, if each instrument were assigned an alias text name, and the text name were used to initialize the instrument, instead of it's slot position, then the test program operation is independent of the instrument slot positions.  To assign an alias for these two instruments, open the PXI/PCI Explorer application that is installed with any Geotest product.  Expand the slot parameter for the GX5282 installed in slots 15 and 17.  Assign the alias for the GX5282 in slot 15 to "Stimulus", and the alias for the GX5282 in slot 17 to "Response" (figure 2).

Using an Alias to address PXI instruments
Figure 2:  Assigning the "Stimulus" and "Response" alias to the GX5282's

To initialize the instrument based on its assigned alias, use the HW function Long HwPciGetAliasChassisSlot(String sAlias).  The HW Device Driver installed with Geotest products provides low-level access and information about resources installed in a test system.  Insert the HW.DRV driver into your ATEasy System.  The HW.DRV HwPciGetAliasChassisSlot() function returns the slot position of the instrument matching the text string contained in the sAlias parameter, which can be used to initialize the instrument.  Additional information about the HW device driver can be found here.  The ATEasy code to initialize the GX5282's using their alias is:

gxStimulus:  Long
gxResponse:  Long

HW Initialize()

gxStimulus=HW Pci Get AliasLegacySlot("Stimulus")
DIO Initialize Master(1,gxStimulus)

gxResponse=HW Pci Get AliasLegacySlot("Response")
DIO1 Initialize Master(2,gxResponse)

In summary, using an alias in place of an instrument slot number provides many benefits, the most important being decoupling the instrument slot position from your test code and providing configuration independent operation of your test program.
Article Date 2/4/2010
Keywords HW Driver, Device Driver, Alias, PXI/PCI Explorer, ATEasy, GX5282, GX7000

0 ratings | 0 out of 5
Read Prior Article Read Next Article