2-34
Return to
KPCI-488LPA-900-01 Rev. A / December 2008
Section 2: NI Command Compatible Functions
Model KPCI-488LPA GPIB Controller Interface Card User’s Manual
Support Level
Board / device level
Syntax
Microsoft C/C++ and Borland C++
int ibwrt (int ud, const void *buf, long cnt)
Visual Basic
ibwrt (ByVal ud As Integer, ByVal buf As String,
ByVal cnt As Long) As Integer
- or -
call ibwrt (ByVal ud As Integer, ByVal buf As
String)
Parameters
ud
: device unit descriptor
buf
: the buffer that contains the sent data bytes
cnt
: the number of sent data bytes
Return Value
The value of the
ibsta
Error Codes
EADR, EABO, EBUS, ECIC, EDVR, EOIP, ENEB, ENOL
ibwrta
Description
This command asynchronously writes data from a buffer to a device .
When ud is a device descriptor,
ibwrta
addresses the GPIB and writes count data
bytes (
cnt
is the tallying value in the counter) from the board’s memory to the GPIB
device. The operation normally ends when the count data bytes have been written; if
the count bytes are not written completely during the timeout period, the operation
stops with an error. The number of bytes actually transferred is returned in the global
variable
ibcntl
.
When ud is a board descriptor, the board-level
ibwrt
automatically writes cnt data
bytes from the buffer to the GPIB device. Normally, this operation ends when the
count data bytes are completely written; if cnt bytes are not written during the timeout
period (or, if the board is not CIC and CIC sends the
Device Clear message
on the
GPIB bus), the operation stops with an error. The number of bytes actually transferred
is returned in the global variable
ibcntl
.
The design purpose of the asynchronous I/O commands (
ibcmda
,
ibrda
,
ibwrta
) is
that applications can perform other non-GPIB operations while the I/O is in progress.
Once the asynchronous I/O has begun, later GPIB commands are strictly limited; any
command that would interfere with the I/O in progress will not be allowed. In this case
the
EOIP
is returned by the driver.
When the I/O is complete, the application and the driver must be re-synchronized.
Use one of the following functions to re-synchronize:
ibwait
: If the CMPL bit of the returned
ibsta
is set, the driver and application are re-
synchronized.
ibnotify
: If the
ibsta
value sent to the ibnotify callback contains
CMPL
, the driver and
application are re-synchronized.
ibstop
: The I/O is stopped, and the driver and application are re-synchronized.
ibonl
: The I/O is stopped and the interface is reset; the driver and application are re-
synchronized.