Skip to content

NI DMM Setup Functions

ni-siray edited this page Apr 27, 2021 · 16 revisions

Setup Functions

niDMM_init

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

Purpose

This function completes the following tasks:

  • Creates a new IVI instrument driver session.
  • Opens a session to the device you specify for the Resource_Name parameter.
  • If the ID_Query parameter is set to VI_TRUE (1), 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 (1), 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

Input
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
Input
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

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_GetErrorMessage. To obtain additional information concerning the error condition, use niDMM_GetError.

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

Input
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
Input
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
Input
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_GetErrorMessage. To obtain additional information concerning the error condition, use niDMM_GetError.

niDMM_close

ViStatus = niDMM_close(ViSession Instrument_Handle)

Purpose

Closes the specified session and deallocates resources that it reserved.

Parameters

Input
Name Type Description
Instrument_Handle ViSession Identifies a particular instrument session. You obtain the Instrument_Handle parameter from niDMM_init or niDMM_InitWithOptions. The default is None.

Return Value

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

Table of Contents

Internal Development

Creating and Setting Up a gRPC Server

Server Security Support

Creating a gRPC Client

gRPC Client Examples

Session Utilities API Reference

Driver Documentation

gRPC API Differences From C API

Sharing Driver Sessions Between Clients

C API Docs
NI-DAQmx
NI-DCPOWER
NI-DIGITAL PATTERN DRIVER
NI-DMM
NI-FGEN
NI-FPGA
NI-RFmx Bluetooth
NI-RFmx NR
NI-RFmx WCDMA
NI-RFmx GSM
NI-RFmx CDMA2k
NI-RFmx Instr
NI-RFmx LTE
NI-RFmx SpecAn
NI-RFmx TD-SCDMA
NI-RFmx WLAN
NI-RFSA
NI-RFSG
NI-SCOPE
NI-SWITCH
NI-TCLK
NI-XNET
Clone this wiki locally