Developing Your Application
Chapter 3
NI-488.2M SRM for OS/2
3-16
© National Instruments Corp.
Step 3. Identify the Instrument
Send an identification query to each device for identification. For this example,
assume that all the instruments are IEEE 488.2 compatible and can accept the
identification query,
*IDN?
. In addition, assume that
FindLstn
found the
GPIB interface board at primary address 0 (default) and, therefore, you can skip
the first entry in the
result
array.
for (loop = 1; loop <= num_Listeners; loop++) {
Send(0, result[loop], "*IDN?", 5L, NLend);
if (ibsta & ERR) {
gpiberr("Send error");
}
Receive(0, result[loop], buffer, 10L, STOPend);
if (ibsta & ERR) {
gpiberr("Receive error");
}
buffer[ibcntl] = '\0';
printf("The instrument at address %d is a %s\n",
result[loop], buffer);
if (strncmp(buffer, "Fluke, 45", 9) == 0) {
fluke = result[loop];
printf("**** Found the Fluke ****\n");
break;
}
}
if (loop > num_Listeners) {
printf("Did not find the Fluke!\n");
}
The constant
NLend
signals that the new line character with EOI is
automatically appended to the data to be sent.
The constant
STOPend
indicates that the read is stopped when EOI is detected.