viClear
Purpose
Clears a device.
C Syntax
ViStatus viClear(ViSession vi)
Visual Basic Syntax
viClear&(ByVal vi&)
Resource Classes
GPIB INSTR, GPIB-VXI INSTR, Serial INSTR, TCPIP INSTR, TCPIP SOCKET, USB INSTR, USB RAW, VXI INSTR
Parameters
Name | Direction | Description |
---|---|---|
vi |
IN |
Unique logical identifier to a session. |
Return Values
Completion Codes | Description |
---|---|
VI_SUCCESS |
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_BERR |
Bus error occurred during transfer. |
VI_ERROR_NCIC |
The interface associated with the given vi is not currently the controller in charge. |
VI_ERROR_NLISTENERS |
No-listeners condition is detected (both NRFD and NDAC are unasserted). |
VI_ERROR_INV_SETUP |
Unable to start operation because setup is invalid (due to attributes being set to an inconsistent state). |
VI_ERROR_CONN_LOST |
The I/O connection for the given session has been lost. |
Description
The viClear() operation clears the device input and output buffers. The bus-specific details are:
Clear for 488.2 Instruments (GPIB, VXI, TCPIP, and USB)
- For a GPIB device, VISA sends the Selected Device Clear command.
- For a VXI device, VISA sends the Word Serial Clear command.
- For a USB device, VISA sends the INITIATE_CLEAR and CHECK_CLEAR_STATUS commands on the control pipe.
Clear for Non-488.2 Instruments (Serial INSTR, TCPIP SOCKET, and USB RAW)
- For Serial INSTR sessions, VISA flushes (discards) the I/O output buffer, sends a break, and then flushes (discards) the I/O input buffer.
- For TCPIP SOCKET sessions, VISA flushes (discards) the I/O buffers.
- For USB RAW sessions, VISA resets the endpoints referred to by the attributes VI_ATTR_USB_BULK_IN_PIPE and VI_ATTR_USB_BULK_OUT_PIPE.
Invoking viClear() also discards the read and write buffers used by the formatted I/O services for that session.
Related Topics