SpecificDriverNew

IVI Library

Ivi_SpecificDriverNew

Usage

ViStatus Ivi_SpecificDriverNew(ViChar specificDriverPrefix[ ], ViChar optionString[ ], ViSession vi);

Purpose

This function performs the following initialization actions:

  • Creates a new IVI session to a specific instrument driver and optionally sets the initial state of the following session attributes:

    IVI_ATTR_RANGE_CHECKIVI_ATTR_QUERY_INSTRUMENT_STATUS
    IVI_ATTR_CACHE
    IVI_ATTR_SIMULATE
    IVI_ATTR_RECORD_COERCIONS
    IVI_ATTR_DRIVER_SETUP
    IVI_ATTR_INTERCHANGE_CHECK

  • Returns a ViSession handle which you use in subsequent function calls to identify the session.

    This function creates a new session each time you invoke it. Although you can open more than one IVI session for the same resource, it is best not to do so. You can use the same session in multiple program threads. You can use the Ivi_LockSession and Ivi_UnlockSession functions to protect sections of code that require exclusive access to the resource.

Note  This function does not create a VISA session to any instrument resources. If you use VISA to communicate to the instrument, you must create a VISA session yourself and set the IVI_ATTR_IO_SESSION attribute to that value. Otherwise, you can use the IVI_ATTR_IO_SESSION attribute to hold a handle to whatever communications resource you use.

Parameters

Name Type Description
specificDriverPrefix ViChar[ ]

This parameter specifies the prefix of the specific instrument driver. Every user-callable function in the driver must start with this prefix as part of its function name. For example, if the Fluke 45 driver has a user-callable function named "fl45_init", then "fl45" is the prefix for that driver.

optionString ViChar[ ]

You can use this parameter to set the initial value of certain IVI attributes for the session. The following table lists the attributes, their default initial values, and the name you use in this parameter to identify the attribute.

Name Attribute Defined Constant Default
RangeCheck IVI_ATTR_RANGE_CHECK VI_TRUE
QueryInstrStatus IVI_ATTR_QUERY_INSTRUMENT_STATUS VI_FALSE
Cache IVI_ATTR_CACHE VI_TRUE
Simulate IVI_ATTR_SIMULATE VI_FALSE
RecordCoercions IVI_ATTR_RECORD_COERCIONS VI_FALSE
DriverSetup IVI_ATTR_DRIVER_SETUP VI_FALSE
Interchange Check IVI_ATTR_INTERCHANGE_CHECK VI_FALSE

If you pass NULL or an empty string for this parameter, the session uses the default values. You can override the default values by assigning a value explicitly in a string you pass for this parameter.

The format of an assignment is, "Name=Value" where Name is the first column in the table above, and Value is any one of the following.

To set the attribute to VI_TRUE, use VI_TRUE, True, or 1.
To set the attribute to VI_FALSE, use VI_FALSE, False, or 0.

The function interprets the Name and Value in a case-insensitive manner.

To set multiple attributes, separate the assignments with commas.

You do not have to specify all of the attributes. If you do not specify one of the attributes, the session uses its default value.

Note  Normally, you use this function to implement the PREFIX_init and PREFIX_InitWithOptions in the specific instrument driver. In PREFIX_init, you pass in an empty string. In PREFIX_InitWithOptions, you pass the Options String parameter that the user passed to PREFIX_InitWithOptions.
vi ViSession

Returns a ViSession handle that you use to identify the session in subsequent function calls.

This function creates a new session each time you invoke it. This is useful if you have multiple physical instances of the same type of instrument.

Avoid creating multiple concurrent sessions to the same physical instrument. Although you can create more than one IVI session for the same resource, it is best not to do so. A better approach is to use same session in multiple execution threads. You can use functions Ivi_LockSession and Ivi_UnlockSession to protect sections of code that require exclusive access to the resource.

Return Value

Contains the status code that the function call returns. IVI engine functions can return error and warning values from several sets of status codes. Some status codes are unique to the IVI engine. Other status codes are the same codes that VISA Library functions return. Still others are error or warning values that functions in specific instrument drivers return. Each set of status codes has its own numeric range.

Regardless of the source of the status code, 0 always indicates success, a positive value indicates a warning, and a negative value indicates an error.

Related Topic

IVI Status Codes