beautypg.com

Receive, Receive -15 – Measurement Computing GPIB-488 User Manual

Page 83

background image

Chapter 4

GPIB 488.2 Library Reference

GPIB-488

4-15

Programming Reference Manual

Receive

Reads data from a GPIB device.

Syntax

C

Receive(int board, int address,char data[],

unsigned long count, int termination)

Parameters

board

is an integer which identifies the GPIB board to be used for this operation. In most

applications, this value is 0.

address

is an integer representing the GPIB address of the device that is to be read from.

count

specifies the maximum number of data bytes which are to be read.

termination

is the flag used to signal the end of data. If

termination

equals a value

between 0 and 00FF hex, the corresponding ASCII character is the termination character. The
read is stopped when this character is detected. If

termination

=

STOPend

(constant

defined in the header file), then the read is stopped when EOI is detected.

Returns

data

is the string that receives the data.

ibsta

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

IBSTA

.

iberr

will contain an error code, if an error occurred.

Usage Notes

The input data string is not terminated with a zero byte.

Example

Receive 50 bytes of data from the specified talker (device at address 2, connected to board).
EOI signals the end of the message.

C

char data[50];

Receive (0, 2, data, 50, STOPend);