Prefix_IviInit

IVI Library

Prefix_IviInit

ViStatus Prefix_IviInit (ViRsrc resourceName, ViBoolean idQuery, ViBoolean reset, ViSession vi);

Purpose

Contains the bulk of the code to initialize an instrument driver session. Prefix_InitWithOptions calls Prefix_IviInit after it calls Ivi_SpecificDriverNew to create the IVI session

Note    Refer to Prefix_init for a description of the initialization actions and parameters. This function description documents only the implementation requirements for Prefix_IviInit.

Implementation Requirements

Call Ivi_BuildChannelTable to specify the set of valid channel strings for the instrument. If the instrument does not have multiple channels, specify "1" for the channel strings.

Create all of the attributes you want to use, excluding the inherent IVI attributes. If you are developing your driver according to a class definition, create the class attributes that you want to use. Generally, you should create the attributes in an internal Prefix_InitAttributes function. If you use the instrument driver developer wizard, the wizard creates this function for you. You must have this function in your source file to be able to use the attribute editor.

If simulation is disabled, create the I/O session, and set the IVI_ATTR_IO_SESSION attribute. Configure the I/O interface.

If the reset parameter is VI_TRUE, call Prefix_reset. Otherwise, if not simulating, send the default setup commands to the instrument. It is best to have an internal Prefix_DefaultInstrSetup function for this purpose because Prefix_reset also sends the default setup commands.

If the idQuery parameter is VI_TRUE and simulation is disabled, verify the identity of the instrument if possible. For IEEE 488.2 compatible instruments, use the *IDN? query. For VXI register-based instruments, check the manufacturer ID and model number. Return an error if the instrument is not one that the driver supports.

Finally, check the status of the instrument. Typically, you do this by calling an internal Prefix_CheckStatus function. The instrument driver developer wizard generates the internal Prefix_CheckStatus function for you. The internal Prefix_CheckStatus function calls the check status callback if status checking is enabled, simulation is disabled, and the driver has performed instrument I/O since the last time it queried the instrument status.

If a failure occurs after you open the I/O session, close the I/O session and set the IVI_ATTR_IO_SESSION parameter back to 0.