pi40iv_init

ViStatus pi40iv_init (ViRsrc resourceName, ViBoolean IDQuery, ViBoolean resetDevice, ViPSession instrumentHandle);

Purpose

This function performs the following initialization actions:
- Creates a new IVI instrument driver session.
- Opens a session to the specified device using the interface and address you specify for the Resource Name parameter.
- If the ID Query parameter is set to VI_TRUE, this function queries the instrument ID and checks that it is valid for this instrument driver.
- If the Reset parameter is set to VI_TRUE, this function resets the instrument to a known state.
- Sends initialization commands to set the instrument to the state necessary for the operation of the instrument driver.
- Returns a ViSession handle that you use to identify the instrument in all subsequent instrument driver function calls.
Note:  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 pi40iv_LockSession and pi40iv_UnlockSession functions to protect sections of code that require exclusive access to the resource.

Parameters

Input
Name Type Description
resourceName ViRsrc

Pass the resource name of the device to initialize.
You can also pass the name of a virtual instrument or logical name that you configure with the IVI Configuration utility.  The virtual instrument identifies a specific device and specifies the initial settings for the session.  A logical Name identifies a particular virtual instrument.
Refer to the following table below for the exact grammar to use for this parameter.  Optional fields are shown in square brackets ([]).
Syntax
------------------------------------------------------
GPIB[board]::<primary address>[::secondary address]::INSTR
VXI[board]::<logical address>::INSTR
GPIB-VXI[board]::<logical address>::INSTR
ASRL<port>::INSTR
<LogicalName>
[VInstr->]<VirtualInstrument>
If you do not specify a value for an optional field, the following values are used:
Optional Field - Value
------------------------------------------------------
board - 0
secondary address - none (31)
The following table contains example valid values for this parameter.
"Valid Value" - Description
------------------------------------------------------
"GPIB::22::INSTR" - GPIB board 0, primary address 22 no
secondary address
"GPIB::22::5::INSTR" - GPIB board 0, primary address 22
secondary address 5
"GPIB1::22::5::INSTR" - GPIB board 1, primary address 22
secondary address 5
"VXI::64::INSTR" - VXI board 0, logical address 64
"VXI1::64::INSTR" - VXI board 1, logical address 64
"GPIB-VXI::64::INSTR" - GPIB-VXI board 0, logical address 64
"GPIB-VXI1::64::INSTR" - GPIB-VXI board 1, logical address 64
"ASRL2::INSTR" - COM port 2
"SampleInstr" - Logical name "SampleInstr"
"VInstr->xyz432" - Virtual Instrument "xyz432"
"xyz432" - Logical Name or Virtual Instrument "xyz432"
/*=CHANGE:===================================================*
Modify the following default value so that it reflects the default address for your instrument.  You must make the corresponding change to the Default Value entry for the control.
*================================================END=CHANGE=*/
Default Value:  "VXI::14::INSTR"
Note: You specify the resource name with the "VInstr->" if you have the logical name that is the same as the virtual instrument name and you want to explicitly use the virtual instrument name. Otherwise, the driver uses the logical name.

IDQuery ViBoolean

Specify whether you want the instrument driver to perform an ID Query.
Valid Range:
VI_TRUE  (1) - Perform ID Query (Default Value)
VI_FALSE (0) - Skip ID Query
When you set this parameter to VI_TRUE, the driver verifies that the instrument you initialize is a type that this driver supports.  
Circumstances can arise where it is undesirable to send an ID Query command string to the instrument.  When you set this parameter to VI_FALSE, the function initializes the instrument without performing an ID Query.

resetDevice ViBoolean

Specify whether you want the to reset the instrument during the initialization procedure.
Valid Range:
VI_TRUE  (1) - Reset Device (Default Value)
VI_FALSE (0) - Don't Reset

Output
Name Type Description
instrumentHandle ViSession (passed by reference)

Returns a ViSession handle that you use to identify the instrument in all subsequent instrument driver function calls.
Notes:
(1) 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.  
(2) 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 the same IVI session in multiple execution threads.  You can use functions pi40iv_LockSession and pi40iv_UnlockSession to protect sections of code that require exclusive access to the resource.

Return Value

Name Type Description
status ViStatus

Returns the status code of this operation.  The status code  either indicates success or describes an error or warning condition.  You examine the status code from each call to an instrument driver function to determine if an error occurred.
To obtain a text description of the status code, call the pi40iv_error_message function.  To obtain additional information about the error condition, call the pi40iv_GetErrorInfo function.  To clear the error information from the driver, call the pi40iv_ClearErrorInfo function.
The general meaning of the status code is as follows:
Value                  Meaning
-------------------------------
0                      Success
Positive Values        Warnings
Negative Values        Errors
This driver defines the following status codes:
Status    Description
-------------------------------------------------
WARNINGS:
/*=CHANGE:===================================================*
Insert Instrument-defined warning codes here.
*================================================END=CHANGE=*/
ERRORS:
/*=CHANGE:===================================================*
Insert Instrument-defined error codes here.
*================================================END=CHANGE=*/
This instrument driver also returns errors and warnings defined by other sources.  The following table defines the ranges of additional status codes that this driver can return.  The table lists the different include files that contain the defined constants for the particular status codes:
Numeric Range (in Hex)   Status Code Types
-------------------------------------------------
3FFA2000 to 3FFA3FFF     IviSwtch Warnings
3FFA0000 to 3FFA1FFF     IVI      Warnings
3FFF0000 to 3FFFFFFF     VISA     Warnings
3FFC0000 to 3FFCFFFF     VXIPnP   Driver Warnings
BFFA2000 to BFFA3FFF     IviSwtch Errors
BFFA0000 to BFFA1FFF     IVI      Errors
BFFF0000 to BFFFFFFF     VISA     Errors
BFFC0000 to BFFCFFFF     VXIPnP   Driver Errors

References

Pickering Interfaces PXI/LXI IVI Switch
Alphabetical Function Index
Hierarchical Function Index