Developing Your Application
Step 2. Clear the Device
Clear the device before you configure the device for your application. Clearing
the device resets its internal functions to a default state.
ibclr(ud);
if (ibsta & ERR) {
gpiberr("ibclr error");
}
Step 3. Configure the Device
After you open and clear the device, it is ready to receive commands. To
configure the instrument, you send device-specific commands using the ibwrt
function. Refer to the instrument user manual for the command bytes that work
with your instrument.
ibwrt(ud, "*RST; VAC; AUTO; TRIGGER 2; *SRE 16", 35L);
if (ibsta & ERR) {
gpiberr("ibwrt error");
}
The programming instruction in this example resets the multimeter (*RST). The
meter is instructed to measure the volts alternating current (VAC) using
autoranging (AUTO), to wait for a trigger from the GPIB interface board before
starting a measurement (TRIGGER 2), and to assert the SRQ line when the
measurement completes and the multimeter is ready to send the result (*SRE
16).
Step 4. Trigger the Device
If you configure the device to wait for a trigger, you must send a trigger
command to the device before reading the measurement value. Next, you must
instruct the device to send the next triggered reading to its GPIB output buffer.
ibtrg(ud);
if (ibsta & ERR) {
gpiberr("ibtrg error");
}
NI-488.2M SRM for OS/2
3-10
© National Instruments Corp.
Chapter 3