Developing Your Application
Chapter 3
NI-488.2M SRM for OS/2
3-18
© National Instruments Corp.
Step 6. Trigger the Instrument
In the previous step, the multimeter was instructed to wait for a trigger before
conducting a measurement. Now send a trigger command to the multimeter.
You could use the
Trigger
routine to accomplish this, but because the Fluke
45 is IEEE 488.2 compatible, you can just send it the trigger command,
*TRG.
The
VAL1?
command instructs the meter to send the next triggered reading to
its output buffer.
Send(0, fluke, "*TRG; VAL1?", 11L, NLend);
if (ibsta & ERR) {
gpiberr("Send trigger error");
}
Step 7. Wait for the Measurement
After the meter is triggered, it takes a measurement and displays it on its front
panel, then asserts SRQ. You can detect the assertion of SRQ by using either
the
TestSRQ
or
WaitSRQ
routine. If you have a process that you want to
execute while you are waiting for the measurement, use
TestSRQ
. For this
example, you can use the
WaitSRQ
routine. The first argument in
WaitSRQ
is
the GPIB board number. The second argument is a flag returned by
WaitSRQ
.
This flag indicates whether SRQ is asserted.
WaitSRQ(0, &SRQasserted);
if (!SRQasserted) {
gpiberr("WaitSRQ error");
}
After you have detected SRQ, use the
ReadStatusByte
routine to poll the
meter and determine its status. The first argument is the GPIB board number,
the second argument is the GPIB address of the instrument, and the last
argument is a variable that
ReadStatusByte
uses to store the status byte of
the instrument.
ReadStatusByte(0, fluke, &statusByte);
if (ibsta & ERR) {
gpiberr("ReadStatusByte error");
}