Developing Your Application
Chapter 3
NI-488.2M UM for Windows NT
3-8
© National Instruments Corp.
General Program Steps and Examples
The following steps demonstrate how to use the NI-488 device functions in your
program. This example configures a digital multimeter, reads 10 voltage measurements,
and computes the average of these measurements.
Step 1. Open a Device
Your first NI-488 function call should be to
ibdev
to open a device.
ud = ibdev(0, 1, 0 , T10s, 1, 0);
if (ibsta & ERR) {
gpiberr("ibdev error");
}
The input arguments of the
ibdev
function are as follows:
0
- board index for GPIB0
1
- primary GPIB address of the device
0
- no secondary GPIB address for the device
T10s
- I/O timeout value (10 s)
1
- send END message with the last byte when writing to device
0
- disable EOS detection mode
When you call
ibdev
, the driver automatically initializes the GPIB by sending an
Interface Clear (IFC) message and placing the device in remote programming state.
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");
}