Ibwrta, Ibwrta -54 – Measurement Computing GPIB-488 User Manual

Page 67

Advertising
background image

Chapter 3

GPIB 488.1 Library Reference

Programming Reference Manual

3-54

GPIB-488

IBWRTA

Writes data asynchronously from a string to the specified device or GPIB interface board.

Syntax

C

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

bytecount)

Parameters

boarddev

is an integer containing the board or device 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 number of bytes to be written.

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

boarddev

specifies a board and the board has not already been addressed to talk.

ibcnt

,

ibcntl

will contain the number of bytes that were written.

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 a command ("

UPLOAD

") to a device. The device expects a block

of data to be sent immediately.

ibwrta

begins a transfer of 5000 bytes in the background and

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

ibwrta

has completed or any

error have occurred. The program may do anything else within the WHILE loop except make
other GPIB I/O calls.

C

char writebuffer[5000];

ibwrt (device, "UPLOAD")

ibwrta (device, writebuffer, 5000);

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

ibwait (device, 0)

Advertising