Chapter 3
Developing Your Application
© National Instruments Corp.
3-19
NI-488.2M SRM for OS/2
After you have obtained the status byte, you must check to see if the meter has a
message to send. You can do this by checking the message available (MAV)
bit, bit 4, in the status byte.
if (!(statusByte & MAVbit) {
gpiberr("Improper Status Byte");
printf("Status Byte = 0x%x\n", statusByte);
}
Step 8. Read the Measurement
Use the
Receive
function to read the measurement over the GPIB. The first
argument is the GPIB interface board number, and the second argument is the
GPIB address of the multimeter. The third argument is a string into which the
Receive
function places the data bytes from the multimeter. The fourth
argument represents the number of bytes to be received. The last argument
indicates that the
Receive
message terminates upon receiving a byte
accompanied with the END message.
Receive(0, fluke, buffer, 10L, STOPend);
if (ibsta & ERR) {
gpiberr("Receive error");
}
buffer[ibcntl] = '\0';
printf (Reading : %s\n", buffer);
sum += AsciiToFloat(buffer);
} /* end of loop started in Step 5 */
Step 9. Process the Data
Repeat Steps 5 through 8 in a loop until 10 measurements have been read, then
print the average of the readings as shown:
printf
(" The
average
of
the
10
readings
is
:
%f\n",
sum/10);