viVxiCommandQuery

NI-VISA 15.0 Help

Edition Date: June 2015

Part Number: 370131S-01

»View Product Info

Purpose

Sends the device a miscellaneous command or query and/or retrieves the response to a previous query.

C Syntax

ViStatus viVxiCommandQuery(ViSession vi, ViUInt16 mode, ViUInt32 cmd, ViPUInt32 response)

Visual Basic Syntax

viVxiCommandQuery&(ByVal vi&, ByVal mode%, ByVal cmd&, response&)

Resource Classes

VXI INSTR

Parameters

Name Direction Description

vi

IN

Unique logical identifier to a session.

mode

IN

Specifies whether to issue a command and/or retrieve a response. Refer to the Description section for actual values.

cmd

IN

The miscellaneous command to send.

response

OUT

The response retrieved from the device. If the mode specifies to send a command rather than retrieve a response, you can use VI_NULL for this parameter.

Return Values

Completion Codes Description

VI_SUCCESS

The operation completed successfully.

Error Codes Description

VI_ERROR_INV_OBJECT

The given session reference is invalid.

VI_ERROR_NSUP_OPER

The given vi does not support this operation.

VI_ERROR_RSRC_LOCKED

Specified operation could not be performed because the resource identified by vi has been locked for this kind of access.

VI_ERROR_TMO

Timeout expired before operation completed.

VI_ERROR_RAW_WR_PROT_VIOL

Violation of raw write protocol occurred during transfer.

VI_ERROR_RAW_RD_PROT_VIOL

Violation of raw read protocol occurred during transfer.

VI_ERROR_OUTP_PROT_VIOL

Device reported an output protocol error during transfer.

VI_ERROR_INP_PROT_VIOL

Device reported an input protocol error during transfer.

VI_ERROR_BERR

Bus error occurred during transfer.

VI_ERROR_RESP_PENDING

A previous response is still pending, causing a multiple query error.

VI_ERROR_INV_MODE

The value specified by the mode parameter is invalid.

Description

The viVxiCommandQuery() operation can send a command or query, or receive a response to a query previously sent to the device. The mode parameter specifies whether to issue a command and/or retrieve a response, and indicates the type or size of command and/or response to use. The following table defines the values for the mode parameter.

Mode Action Description

VI_VXI_CMD16

Send 16-bit Word Serial command.

VI_VXI_CMD16_RESP16

Send 16-bit Word Serial query; get 16-bit response.

VI_VXI_RESP16

Get 16-bit response from previous query.

VI_VXI_CMD32

Send 32-bit Word Serial command.

VI_VXI_CMD32_RESP16

Send 32-bit Word Serial query; get 16-bit response.

VI_VXI_CMD32_RESP32

Send 32-bit Word Serial query; get 32-bit response.

VI_VXI_RESP32

Get 32-bit response from previous query.

Notice that the mode you specify can cause all or part of the cmd or response parameters to be ignored.

  • If mode specifies sending a 16-bit command, the upper half of cmd is ignored.
  • If mode specifies retrieving a response only, cmd is ignored.
  • If mode specifies sending a command only, response is ignored. You can use VI_NULL for the value of response.
  • If mode specifies to retrieve a 16-bit value, the upper half of response is set to 0.

Refer to the VXI Specification for defined Word Serial commands.


Related Topics

INSTR Resource

WAS THIS ARTICLE HELPFUL?

Not Helpful