Ibcmda, Ibcmda -10 – Measurement Computing GPIB-488 User Manual
Page 23

Chapter 3
GPIB 488.1 Library Reference
3-10
GPIB-488
IBCMDA
Transfers GPIB commands asynchronously from a string.
Syntax
C
ibcmda (int board, char cmnd[], long bytecount)
Parameters
board
is an integer containing the board handle.
cmnd
is thecommand string to be sent. This string is comprised of GPIB multiline
commands.These commands are listed in Appendix A,
.
bytecount
is the number of command bytes to be transferred. Note that in C, although this
parameter is of type long, integer values and variables can also be passed.
Returns
ibsta
will contain a 16-bit status word as described in Appendix B,
.
iberr
will contain an error code, if an error occurred. An ECIC error is generated if the GPIB
Interface Board specified is not the Active Controller. If no listening devices are found, the
ENOL error is returned.
ibcnt
,
ibcntl
will contain the number of bytes that were transferred.
ibcnt
is a 16-bit
integer.
ibcntl
is a 32-bit integer. If the requested count was greater than 64 K, use
ibcntl
instead of
ibcnt
.
Usage Notes
This routine passes only commands. It is not used to transmit programming instructions (data)
to devices. Use the
ibrd
/
ibwrt
routines for this purpose.
Asynchronous I/O is not explicitly supported and will be treated as synchronous.
Example
This example prepares the board to talk and addresses three devices (at addresses 8, 9, and
10) to listen.
ibcmda
executes in the background and the program continues into the WHILE
loop. This loop calls
ibwait
to update
ibsta
and checks
ibsta
to see if
ibcmda
has
completed or an error has occurred. The program may do anything within the WHILE loop
except make other GPIB I/O calls.
C
char command[] = "\0x3f\0x5f\0x40\0x28\0x29\0x2a"
ibcmda (board, command, 6);
while ( (ibsta & CMPL+ERR) == 0)
ibwait (board, 0);