beautypg.com

Findlstn, Findlstn -7 – Measurement Computing GPIB-488 User Manual

Page 75

background image

Chapter 4

GPIB 488.2 Library Reference

GPIB-488

4-7

Programming Reference Manual

FindLstn

Finds all listeners on the GPIB.

Syntax

C

FindLstn(int board, short addresslist[], short

resultlist[], int limit)

Parameters

board

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

applications, this value is 0.

addresslist

is an array of GPIB addresses, terminated by the value

NOADDR

.

limit

is an integer which specifies how many address entries can be placed into the

resultlist

array. Set to the size of the

resultlist

array.

Returns

resultlist

will contain the addresses of all detected listeners. This array must be large

enough to hold all possible addresses.

ibsta

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

IBSTA

.

iberr

will contain an error code, if an error occurred. An

ETAB

(20) error indicates that more

listeners are present on the GPIB bus than limit will allow to be placed in

resultlist

. In

this case,

ibcnt

contains the number of addresses actually placed in

resultlist

.

Usage Notes

The addresses specified by

addresslist

are tested to see if a listening device is present. If

a listener is found at a primary address, its address is placed in

resultlist

. If no listeners

are detected at a primary address, then all secondary addresses associated with that primary
address are tested. If any listeners are detected, their addresses are placed in

resultlist

.

You can use this routine to determine how many devices on the network are capable of
listening. Once these devices are detected, they can be identified by their response to
identification request messages.

Example

This example verifies if listening devices are present at GPIB primary addresses 6 and 7 on
Board 0.

C

short addresslist[3] = {6,7,NOADDR};

short resultlist[4];

FindLstn(0, addresslist, resultlist, 4);