niDMM_InitWithOptions

NI-DMM C/CVI/VB

niDMM_InitWithOptions

ViStatus = niDMM_InitWithOptions(ViString Resource_Name, ViBoolean ID_Query, ViBoolean Reset_Device, ViString Option_String, ViSession* Instrument_Handle)

Purpose

This function completes the following tasks:

  • Creates a new IVI instrument driver session and, optionally, sets the initial state of the following session attributes: RangeCheck, QueryInstrStatus, Cache, Simulate, Recordcoercions.
  • Opens a session to the device 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_Device 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.

Parameters

Input
Name Type Description
Resource_Name ViString Contains the Resource_Name of the device to initialize. The Resource_Name is assigned in Measurement & Automation Explorer (MAX). Refer to Related Documentation for the NI Digital Multimeters Getting Started Guide for more information about configuring and testing the DMM in MAX.

Valid Syntax:

  • NI-DAQmx name
  • DAQ::NI-DAQmx name[::INSTR]
  • DAQ::Traditional NI-DAQ device number[::INSTR]
  • IVI logical name
Caution  All IVI names for the Resource_Name, such as logical names or virtual names, are case-sensitive. If you use logical names, driver session names, or virtual names in your program, you must make sure that the name you use matches the name in the IVI Configuration Store file exactly, without any variations in the case of the characters in the name.
ID_Query ViBoolean Verifies that the device you initialize is one that the driver supports. NI-DMM automatically performs this query, so setting this parameter is not necessary.

Defined Values:

VI_TRUE (default) 1 Perform ID Query
VI_FALSE 0 Skip ID Query
Reset_Device ViBoolean Specifies whether to reset the instrument during the initialization procedure.

Defined Values:

VI_TRUE (default) 1 Reset Device
VI_FALSE 0 Don't Reset
Option_String ViString Sets the initial value of certain attributes for the session. The following table specifies the attribute name, attribute constant, and default value for each attribute that you can use in this parameter:

Check NIDMM_ATTR_RANGE_CHECK VI_TRUE 1
QueryInstrStatus NIDMM_ATTR_QUERY_INSTR_STATUS VI_FALSE 0
Cache NIDMM_ATTR_CACHE VI_TRUE 1
Simulate NIDMM_ATTR_SIMULATE VI_FALSE 0
RecordCoercions NIDMM_ATTR_RECORD_COERCIONS VI_FALSE 0
DriverSetup NIDMM_ATTR_DRIVER_SETUP "" (empty string) ""

The format of this string is, "AttributeName=Value." To set multiple attributes, separate their assignments with a comma.

If you pass NULL or an empty string for this parameter, the session uses the default values for the attributes. You can override the default values by assigning a value explicitly in an Option_String parameter. You do not have to specify all of the attributes and may leave any of them out (those left out use the default value).

Refer to Simulating NI Digital Multimeters for more information.

Output
Name Type Description
Instrument_Handle ViSession* Returns a ViSession handle that you use to identify the instrument in all subsequent instrument driver function calls.

Return Value

Name Type Description
Status ViStatus Reports the Status of this operation. To obtain a text description of the status code, call niDMM_error_message. To obtain additional information concerning the error condition, use niDMM_GetError.