viWrite

Agilent VISA.NET

viWrite

Syntax

viWrite(ViSession vi, ViBuf buf, ViUInt32 count, ViPUInt32 retCount);

Description

This function synchronously transfers data to a device. The data to be written is in the buffer represented by buf. This function returns only when the transfer terminates. Only one synchronous write function can occur at any one time. If you pass VI_NULL as the retCount parameter to the viWrite operation, the number of bytes transferred will not be returned. This may be useful if it is important to know only whether the operation succeeded or failed.

Note: If you are using viWrite in Visual Basic 6, see Notes on Using viRead/viWrite in Visual Basic 6 for information on modifying its declaration to allow efficient reading and writing of numeric arrays.

Parameters

Name

Dir

Type

Description

vi

IN

ViSession

Unique logical identifier to a session.

buf

IN

ViBuf

Represents the location of a data block to be sent to device.

count

IN

ViUInt32

Specifies number of bytes to be written.

retCount

OUT

ViPUInt32

Represents the location of an integer that will be set to the number of bytes actually transferred.

Special Value for retCount Parameter

Value

 

 

Description

VI_NULL

 

 

Do not return the number of bytes transferred.

Return Values 

Type ViStatus

This is the function return status. It returns either a completion code or an error code as follows.

Completion Codes

Description

VI_SUCCESS

Transfer completed.

Error Codes

Description

VI_ERROR_BERR

Bus error occurred during transfer.

VI_ERROR_CONN_LOST

The I/O connection for the given session has been lost.

VI_ERROR_INP_PROT_VIOL

Device reported an input protocol error occurred during transfer.

VI_ERROR_INV_SESSION
VI_ERROR_INV_OBJECT

The given session or object reference is invalid (both are the same value).

VI_ERROR_INV_SETUP

Unable to start write function because setup is invalid (due to attributes being set to an inconsistent state).

VI_ERROR_IO

Unknown I/O 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 de-asserted).

VI_ERROR_NSUP_OPER

The given vi does not support this function.

VI_ERROR_RAW_RD_PROT_VIOL

Violation of raw read protocol occurred during transfer.

VI_ERROR_RAW_WR_PROT_VIOL

Violation of raw write protocol occurred during transfer.

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 function completed.

See Also

viRead
Notes on Using viRead/viWrite in Visual Basic 6