National Instruments GPIB-PCII Getting Started page 37

Hide thumbs Also See for GPIB-PCII:
Table of Contents

Advertisement

Chapter 3
Writing an Advanced Program Using NI-488.2 Routines
main() {
/*
Our board needs to be the Controller-In-Charge in order to
*
perform the Find All Listeners protocol.
*/
SendIFC(0);
if (ibsta < 0) {
gpiberr ("SendIFC(0) error");
ibonl (0,0);
exit(1);
}
/*
Create an array with all of the valid GPIB primary
addresses.
*
This array will be given to the Find All Listeners protocol.
*/
for (loop = 0; loop <= 30; loop++) {
instruments[loop] = loop;
}
instruments[31] = NOADDR;
/*
Find all of the listeners on the bus.
*/
printf("Finding all listeners on the bus...\n");
FindLstn(0, instruments, result, 31);
if (ibsta < 0) {
gpiberr("FindLstn error");
ibonl (0,0);
exit(1);
}
num_listeners = ibcnt - 1;
printf("Number of instruments found = %d\n", num_listeners);
/*
*
Now send the *IDN? command to each of the devices that we
*
found.
*
*
Our board is at address 0 by default.
*
respond to *IDN?, so skip it.
*/
for (loop = 1; loop <= num_listeners; loop++) {
Send(0, result[loop], "*IDN?", 5L, NLend);
Receive(0, result[loop], buffer, 100L, STOPend);
buffer[ibcnt] = '\0';
printf("The instrument at address %d, %d is a %s\n",
GetPAD(result[loop]),
GetSAD(result[loop]), buffer);
© National Instruments Corp.
/* Mark the end of the array.*/
Our board does not
3-13
PCII/IIA and NI-488.2 MS-DOS

Advertisement

Table of Contents
loading

This manual is also suitable for:

Gpib-pciia181065-01181065-02

Table of Contents