Ibrda, Ibrda -36 – Measurement Computing GPIB-488 User Manual

Page 49

Advertising
background image

Chapter 3

GPIB 488.1 Library Reference

Programming Reference Manual

3-36

GPIB-488

IBRDA

Reads data asynchronously from a device/interface board into a string.

Syntax

C

ibrda (int boarddev, char buf[], unsigned long

bytecount)

Parameters

boarddev

is an integer containing the device/board handle.

buf

is the storage buffer for the data. Up to 4 gigabytes-1 (2

32

-1 bytes) can be stored. String

size may be limited by the language you are using. Check documentation for your language.

bytecount

specifies the maximum number of bytes to read.

Returns

ibsta

will contain a 16-bit status word as described in Appendix B,

IBSTA

.

iberr

will contain an error code of the first error detected, if an error occurred. An

EADR

results if the specified GPIB board is an Active Controller but has not been addressed to listen.
An

EABO

error results if a timeout occurs.

ibcnt

,

ibcntl

will contain the number of bytes that were read.

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

Asynchronous I/O is not explicitly supported and will be treated as synchronous.

Example

In this example,

ibwrt

sends the command "

DUMP

" to a device. The device responds by

sending back a large block of data.

ibrda

begins a transfer of 5000 bytes in the background

and the program continues on into the WHILE loop. The WHILE loop calls

ibwait

with

MASK

set to 0 to update

IBSTA

. The WHILE loop checks

IBSTA

to see if

ibrda

has

completed, or if an error has occurred. The program may do anything else within the WHILE
loop except make other GPIB I/O calls.

C

char *readbuffer[5000];

ibwrt (device, "DUMP");

ibrda (device, readbuffer, 5000);

while ( (ibsta & CMPL+ERR) == 0)

ibwait (device, 0)

Advertising