IBWRTA
Board-Level/Device-Level
Purpose
Write data asynchronously to a device from a user buffer.
Format
C
unsigned long ibwrta (int ud, const void *wrtbuf, size_t count)
Visual Basic
CALL ibwrta (ud%, wrtbuf$)
or
status% = ilwrta (ud%, wrtbuf$, count&)
Interactive Control (Usage Notes)
ibwrta wrtbuf
Input
ud | Board or device descriptor |
wrtbuf | Address of the buffer containing the bytes to write |
count | Number of bytes to be written |
Output
Function Return | The value of Ibsta |
Description
Device-Level
If ud is a device descriptor, ibwrta addresses the GPIB properly and writes count bytes from wrtbuf to a GPIB device. The operation terminates normally when count bytes have been sent. The actual number of bytes transferred is returned in the global function Ibcnt.
Board-Level
If ud is a board descriptor, ibwrta begins an asynchronous write of count bytes of data from wrtbuf to a GPIB device. A board-level ibwrta assumes that the GPIB is already properly addressed. The operation terminates normally when count bytes have been sent. 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 with the I/O in progress. Once the asynchronous I/O begins, 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 the IbcPAD and IbcSAD options in ibconfig. | |
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. |
ENOL | No Listeners were detected on the bus. |
EOIP | Asynchronous I/O is in progress. |