Developing Your Application
Chapter 3
NI-488.2M UM for Windows NT
3-14
© National Instruments Corp.
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");
ibonl(0,0);
exit(1);
}
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.
Step 4. Initialize the Instrument
After you find the multimeter, use the
DevClear
routine to clear it. The first argument
is the GPIB board number. The second argument is the GPIB address of the multimeter.
Then send the IEEE 488.2 Reset command to the meter.
DevClear(0, fluke);
if (ibsta & ERR) {
gpiberr("DevClear error")
}
Send(0, fluke, "*RST", 4L, NLend);
if (ibsta & ERR) {
gpiberr("Send *RST error");
}
sum = 0.0;
for(m =0; m<10; m++){
/* start of loop for Steps 5 through 8 */