IBRDA

NI-488.2

IBRDA

Board-Level/Device-Level


Purpose

Read data asynchronously from a device into a user buffer.

Format

C

unsigned long ibrda (int ud, void *rdbuf, size_t count)

Visual Basic

CALL ibrda (ud%, rdbuf$)

or

status% = ilrda (ud%, rdbuf$, count&)

Interactive Control (Usage Notes)

ibrda count

Input

ud Board or device unit descriptor
count Number of bytes to be read from the GPIB

Output

rdbuf Address of buffer into which data is read
Function Return The value of Ibsta

Description

Device-Level

If ud is a device descriptor, ibrda addresses the GPIB, begins an asynchronous read of up to count bytes of data from a GPIB device, and places the data into the buffer specified by rdbuf. The operation terminates normally when count bytes have been received or END is received. The actual number of bytes transferred is returned in the global function Ibcnt.

Board-Level

If ud is a board descriptor, ibrda reads up to count bytes of data from a GPIB device and places the data into the buffer specified by rdbuf. A board-level ibrda assumes that the GPIB is already properly addressed. The operation terminates normally when count bytes have been received or END is received. The operation terminates with an error if the board is not the CIC, and the CIC sends a Device Clear on the GPIB. The actual number of bytes transferred is returned in the global function Ibcnt.

Board- and Device-Level

The asynchronous I/O calls (ibcmda, ibrda, ibwrta) are designed so that applications can perform other non-GPIB operations while the I/O is in progress. Once the asynchronous I/O has begun, further NI-488.2 calls are strictly limited. Any calls that would interfere with the I/O in progress are not allowed; the driver returns EOIP in this case.

Once the I/O is complete, the application must resynchronize with the NI-488.2 driver. Resynchronization is accomplished by using one of the following calls:

ibwait If the returned Ibsta contains CMPL, the driver and application are resynchronized.
ibnotify If the Ibsta value passed to the ibnotify callback contains CMPL, the driver and application are resynchronized.
ibstop The I/O is canceled; the driver and application are resynchronized.
ibonl The I/O is canceled and the interface is reset; the driver and application are resynchronized.

Possible Errors

EABO Board-level: a Device Clear message was received from the CIC.
EADR Board-level: The GPIB is not correctly addressed; use ibcmd to address the GPIB.
Device-level: A conflict exists between the device GPIB address and the GPIB address of the device access board. Use ibconfig, options IbcPAD and IbcSAD.
EARG Either the buffer or the count is invalid.
EBUS Device-level: No devices are connected to the GPIB.
ECIC Device-level: The access board is not CIC. See Device-Level Calls and Bus Management.
EDVR The NI-488.2 driver is either configured incorrectly or is not properly installed.
EHDL ud is invalid or out of range.
ELCK The requested operation could not be performed because of an existing lock by another process.
ENEB The interface is not installed or is not properly configured.
EOIP Asynchronous I/O is in progress.